EntityStore

class EntityStore

The read half of the store, which is all World.entities hands out.

The write half — add, update, remove — is the world's alone, because every write has bookkeeping beside it that a caller cannot see: the interpolation history, the landed set, the rails epoch. A door that skips that bookkeeping is exactly as wide as the one that does it, so there is no such door on the type. The writers are spawn, spawnShip, teleport, reframeEntity, setControl, setThrottle, setFlightAssist and killRotation.

simulation/src/entity.ts:161

Members

constructor

constructor() → EntityStore

dynamicIdCounteraccessor

dynamicIdCounter() → number

sizeaccessor

size() → number

add

add(entity: Entity) → Entity
entityEntity
Undocumented

all

all() → IterableIterator<Entity>

clear

clear() → void

get

get(id: EntityId) → Entity | undefined
idEntityId
Undocumented

has

has(id: EntityId) → boolean
idEntityId
Undocumented

nextDynamicIndex

nextDynamicIndex() → number

Allocate the next dynamic entity id. Persisted, so replays agree.

ordered

ordered() → readonly Entity[]

Entities in id order, not insertion order.

Simulation systems iterate this. Insertion order depends on which entity happened to be spawned first, which depends on load order — sorting makes the step deterministic even once entities start interacting.

remove

remove(id: EntityId) → boolean
idEntityId
Undocumented

require

require(id: EntityId) → Entity
idEntityId
Undocumented

restoreDynamicIdCounter

restoreDynamicIdCounter(value: number) → void
valuenumber
Undocumented

update

update(id: EntityId, change: Partial<Entity>) → Entity
idEntityId
Undocumented
changePartial<Entity>
Undocumented