changeResource
Call Signature
Section titled “Call Signature”changeResource<
Handle>(writer,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 writes the step’s tick into the resource’s spentTick, which
pauses its regeneration for its regenDelaySeconds. An entity without
the resource is left alone. A predicted write, as startCooldown’s:
call it from a predicted system, or, for a rule on the room alone, with
the room’s step, and the player’s page makes it on the tick the player
pressed. 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 handle widened past its
type that holds health throws.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Handle extends ResourceHandle |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
PredictedStep |
entity |
PredictedEntity |
change |
ChangeOfResource<Handle> |
Returns
Section titled “Returns”void
Call Signature
Section titled “Call Signature”changeResource<
Handle>(writer,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 writes the step’s tick into the resource’s spentTick, which
pauses its regeneration for its regenDelaySeconds. An entity without
the resource is left alone. A predicted write, as startCooldown’s:
call it from a predicted system, or, for a rule on the room alone, with
the room’s step, and the player’s page makes it on the tick the player
pressed. 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 handle widened past its
type that holds health throws.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Handle extends ResourceHandle |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
EntityAuthority |
entity |
Entity |
change |
ChangeOfResource<Handle> |
Returns
Section titled “Returns”void