Private #copiedPrivate #requestPrivate #selectionPrivate #unitsPrivate #onPrivate #onPrivate #onPrivate #showAutomatically create an Integrated Air Defence System from a CoalitionArea object. The units will be mostly focused around big cities. The bigger the city, the larger the amount of units created next to it. If the CoalitionArea does not contain any city, no units will be created
Boundaries of the IADS
Array of unit types to add to the IADS, e.g. AAA, SAM, flak, MANPADS
Array of eras to which the units added to the IADS can belong
Array of weapon ranges the units can have
Value between 0 and 100, controls the amout of units created
Value between 0 and 100, controls how "scattered" the units will be
See getUnitsVariable for more info
CallableFunction that returns the requested variable. Example: getUnitsVariable((unit: Unit) => unit.getName(), foo) will return a string value if all the units have the same name, otherwise it will return undefined.
The value of the variable if all units have the same value, else undefined
For a given unit, it returns if and how it is being detected by other units. NOTE: this function will return how a unit is being detected, i.e. how other units are detecting it. It will not return what the unit is detecting.
The unit of which to retrieve the "detected" methods.
Array of detection methods
This function allows to quickly determine the categories (Aircraft, Helicopter, GroundUnit, NavyUnit) of an array units. This allows to enable/disable specific controls which can only be applied to specific categories.
Array of units of which to retrieve the categories
Array of categories. Each category is present only once.
This function returns the value of a variable for each of the units in the input array. If all the units have the same value, returns the value, else returns undefined. This function is useful to present units data in the control panel, which will print a specific value only if it is the same for all the units. If the values are different, the control panel will show a "mixed values" value, or similar.
CallableFunction that returns the requested variable. Example: getUnitsVariable((unit: Unit) => unit.getName(), foo) will return a string value if all the units have the same name, otherwise it will return undefined.
Array of units of which to retrieve the variable
The value of the variable if all units have the same value, else undefined
Set a unit as "selected", which will allow to perform operations on it, like giving it a destination, setting it to attack a target, and so on
The ID of the unit to select
If true, the unit will be the only selected unit
Give a new destination to the selected units
Position of the new destination
If true, the selected units will mantain their relative positions when reaching the target. This is useful to maintain a formation for groun/navy units
Rotation in radians by which the formation will be rigidly rotated. E.g. a ( V ) formation will look like this ( < ) if rotated pi/4 radians (90 degrees)
Compute the destinations of every unit in the selected units. This function preserves the relative positions of the units, and rotates the whole formation by rotation.
Center of the group after the translation
Rotation of the group, in radians
Array of positions for each unit, in order
Instruct the selected units to follow another unit in a formation. Only works for aircrafts and helicopters.
ID of the unit to follow
Optional offset: { Optional parameter, defines a static offset. X: front-rear, positive front, Y: top-bottom, positive top, Z: left-right, positive right
Optional formation: stringOptional parameter, defines a predefined formation type. Values are: "trail", "echelon-lh", "echelon-rh", "line-abreast-lh", "line-abreast-rh", "front", "diamond"
Set a specific altitude type to all the selected units
Value to set, either "ASL" or "AGL". If "AGL" is selected, the unit will try to maintain the selected Above Ground Level altitude. Due to a DCS bug, this will only be true at the final position.
Set a specific speed type to all the selected units
Value to set, either "CAS" or "GS". If "CAS" is selected, the unit will try to maintain the selected Calibrated Air Speed, but DCS will still only maintain a Ground Speed value so errors may arise depending on wind.
Spawn a new group of units
Category of the new units
Array of unit tables
Coalition to which the new units will belong
If true the command will be performed immediately, but this may cause lag on the server
If true, the location of the units will be ignored and the units will spawn at the given airbase. Only works for aircrafts and helicopters
Set the country of the units. If empty string, the country will be assigned automatically
CallableFunction called when the command is received by the server
True if the spawn command was successfully sent
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.
The arraybuffer, encoded according to the ICD defined in: TODO Add reference to ICD
The decoded updateTime of the data update.
Generated using TypeDoc
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.