Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

reserveCost

reserveCost(writer, entity, reservation, cost?): void

Takes cost off what entity may spend and holds it back under reservation, so a second action cannot spend it too, until commitCost spends that hold or refundCost returns it. Each resource’s reserved is the total of every hold. checkCost first. A predicted write, as changeResource: from a predicted system, or with the room’s step. A hold already under reservation is a mechanic that never settled its last one: a development world throws, naming the key, and a deployed one keeps the first hold and holds nothing more.

Parameter Type
writer PredictedStep
entity PredictedEntity
reservation ReservationKey
cost? ResourceCost

void

reserveCost(writer, entity, reservation, cost?): void

Takes cost off what entity may spend and holds it back under reservation, so a second action cannot spend it too, until commitCost spends that hold or refundCost returns it. Each resource’s reserved is the total of every hold. checkCost first. A predicted write, as changeResource: from a predicted system, or with the room’s step. A hold already under reservation is a mechanic that never settled its last one: a development world throws, naming the key, and a deployed one keeps the first hold and holds nothing more.

Parameter Type
writer EntityAuthority
entity Entity
reservation ReservationKey
cost? ResourceCost

void