reserveCost
reserveCost<
Cost>(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
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.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Cost extends Readonly<Partial<Record<ResourceKey, number>>> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
entity |
Entity |
reservation |
ReservationKey |
cost? |
KeyedCost<Cost> |
Returns
Section titled “Returns”void