TimedStatModifier
A class in Root.Township, Alta.StatSystem.
A stat modifier that removes itself after a duration, using the Timeline. Can be sent over the network and saved.
- Listed in Stats, effects, heat and liquid
- Documented in Stats
Constructors
| Member | What it is |
|---|---|
TimedStatModifier(StatModifier modifier) | Creates a TimedStatModifier from modifier and duration. |
TimedStatModifier(StatModifier modifier, float duration) | Creates a TimedStatModifier from modifier and duration. |
Fields
| Member | What it is |
|---|---|
Action<TimedStatModifier> OnRemoved | Called when Remove runs. Not called when a loaded or received modifier expires, since those call the modifier's own remove. |
1 private and internal field
| Member | What it is |
|---|---|
private Timeline.IEntry entry | Timeline entry that removes the modifier when its time runs out. Saved and synced so the timer carries over. |
Properties
| Member | What it is |
|---|---|
StatModifier Modifier { get; private set; } | The stat modifier being timed. |
Methods
| Member | What it is |
|---|---|
void Cancel() | Cancels the timed removal. The modifier stays applied. |
static TimedStatModifier Load(StatManagerSaveData.TimedModifier data) | Rebuilds a timed modifier from save data. Returns null if its time has already run out. |
void Remove() | Removes the modifier from its stat and calls OnRemoved. |
StatManagerSaveData.TimedModifier Save() | Returns save data with the stat, value, multiplier flag and remaining time. |
static TimedStatModifier Serialize(TimedStatModifier baseValue, Stream stream) | Reads or writes a timed modifier on a network stream. Returns null when read with no time left. |
Used in
Members of other types that take, return or hold a TimedStatModifier: