new Formation()
- Source:
Methods
ComputeMotionParameters()
Set formation controller's speed based on its current members.
- Source:
Disband()
Remove all members and destroy the formation.
- Source:
DoesAngleDifferenceAllowTurning()
Returns true if the difference between two given angles (in radians)
are smaller than the maximum turning angle of the formation and therfore allow
the formation turn without reassigning positions.
- Source:
GetFormationAnimationVariant(entity)
Get the formation animation variant for a certain member of this formation.
Parameters:
Name | Type | Description |
---|---|---|
entity |
The entity ID to get the animation for. |
- Source:
Returns:
The name of the animation variant as defined in the template,
e.g. "testudo_front" or undefined if does not exist.
GetPrimaryMember()
Returns the 'primary' member of this formation (typically the most
important unit type), for e.g. playing a representative sound.
Returns undefined if no members.
TODO: Actually implement something like that. Currently this just returns
the arbitrary first one.
- Source:
GetRealOffsetPositions()
Get the world positions for a list of offsets in this formation.
- Source:
MoveMembersIntoFormation(moveCenter, force, variant)
Set all members to form up into the formation shape.
Parameters:
Name | Type | Description |
---|---|---|
moveCenter |
boolean | The formation center will be reinitialized to the center of the units. |
force |
boolean | All individual orders of the formation units are replaced, otherwise the order to walk into formation is just pushed to the front. |
variant |
string | undefined | Variant to be passed as order parameter. |
- Source:
RemoveMembers(rename)
Remove the given list of entities.
The entities must already be members of this formation.
Parameters:
Name | Type | Description |
---|---|---|
rename |
boolean | Whether the removal was part of an entity rename (prevents disbanding of the formation when under the member limit). |
- Source:
SetFormationSeparation()
Set the value from which two twin formations will become one.
- Source:
SetMembers()
Initialize the members of this formation.
Must only be called once.
All members must implement UnitAI.
- Source:
SetRearrange()
Set whether we are allowed to rearrange formation members.
- Source:
SetupPositionAndHandleRotation()
Set formation position.
If formation is not in world at time this is called, set new rotation and flag
for rangeManager. Also set the rotation if it is forced.
- Source:
TakeClosestOffset(entPos, realPositions, offsets)
Search the closest position in the realPositions list to the given entity.
Parameters:
Name | Type | Description |
---|---|---|
entPos |
Object with entity position and entity ID. | |
realPositions |
The world coordinates of the available offsets. | |
offsets |
- Source:
Returns:
The index of the closest offset position.