Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 07158574-5…

entity_records

Walks a live entity hierarchy into the flat record array the engine's entity templates use — `{ name, original_id, parent_id, position, rotation, scale, hidden, components }` per entity, root first, parents before children.

by◐lumi·posted 1mo ago
What it does

entity_records

Walks a live entity hierarchy into the flat record array the engine's entity templates use — { name, original_id, parent_id, position, rotation, scale, hidden, components } per entity, root first, parents before children.

bundle composes its entity_template through this module; scene builds compose their baked output through it. One record shape, one implementation.

compose(rootId) walks one hierarchy. composeMany(rootIds) walks several, which is what a build needs — a builder may leave more than one unparented root. Temporary descendants are pruned; an explicitly-named temporary root is kept.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

module EntityRecords Walks a live entity hierarchy into the flat record array the engine's entity templates use. Shared by `bundle` (its `entity_template`) and by scene builds (their baked output), so both speak one record shape.

entityRefFields(data: any, snapshot: any) → void

The fields of ONE component instance that hold an entity reference, named by the component registry rather than read off the value. A reference is stored as the referenced entity's id, and that id is the referenced entity's record `original_id`, so naming the fields is what lets whoever rebuilds the records resolve each reference onto the entity it lands on. The DECLARED kind is what decides: a string field holding something shaped like an id is left alone. Only a field the snapshot carries a reference in is named, so a record states the references it holds and nothing more.

argtypedescription
dataany
snapshotany

componentIsCodeAttached(rid: string, componentType: string) → boolean

Whether another component's lifecycle attached this component instance, rather than an author putting it there. A composed asset brings its own machinery with it — a humanoid avatar attaches a character controller to the body it expands into — and that machinery comes back on its own wherever the composition does. A record that named it would put a second one beside the one the expansion just produced, and a rebuild that removed every component its records leave unnamed would tear the expansion off the entity it belongs to. Both sides of a rebuild ask this. Reached through the `_G` singleton the origin module publishes, which is the same answer the scene serializer takes for the same question; a load order that has not published it yet reads every component as authored.

argtypedescription
ridstringRuntime entity id carrying the instance.
componentTypestringComponent type name as the entity reports it.

examples

if EntityRecords.componentIsCodeAttached(id, "Humanoid") then continue end

captureRecord(rid: string, parentOriginalId: string?) → any

Capture ONE entity into a template record. Reads LIVE component public state (serialized component snapshots), not init data, so the record matches what is on screen. Each component INSTANCE gets its own entry, carrying `instance_name` when the instance has one, so a type the entity carries several of comes back as the same several. The record also carries the entity's own `active` flag, every attribute it holds, and its lifecycle mode and replication scope when either is other than the default. The entity's runtime id IS its record `original_id`, so cross-entity component references — which already point at runtime ids — round-trip and get remapped on the next instantiate. Each component entry names the fields holding such a reference in `entity_fields`, taken from the component's declared field kinds, so a rebuild resolves exactly those.

argtypedescription
ridstringRuntime entity id to capture.
parentOriginalIdstring?Parent's original_id, or nil for a root record.

examples

local rec = EntityRecords.captureRecord(id, nil)

orderSiblings(ids: { string }, rank: { [string]: number }?) → void

argtypedescription
ids{ string }
rank{ [string]: number }?

walk(rid: string, parentOriginalId: string?) → void

argtypedescription
ridstring
parentOriginalIdstring?

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

5items
▣
module · born here
❒asset
# component_snapshot Serialized snapshots of script-component public data. A component's `public` table is a live proxy — its fields live behind `__iter` / `__index` metamethods, so copying or JSON-encoding the proxy directly yields an empty table. This module materializes the plain, serializable form. It is the script-component parallel to `ecs.snapshot` (native components). ```lua local componentSnapshot = require("modules.component_snapshot") -- one component: live proxy -> plain table local data = componentSnapshot.snapshot(entity(id).component.get("Camera")) -- whole entity: { [type] = data }, named/multi instances nested as -- { [type] = { [instanceName or "__default"] = data } } local all = componentSnapshot.snapshotEntity(entity(id)) ``` `componentSnapshot.plainCopy(value)` materializes ONE live value the same way — a table behind a proxy is walked into a plain table, every other value passes through — for callers reading a single field rather than a whole component. Serialized form: entity refs become id strings, asset refs become `{ __ref, name, type }` envelopes, vectors and colors their plain-table forms; framework functions are omitted. `snapshot` returns nil for a proxy with no serializable fields. Persistence (scene serializer, bundle capture, prototype spawn) and inspection tooling (`debug.inspect`) read component data through this module. Live gameplay reads and writes stay on the proxy itself via `entity(id).component.get` / `getAll`.
▲ 0↑ born

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.