new ResourceSupply()
- Source:
Methods
AddActiveGatherer(player, entity) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
player |
number | The playerID owning the gatherer. |
entity |
number | The entityID gathering. |
- Source:
Returns:
- Whether the gatherer was successfully added to the active-gatherers list
or the entity was already in that list.
- Type
- boolean
AddGatherer(gathererID) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
gathererID |
number | The gatherer to add. |
- Source:
Returns:
- Whether the gatherer was successfully added to the entity's gatherers list
or the entity was already gathering us.
- Type
- boolean
Change(change) → {number}
Parameters:
Name | Type | Description |
---|---|---|
change |
number | The amount to change the resources with (can be negative). |
- Source:
Returns:
- The actual change in resourceSupply.
- Type
- number
CheckState(changeKey) → {boolean}
This verifies whether the current state of the supply matches the ones needed
for the specific timer to run.
Parameters:
Name | Type | Description |
---|---|---|
changeKey |
string | The name of the Change to verify the state for. |
- Source:
Returns:
- Whether the timer may run.
- Type
- boolean
CheckTimers()
Checks whether a timer ought to be added or removed.
- Source:
GetDiminishingReturns() → {number}
Each additional gatherer decreases the rate following a geometric sequence, with diminishingReturns as ratio.
- Source:
Returns:
The diminishing return if any, null otherwise.
- Type
- number
GetNumActiveGatherers() → {number}
- Source:
Returns:
- The number of currently active gatherers.
- Type
- number
GetType() → {Object}
- Source:
Returns:
An object containing the subtype and the generic type. All resources must have both.
- Type
- Object
IsAvailable() → {boolean}
- Source:
Returns:
- Whether this entity can have an additional gatherer.
- Type
- boolean
IsAvailableTo(gathererID) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
gathererID |
number | The gatherer's entity id. |
- Source:
Returns:
- Whether the ResourceSupply can have this additional gatherer or it is already gathering.
- Type
- boolean
IsGatheringUs(entity) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
entity |
number | The entityID to check for. |
- Source:
Returns:
- Whether the given entity is already gathering at us.
- Type
- boolean
OnEntityRenamed(msg)
Parameters:
Name | Type | Description |
---|---|---|
msg |
Object | Message to what the entity has been renamed. |
- Source:
OnOwnershipChanged(msg)
Parameters:
Name | Type | Description |
---|---|---|
msg |
Object | Message containing the old new owner. |
- Source:
OnValueModification(msg)
Parameters:
Name | Type | Description |
---|---|---|
msg |
Object | Message containing a list of values that were changed. |
- Source:
RecalculateValues()
Since the supposed changes can be affected by modifications, and applying those
are slow, do not calculate them every timer tick.
- Source:
RemoveGatherer(gathererID)
Parameters:
Name | Type | Description |
---|---|---|
gathererID |
number | The gatherer's entity id. |
- Source:
SetAmount(newValue)
Parameters:
Name | Type | Description |
---|---|---|
newValue |
number | The value to set the current amount to. |
- Source:
StartTimer(changeKey)
Parameters:
Name | Type | Description |
---|---|---|
changeKey |
string | The name of the Change to apply to the entity. |
- Source:
StopTimer(changeKey)
Parameters:
Name | Type | Description |
---|---|---|
changeKey |
string | The name of the change to stop the timer for. |
- Source:
TakeResources(amount) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
amount |
number | The amount of resources that should be taken from the resource supply. The amount must be positive. |
- Source:
Returns:
The current resource amount in the entity and whether it's exhausted or not.
- Type
- Object
TimerTick(changeKey)
Parameters:
Name | Type | Description |
---|---|---|
changeKey |
string | The name of the change to apply to the entity. |
- Source: