dao::effects
Temporary effects: list them on a creature, stop them wearing off, age them at once.
Declared in dao/Effects.h.
Classes
| Class | |
|---|---|
| Standing | One effect on an object, as listed by On. |
Functions
Advance()
void Advance(float seconds)
Ages every temporary effect by an extra amount of time, once, on its owner’s next update.
This works while held. An effect that runs out ends on that update. Effects applied after the call, and effects on objects with their own clock (OwnClock), are not aged by it.
| Parameter | |
|---|---|
seconds |
the time to add, in game seconds |
AdvanceObject()
void AdvanceObject(ObjectId owner, float seconds)
Ages the effects on one object by an extra amount of time, whether or not the object is on its own clock.
| Parameter | |
|---|---|
owner |
the object the effects are on, not the one that applied them |
seconds |
the time to add, in game seconds; fractions of a millisecond carry over |
Held()
bool Held()
Returns whether the effects’ clock is stopped.
Hold()
void Hold(bool held)
Stops the time of every temporary effect, or lets it run again.
While held, effects neither wear off nor end. Permanent and instant effects are not affected.
| Parameter | |
|---|---|
held |
true to stop it; false to let it run and return every object to the shared clock |
On()
std::vector<Standing> On(ObjectId object)
Returns the effects on an object, with each one’s duration and time left.
Call it on the game thread (dao/Frame.h), since it calls the GetEffects script command.
Returns a copy, so changing it changes nothing in the game; empty if the object has no effects or does not exist
OnAgeing()
void OnAgeing(std::function<std::int32_t(const CGameEffect &effect, std::int32_t ms)> ageing)
Adds a callback that decides how much each temporary effect ages.
It runs on the game thread for every temporary effect on every update, so keep it quick.
| Parameter | |
|---|---|
ageing |
called with the effect and the milliseconds it would age by once Hold and Advance are taken into account; returns the milliseconds to age it by instead |
OwnClock()
void OwnClock(ObjectId owner, bool own=true)
Puts an object’s effects on a clock of their own, or back on the shared one.
| Parameter | |
|---|---|
owner |
the object the effects are on, not the one that applied them |
own |
true for its own clock, which Advance leaves out; false for the shared one |