What it does
entities
Entities tab for the System Tools panel — hierarchical list /
filter / select / spawn / delete / focus. Refreshes at 5 Hz when
the tab is active. Selecting an entity flips
state.entityDetails.id, which the system_tools/details floating
screen picks up.
Hierarchy is built from parentId / children fields that the
ECS-side snapshot already emits — see
src/engine/systems/scripting/cache.rs. Expand state lives on
state.entityHierarchy.expanded so chevron toggles survive across
refreshes.
Exports
The module is consumed by system_tools/init.luau as a tab module:
M.label: string—"Entities".M.refresh: number—0.2(5 Hz).M.build(state) -> any— build the Entities widget tree.M.onCallback(callbackId: string, data: any, state) -> boolean— handle selection, tree-toggle, filter, spawn / delete / duplicate / focus events.M.onMount(state)— seedstate.entityDetailsandstate.entityHierarchyslots once at mount time.
Types:
EntitiesState = any— shell-owned state table; carriesentityDetails = { id, open }andentityHierarchy = { expanded }.
Usage
-- Registered by system_tools/init.luau:
local Entities = require("@builtin::modules.engine.editor.system_tools.tabs.entities")
TABS.entities = Entities
Notes
- Cache key
"entities:list"is invalidated on every spawn / delete / duplicate so the tree reflects ECS mutations immediately. - When a search filter is active, every match's ancestors are
pulled back into the filtered set with
expandedflipped totrue— same behaviour as VS Code's tree search. ei-focus-entityis currently a no-op pending a scripting-side "focus camera on entity" API.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.