new Capturable()
- Source:
Methods
CanCapture(playerID) → {boolean}
Check if the source can (re)capture points from this building.
Parameters:
Name | Type | Description |
---|---|---|
playerID |
number | PlayerID of the source. |
- Source:
Returns:
- Whether the source can (re)capture points from this building.
- Type
- boolean
Capture(amount, captor, captorOwner) → {Object}
Compute the amount of capture points to be reduced and reduce them.
Parameters:
Name | Type | Description |
---|---|---|
amount |
number | Number of capture points to be taken. |
captor |
number | The entity capturing us. |
captorOwner |
number | Owner of the captor. |
- Source:
Returns:
- Object of the form { "captureChange": number }, where number indicates the actual amount of capture points taken.
- Type
- Object
CheckTimer()
Start the regeneration timer when no timer exists.
When nothing can be modified (f.e. because it is fully regenerated), the
timer stops automatically after one execution.
- Source:
GetCapturePoints()
Returns the current capture points array.
- Source:
OnGlobalPlayerDefeated()
When a player is defeated, reassign the capture points of non-owned entities to gaia.
Those owned by the defeated player are dealt with onOwnershipChanged.
- Source:
Reduce(amount, playerID) → {number}
Reduces the amount of capture points of an entity,
in favour of the player of the source.
Parameters:
Name | Type | Description |
---|---|---|
amount |
number | Number of capture points to be taken. |
playerID |
number | ID of player the capture points should be awarded to. |
- Source:
Returns:
- The number of capture points actually taken.
- Type
- number
RegisterCapturePointsChanged()
This has to be called whenever the capture points are changed.
It notifies other components of the change, and switches ownership when needed.
- Source:
SetCapturePoints(capturePointsArray)
Set the new capture points, used for cloning entities.
The caller should assure that the sum of capture points
matches the max.
Parameters:
Name | Type | Description |
---|---|---|
capturePointsArray |
Array.<number> | Array with for all players the new value. |
- Source:
UpdateCachedValues()
Update all chached values that could be affected by modifications.
- Source:
UpdateCachedValuesAndNotify(message)
Update all chached values that could be affected by modifications.
Check timer and send changed messages when required.
Parameters:
Name | Type | Description |
---|---|---|
message |
boolean | Whether not to send a CapturePointsChanged message. When false, caller should take care of sending that message. |
- Source: