namespace
World
Runtime reflection over the ECS world — read and write component fields by id, spawn and inspect entities, and register components at runtime. The introspection layer a mod uses.
World.get(prop_id, field_id, entity) -> intRead a component field by id.World.set(prop_id, field_id, entity, value) -> voidWrite a component field by id.World.has(entity, prop_id) -> intDoes an entity have a component?World.count() -> intThe number of live entities.World.size() -> intThe serialized size of the world.World.spawn(model_id) -> entitySpawn an entity of a model by id.World.save(buf) -> intSerialize the world into a buffer.World.load(buf, len) -> voidRestore the world from a buffer.World.prop_id(name) -> intLook up a component's id by name.World.field_id(prop_id, name) -> intLook up a field's id by name.World.model_id(name) -> intLook up a model's id by name.World.kind(entity) -> intThe model id of an entity.World.register_prop(name, size) -> intRegister a new component at runtime.World.attach(entity, prop_id) -> voidAttach a component to an entity at runtime.World.detach(entity, prop_id) -> voidDetach a component from an entity at runtime.World.query_next(query_id, cursor) -> intAdvance a reflective query.World.despawn(entity)Despawn an entity by id — runs its @OnDespawn hooks and frees the slot.