new ModifiersManager()
- Source:
Methods
AddModifier()
The following functions simply proxy MultiKeyMap's interface.
- Source:
ApplyModifiers(propertyName, originalValue, ent)
Caching system in front of FetchModifiedProperty(), as calling that every time is quite slow.
This recomputes lazily.
Applies per-player modifiers before per-entity modifiers, so the latter take priority;
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
Handle of a technology property (eg Attack/Ranged/Pierce) that was changed. | |
originalValue |
template/raw/before-modifiers value. Note that if this is supposed to be a number (i.e. you call add/multiply on it) You must make sure to pass a number and not a string (by using + if necessary) | |
ent |
ID of the target entity |
- Source:
Returns:
originalValue after the modifiers
ApplyTemplateModifiers()
Alternative version of ApplyModifiers, applies to templates instead of entities.
Only needs to handle global modifiers.
- Source:
Cache()
- Source:
Returns:
originalValue after modifiers
FetchModifiedProperty()
- Source:
Returns:
originalValue after modifiers.
ModifiersChanged()
Inform entities that we have changed possibly all values affected by that property.
It's not hugely efficient and would be nice to batch.
Invalidate caches where relevant.
- Source:
OnGlobalOwnershipChanged()
Handle modifiers when an entity changes owner.
We do not retain the original modifiers for now.
- Source:
OnGlobalPlayerEntityChanged()
For efficiency in InvalidateCache, keep playerEntitiesCached updated.
- Source: