def tx_spawn

bendvy-ecs-core@0.1.0.4 · commands.bend:67

import bendvy-ecs-core@0.1.0.4/commands.bend as Commands
import Base
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/transaction.bend as T

67# IDs stay reserved on failure, matching the historical allocator policy.
68# Reserve an entity handle now and stage activation/population for the barrier.
69# Reserved is not yet live: ordinary component reads cannot observe it. The Type
70# payload moves into the command; reservation refusal does not return that payload.
71# Failure drops staged work and clears pending authority but does not rewind the
72# allocator's reserved-ID progress. See examples/captured-query/schema.bend.
73def tx_spawn(~S: Data,~C: Type,~R: Type,~E: Data,~P: Type,~populate: W.World<S,C,R,E> -> W.Handle<S> -> P -> W.World<S,C,R,E>,tx: T.Tx<W.World<S,C,R,E>,E>,payload: P) -> T.Tx<W.World<S,C,R,E>,E> & W.Reservation<S>:
74  match tx:
75    case T.Tx{world,undo,commands,events,trace}: spawn_join(~S,~C,~R,~E,~P,~populate,W.reserve_id(~S,~C,~R,~E,world),undo,commands,events,trace,payload)

Uses (7)

Used by (4)