The UnitsManager handles the creation, update, and control of units. Data is strictly updated by the server ONLY. This means that any interaction from the user will always and only result in a command to the server, executed by means of a REST PUT request. Any subsequent change in data will be reflected only when the new data is sent back by the server. This strategy allows to avoid client/server and client/client inconsistencies.

Hierarchy

  • UnitsManager

Constructors

Properties

#copiedUnits: UnitData[]
#hiddenTypes: string[] = []
#requestDetectionUpdate: boolean = false
#selectionEventDisabled: boolean = false
#units: {
    [ID: number]: Unit;
}

Type declaration

Methods

  • Add a new unit to the manager

    Parameters

    • ID: number

      ID of the new unit

    • category: string

      Either "Aircraft", "Helicopter", "GroundUnit", or "NavyUnit". Determines what class will be used to create the new unit accordingly.

    Returns void

  • Parameters

    • coalitionArea: CoalitionArea
    • types: {
          [key: string]: boolean;
      }
      • [key: string]: boolean
    • eras: {
          [key: string]: boolean;
      }
      • [key: string]: boolean
    • ranges: {
          [key: string]: boolean;
      }
      • [key: string]: boolean
    • density: number
    • distribution: number

    Returns void

  • Parameters

    • Optional options: {
          excludeHumans?: boolean;
          onlyOnePerGroup?: boolean;
      }
      • Optional excludeHumans?: boolean
      • Optional onlyOnePerGroup?: boolean

    Returns Unit[]

  • Parameters

    • variableGetter: CallableFunction

    Returns any

  • Get a specific unit by ID

    Parameters

    • ID: number

      ID of the unit. The ID shall be the same as the unit ID in DCS.

    Returns null | Unit

    Unit object, or null if no unit with said ID exists.

  • Returns all the units that belong to a hotgroup

    Parameters

    • hotgroup: number

      Hotgroup number

    Returns Unit[]

    Array of units that belong to hotgroup

  • Parameters

    • ID: number
    • deselectAllUnits: boolean = true

    Returns void

  • ********************* Actions on selected units ***********************

    Parameters

    • latlng: LatLng
    • mantainRelativePosition: boolean
    • rotation: number

    Returns void

  • Parameters

    • latlng: LatLng
    • rotation: number

    Returns {
        [key: number]: LatLng;
    }

    • [key: number]: LatLng
  • Parameters

    • ID: number
    • Optional offset: {
          x: number;
          y: number;
          z: number;
      }
      • x: number
      • y: number
      • z: number
    • Optional formation: string

    Returns void

  • Parameters

    • emissionCountermeasure: string

    Returns void

  • Parameters

    • reactionToThreat: string

    Returns void

  • Parameters

    • category: string
    • units: any
    • coalition: string = "blue"
    • immediate: boolean = true
    • airbase: string = ""
    • country: string = ""
    • callback: CallableFunction = ...

    Returns boolean

  • Update the data of all the units. The data is directly decoded from the binary buffer received from the REST Server. This is necessary for performance and bandwidth reasons.

    Parameters

    • buffer: ArrayBuffer

      The arraybuffer, encoded according to the ICD defined in: TODO Add reference to ICD

    Returns number

    The decoded updateTime of the data update.

Generated using TypeDoc