Module RadarUnit
List local constructs and access their ID.
Element class:
- RadarPvPAtmospheric
- RadarPVPSpaceSmallGroup
- RadarPVPSpaceMediumGroup
- RadarPVPSpaceLargeGroup
Displayed widget fields:
- constructsList
- targetId
- elementId
- properties
- staticProperties
Extends: Element
Functions
isOperational () | Deprecated: Returns 1 if the radar is not broken, works in the current environment and is not used by another control unit. |
getOperationalState () | Returns 1 if the radar is not broken, works in the current environment and is not used by another control unit. |
getRange () | Returns the scan range of the radar. |
getIdentifyRanges () | Returns ranges to identify a target based on its core size. |
getConstructIds () | Returns the list of construct IDs in the scan range. |
getSortMethod () | Gets the sort method for construct data. |
setSortMethod (method) | Sets the sort method for construct data. |
getIdentifiedConstructIds () | Returns the list of identified construct IDs. |
getConstructs (offset, size) | Returns a list of constructs in a given range according to the sort method. |
getTargetId () | Returns the ID of the target construct. |
getConstructDistance (id) | Returns the distance to the given construct. |
isConstructIdentified (id) | Returns 1 if the given construct is identified. |
isConstructAbandoned (id) | Returns 1 if the given construct was abandoned. |
getConstructCoreSize (id) | Returns the core size of the given construct. |
getThreatTo (id) | Deprecated: Returns the threat rate your construct is for the given construct. |
getThreatRateTo (id) | Returns the threat rate your construct is for the given construct. |
getThreatFrom (id) | Deprecated: Returns the threat rate the given construct is for your construct. |
getThreatRateFrom (id) | Returns the threat rate the given construct is for your construct. |
hasMatchingTransponder (id) | Returns whether the target has an active transponder with matching tags. |
getConstructOwner (id) | Deprecated: Returns a table with id of the owner entities (player or organization) of the given construct, if in range and if active transponder tags match. |
getConstructOwnerEntity (id) | Returns a table with id of the owner entity (player or organization) of the given construct, if in range and if active transponder tags match for owned dynamic constructs. |
getConstructSize (id) | Return the size of the bounding box of the given construct, if in range. |
getConstructType (id) | Deprecated: Return the type of the given construct. |
getConstructKind (id) | Returns the kind of the given construct. |
getConstructPos (id) | Returns the position of the given construct in construct local coordinates, if the active transponder tags match for owned dynamic constructs. |
getConstructWorldPos (id) | Returns the position of the given construct in world coordinates, if in range and if the active transponder tags match for owned dynamic constructs. |
getConstructVelocity (id) | Returns the velocity vector of the given construct in construct local coordinates, if identified and if the active transponder tags match for owned dynamic constructs. |
getConstructWorldVelocity (id) | Returns the velocity vector of the given construct in world coordinates, if identified and if the active transponder tags match for owned dynamic constructs. |
getConstructMass (id) | Returns the mass of the given construct, if identified for owned dynamic constructs. |
getConstructName (id) | Return the name of the given construct, if defined. |
getConstructInfos (id) | Returns a list of working elements on the given construction, if identified for owned dynamic constructs. |
getConstructSpeed (id) | Returns the speed of the given construct, if identified for owned dynamic constructs. |
getConstructAngularSpeed (id) | Returns the angular speed of the given construct to your construct, if identified for owned dynamic constructs. |
getConstructRadialSpeed (id) | Returns the radial speed of the given construct to your construct, if identified for owned dynamic constructs. |
EVENT_enter (id) | Deprecated: Event: Emitted when a construct enters the range of the radar unit. |
EVENT_onEnter (id) | Event: Emitted when a construct enters the scan range of the radar. |
EVENT_leave (id) | Deprecated: Event: Emitted when a construct leaves the range of the radar unit. |
EVENT_onLeave (id) | Event: Emitted when a construct leaves the range of the radar. |
EVENT_onIdentified (id) | Event: Emitted when a construct is identified. |
mockRegisterEnter (callback) | Mock only, not in-game: Register a handler for the in-game `enter(id)` event. |
mockDoEnter (id) | Mock only, not in-game: Simulates a construct entering the radar range. |
mockRegisterLeave (callback) | Mock only, not in-game: Register a handler for the in-game `leave(id)` event. |
mockDoLeave (id) | Mock only, not in-game: Simulates a construct leaving the radar range. |
mockGetClosure () | Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":". |
Functions
- isOperational ()
-
Deprecated: Returns 1 if the radar is not broken, works in the current environment and is not used by another control unit.
This method is deprecated: getOperationalState should be used instead
Returns:
-
0/1
1 if the radar is operational, 0 otherwise.
See also:
- getOperationalState ()
-
Returns 1 if the radar is not broken, works in the current environment and is not used by another control unit.
Returns:
-
int
1 if the radar is operational, otherwise: 0 = broken, -1 = bad environment, -2 = obstructed,
-3 = already in use.
- getRange ()
-
Returns the scan range of the radar.
Returns:
-
float
The scan range in meters.
- getIdentifyRanges ()
-
Returns ranges to identify a target based on its core size.
Returns:
-
list
The list of float values for ranges in meters as { xsRange, sRange, mRange, lRange }.
- getConstructIds ()
-
Returns the list of construct IDs in the scan range.
Returns:
-
list
The list of scanned construct IDs.
- getSortMethod ()
-
Gets the sort method for construct data.
Possible sort methods:
- 1: Distance Ascending
- 2: Distance Descending
- 3: Size Ascending
- 4: Size Descending
- 5: Threat Ascending
- 6: Threat Descending
Returns:
-
int
The sort method.
- setSortMethod (method)
-
Sets the sort method for construct data.
Possible sort methods:
- 1: Distance Ascending
- 2: Distance Descending
- 3: Size Ascending
- 4: Size Descending
- 5: Threat Ascending
- 6: Threat Descending
Parameters:
- method int The sort method.
Returns:
-
0/1
1 if the sort method was set successfully, 0 otherwise.
- getIdentifiedConstructIds ()
-
Returns the list of identified construct IDs.
Returns:
-
list
The list of identified construct IDs.
- getConstructs (offset, size)
-
Returns a list of constructs in a given range according to the sort method.
Parameters:
- offset int Offset from the first entry.
- size int Total entries to return following the offset, 0 to return all entries.
Returns:
-
list
The list of constructs.
- getTargetId ()
-
Returns the ID of the target construct.
Returns:
-
int
The ID of the target construct.
- getConstructDistance (id)
-
Returns the distance to the given construct.
Parameters:
- id int The ID of the construct.
Returns:
-
float
The distance between the current and target construct center.
- isConstructIdentified (id)
-
Returns 1 if the given construct is identified.
Parameters:
- id int The ID of the construct.
Returns:
-
1/0
1 if the construct is identified, 0 otherwise.
- isConstructAbandoned (id)
-
Returns 1 if the given construct was abandoned.
Parameters:
- id int The ID of the construct.
Returns:
-
1/0
1 if the construct has no owner, 0 otherwise.
- getConstructCoreSize (id)
-
Returns the core size of the given construct.
Parameters:
- id int The ID of the construct.
Returns:
-
string
The core size name; can be: XS, S, M, L
- getThreatTo (id)
-
Deprecated: Returns the threat rate your construct is for the given construct.
This method is deprecated: getThreatRateTo should be used instead
Parameters:
- id int The ID of the construct.
Returns:
-
string
none, identified, threatened_identified, threatened, attacked
See also:
- getThreatRateTo (id)
-
Returns the threat rate your construct is for the given construct.
Parameters:
- id int The ID of the construct.
Returns:
-
string
none, identified, threatened_identified, threatened, attacked
- getThreatFrom (id)
-
Deprecated: Returns the threat rate the given construct is for your construct.
This method is deprecated: getThreatRateFrom should be used instead
Parameters:
- id int The ID of the construct.
Returns:
-
string
none, identified, threatened_identified, threatened, attacked
See also:
- getThreatRateFrom (id)
-
Returns the threat rate the given construct is for your construct.
Parameters:
- id int The ID of the construct.
Returns:
-
string
none, identified, threatened_identified, threatened, attacked
- hasMatchingTransponder (id)
-
Returns whether the target has an active transponder with matching tags.
Parameters:
- id int The ID of the construct.
Returns:
-
1/0
1 if our construct and the target have active transponders with matching tags, 0 otherwise.
- getConstructOwner (id)
-
Deprecated: Returns a table with id of the owner entities (player or organization) of the given construct,
if in range and if active transponder tags match.
This method is deprecated: getConstructOwnerEntity should be used instead
Parameters:
- id int The ID of the construct.
Returns:
-
table
A table { playerId: pID, organizationId: oID } describing the owner. Use
system.getPlayerName(pID) and
system.getOrganizationName(oID) to retrieve info about it.
See also:
- getConstructOwnerEntity (id)
-
Returns a table with id of the owner entity (player or organization) of the given construct, if in range and if
active transponder tags match for owned dynamic constructs.
Parameters:
- id int the ID of the construct.
Returns:
-
table
A table with fields {[int] id, [bool] isOrganization} descriving the owner. Use
system:getPlayerName and system:getOrganization to retrieve info about it.
- getConstructSize (id)
-
Return the size of the bounding box of the given construct, if in range.
Parameters:
- id int The ID of the construct.
Returns:
-
vec3
The size of the construct in xyz-coordinates.
- getConstructType (id)
-
Deprecated: Return the type of the given construct.
This method is deprecated: getConstructKind should be used instead
Parameters:
- id int The ID of the construct.
Returns:
-
string
The type of the construct,: can be 'static', 'space' or 'dynamic'.
See also:
- getConstructKind (id)
-
Returns the kind of the given construct.
Possible kinds:
- 1: Universe
- 2: Planet
- 3: Asteroid
- 4: Static
- 5: Dynamic
- 6: Space
- 7: Alien
Parameters:
- id int the ID of the construct.
Returns:
-
int
The kind index of the construct.
- getConstructPos (id)
-
Returns the position of the given construct in construct local coordinates, if the active transponder tags match
for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
vec3
The xyz local coordinates relative to the construct center.
- getConstructWorldPos (id)
-
Returns the position of the given construct in world coordinates, if in range and if the active transponder tags
match for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
vec3
The xyz world coordinates of the construct center.
- getConstructVelocity (id)
-
Returns the velocity vector of the given construct in construct local coordinates, if identified and if the active
transponder tags match for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
vec3
The xyz local coordinates of the construct velocity.
- getConstructWorldVelocity (id)
-
Returns the velocity vector of the given construct in world coordinates, if identified and if the active
transponder tags match for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
vec3
The xyz world coordinates of the construct velocity.
- getConstructMass (id)
-
Returns the mass of the given construct, if identified for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
float
the mass of the construct in kilograms.
- getConstructName (id)
-
Return the name of the given construct, if defined.
Parameters:
- id int The ID of the construct.
Returns:
-
string
The name of the construct.
- getConstructInfos (id)
-
Returns a list of working elements on the given construction, if identified for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
table
A table {[float] weapons, [float] radars, [float] antiGravity], [float] atmoEngines,
[float] spaceEngines, [float] rocketEngines} with values between 0.0 and 1.0. Exceptionally antiGravity and
rocketEngines are always 1.0 if present, even if broken.
- getConstructSpeed (id)
-
Returns the speed of the given construct, if identified for owned dynamic constructs.
Parameters:
- id int the ID of the construct.
Returns:
-
float
The speed of the construct relative to the universe in meters per second.
- getConstructAngularSpeed (id)
-
Returns the angular speed of the given construct to your construct, if identified for owned dynamic constructs.
Parameters:
- id int The ID of the construct.
Returns:
-
float
The angular speed of the construct relative to your construct in radians per second.
- getConstructRadialSpeed (id)
-
Returns the radial speed of the given construct to your construct, if identified for owned dynamic constructs.
Parameters:
- id int The id of the construct.
Returns:
-
float
The radial speed of the construct relative to your construct in meters per second.
- EVENT_enter (id)
-
Deprecated: Event: Emitted when a construct enters the range of the radar unit.
Note: This is documentation on an event handler, not a callable method.
This event is deprecated: EVENT_onEnter should be used instead.
Parameters:
- id int ID of the construct; can be used with database.getConstruct to retrieve info about it.
See also:
- EVENT_onEnter (id)
-
Event: Emitted when a construct enters the scan range of the radar.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The ID of the construct.
- EVENT_leave (id)
-
Deprecated: Event: Emitted when a construct leaves the range of the radar unit.
Note: This is documentation on an event handler, not a callable method.
This event is deprecated: EVENT_onLeave should be used instead.
Parameters:
- id int ID of the construct; can be used with database.getConstruct to retrieve info about it.
See also:
- EVENT_onLeave (id)
-
Event: Emitted when a construct leaves the range of the radar.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The ID of the construct.
- EVENT_onIdentified (id)
-
Event: Emitted when a construct is identified.
Note: This is documentation on an event handler, not a callable method.
Parameters:
- id int The ID of the construct.
- mockRegisterEnter (callback)
-
Mock only, not in-game: Register a handler for the in-game `enter(id)` event.
Parameters:
- callback function The function to call when the a player enters.
Returns:
-
int
The index of the callback.
See also:
- mockDoEnter (id)
-
Mock only, not in-game: Simulates a construct entering the radar range.
Parameters:
- id int The ID of the construct that entered.
- mockRegisterLeave (callback)
-
Mock only, not in-game: Register a handler for the in-game `leave(id)` event.
Parameters:
- callback function The function to call when the tile is released.
Returns:
-
int
The index of the callback.
See also:
- mockDoLeave (id)
-
Mock only, not in-game: Simulates a construct leaving the radar range.
Parameters:
- id int The ID of the construct that left.
- mockGetClosure ()
-
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".
Returns:
-
table
A table encompasing the api calls of object.
See also: