changeResource
changeResource<
Key>(entity,change):void
Adds amount of a resource to entity, up to its maximum less what
its reservations hold back, or spends it where amount is negative,
down to 0: a hit that builds rage, a sprint that spends stamina. A
spend pauses its regeneration for its regenDelaySeconds. An entity
without the resource is left alone. Call it from a system, where the
simulation has the say. Health is an outcome, which a page in a room
cannot change: dealDamage and dealHealing change it, with the room’s
authority. healthResource is a type error here, and a key widened past
its type that holds health throws.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Key extends ResourceKey |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
entity |
Entity |
change |
ChangeOfResource<Key> |
Returns
Section titled “Returns”void