Methods
CanControlUnit()
Check if player can control this entity
returns: true if the entity is owned by the player and controllable
or control all units is activated, else false
- Source:
CanOwnerControlEntity() → {boolean}
- Source:
Returns:
- Whether the owner of this entity can control the entity.
- Type
- boolean
CanPlayerOrAllyControlUnit() → {boolean}
Check if player can control this entity
- Source:
Returns:
- True if the entity is valid and controlled by the player
or the entity is owned by an mutualAlly and can be controlled
or control all units is activated, else false.
- Type
- boolean
ClusterEntities()
Group a list of entities in clusters via single-links
- Source:
CopyControlGroups()
Copy over the obstruction control group IDs.
This is needed to ensure that when a group of structures with the same
control groups is replaced by a new entity, they remains in the same control group(s).
This is the mechanism that is used to e.g. enable wall pieces to be built closely
together, ignoring their mutual obstruction shapes (since they would
otherwise be prevented from being built so closely together).
- Source:
ExtractFormations()
Get some information about the formations used by entities.
- Source:
FilterEntityList()
Filter entities which the player can control.
- Source:
FilterEntityListWithAllies()
Filter entities which the player can control or are mutualAlly
- Source:
GetDockAngle()
Tries to find the best angle to put a dock at a given position
Taken from GuiInterface.js
- Source:
GetFormationUnitAIs()
Returns a list of UnitAI components, each belonging either to a
selected unit or to a formation entity for groups of the selected units.
- Source:
GetWallSegmentsRec(d, candidateSegments, minOverlap, maxOverlap, t, distSoFar, segments)
Helper function for GetWallPlacement. Finds a list of wall segments and the corresponding remaining spacing/overlap
distance "r" that will suffice to construct a wall of the given distance. It is understood that two extra towers will
be placed centered at the starting and ending points of the wall.
Parameters:
Name | Type | Description |
---|---|---|
d |
Total distance between starting and ending points (constant throughout calls). | |
candidateSegments |
List of candidate segments (constant throughout calls). Should be ordered longer-to-shorter for better execution speed. | |
minOverlap |
Minimum overlap factor (constant throughout calls). Must have a value between 0 (meaning walls are not allowed to overlap towers) and 1 (meaning they're allowed to overlap towers entirely). Must be <= maxOverlap. | |
maxOverlap |
Maximum overlap factor (constant throughout calls). Must have a value between 0 (meaning walls are not allowed to overlap towers) and 1 (meaning they're allowed to overlap towers entirely). Must be >= minOverlap. | |
t |
Length of a single tower (constant throughout calls). Acts as buffer space for wall segments (see comments). | |
distSoFar |
Sum of all the wall segments' lengths in 'segments'. | |
segments |
Current list of wall segments placed. |
IncurBribeCost()
Incur the player with the cost of a bribe, optionally multiply the cost with
the additionalMultiplier
- Source:
IsOwnedByAllyOfEntity()
Returns true if the entity 'target' is owned by an ally of
the owner of 'entity'.
IsOwnedByAllyOfPlayer()
Returns true if the entity 'target' is owned by an ally of player
IsOwnedByPlayer()
Returns true if the entity 'target' is owned by player
IsOwnedByPlayerOrMutualAlly(entity, player) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
entity |
number | The entityID to verify. |
player |
number | The playerID to check against. |
- Source:
Returns:
.
- Type
- boolean
notifyBackToWorkFailure()
Sends a GUI notification about worker(s) that failed to go back to work.
- Source:
notifyOrderFailure(player)
Sends a GUI notification about entities that can't be controlled.
Parameters:
Name | Type | Description |
---|---|---|
player |
number | The player-ID of the player that needs to receive this message. |
- Source:
notifyUnloadFailure()
Sends a GUI notification about unit(s) that failed to ungarrison.
- Source:
QueryBuilderListInterface()
Similar to Engine.QueryInterface, but checks for all interfaces
implementing a builder list (currently Foundation and Repairable)
TODO Foundation and Repairable could both implement a BuilderList component
QueryMiragedInterface()
Similar to Engine.QueryInterface but first checks if the entity
mirages the interface.
QueryOwnerEntityID(id)
Parameters:
Name | Type | Description |
---|---|---|
id |
An entity's ID |
Returns:
The entity ID of the owner player (not his player ID) or ent if ent is a player entity.
QueryOwnerInterface()
Similar to Engine.QueryInterface but applies to the player entity
that owns the given entity.
iid is typically IID_Player.
QueryPlayerIDInterface()
Similar to Engine.QueryInterface but applies to the player entity
with the given ID number.
iid is typically IID_Player.
RemoveFromFormation()
Remove the given list of entities from their current formations.
- Source:
TryConstructBuilding()
Attempts to construct a building using the specified parameters.
Returns true on success, false on failure.
- Source: