Data contracts¶
These are the public data structures the framework passes around: the plan (and its piece arrays), the piece library entry, the planned-construction record, and the event payloads. They are the serialized format used by presets and MP sync, so they are part of the supported API - you may read them directly, and (where noted) write them.
All shapes are declared as EmmyLua @class types in Contracts.lua; this page is the
prose version. See also Concepts → The plan.
Stability policy¶
stable - read (and, where noted, write) directly. Breaking changes ship with a
schemaVersionbump and a migration (seeMigrations.lua/Presets).internal - implementation detail; may change without notice.
The plan’s
schemaVersionis the version anchor (current = 4). Always runPlans.normalizePlan(plan)before relying on the array fields - it stamps the version and guarantees every array (walls,cells,roofs,rects,stairs, …) exists.
Plan (RCSFPlan) - stable¶
The world-space build plan. Produced by the placement UI or a headless caller, consumed by
Builder / Presets / PlannedConstructions.
Field |
Type |
Notes |
|---|---|---|
|
|
current = 4; the migration anchor. |
|
|
owning structure def id. |
|
|
structure variant (e.g. |
|
|
legacy alias read as a variant fallback. |
|
|
one or more footprints (canonical since multi-rect). |
|
|
the structural piece arrays (cells = floors/rugs). |
|
|
entity pieces. |
|
deprecated |
legacy single-rect; |
Piece shapes¶
RCSFRect{ x, y, z, w, h, kind? }-x,yis the min (NW) corner;w,h >= 1;kinddefaults to"room".RCSFWall{ x, y, z, north, wallType?, slotKind?, spriteName?, wallpaperSpriteName? }.north=truefor the north edge,falsefor the west edge.slotKind("wall"/"door"/"window") changes engine flags;spriteNamewins overwallTyperesolution.RCSFCell{ x, y, z, spriteName?, isRug? }-isRug = trueplaces on top of an existing floor instead of replacing it. Anilsprite is a silent skip in the builder.RCSFRoof{ x, y, z, north, spriteName?, slope?, roofKind? }.RCSFStair{ x, y, z, north, bottomSprite?, middleSprite?, topSprite?, pillarSprite? }.- Entity pieces
Furniture
{ x, y, z, facing?, defId?, spriteName?, footprint?, anchor? }· Appliance = furniture +utilities? = { power?, water? }· Decorative{ x, y, z, facing?, defId?, spriteName?, anchor? }· Vegetation{ x, y, z, defId?, spriteName? }.
Tip
Use the Plans.copy* helpers (copyPlan, copyWall, copyRoof, …) to deep-copy rather
than reaching in by hand - they are the authoritative field lists.
Piece (RCSFPiece) - stable¶
A catalog entry registered via PieceLibrary.register / Registry.registerPieces.
Canonical type: RCStructureFrameworkPiece (declared in PieceLibrary.lua).
Field |
Type |
Notes |
|---|---|---|
|
|
unique; defaulted to |
|
|
closed-state sprite. |
|
|
placement slot: |
|
|
e.g. |
|
|
scoping. |
|
|
raw text / |
|
|
arbitrary filter tags. |
|
|
hook for |
|
|
facing-specific sprites. |
|
|
door/window open state. |
|
|
per-piece engine footprint. |
|
|
catalog UI bucket. |
|
|
consumed by |
|
|
heterogeneous recipe via |
|
|
gating; |
|
|
catalog tile icon override. |
Planned-construction record (RCSFPlannedRecord) - stable¶
A server-authoritative “planned but unbuilt” structure (the ghost-preview feature). Stored
in global ModData under PlannedConstructions.MOD_DATA_KEY.
Field |
Type |
Notes |
|---|---|---|
|
|
generated record id. |
|
|
|
|
|
caller-supplied, opaque. |
|
|
world-space plan copy. |
|
|
|
|
|
per-piece build state. |
RCSFPlannedPiece{ kind, x, y, z, north?, spriteName, slotKind?, defId?, materialRecipe?, builtAt?, builtBy? }.builtAt = nilmeans unbuilt; otherwise a build timestamp (ms). Records are mutated server-side only; clients read a synced cache.
Builder outcomes - stable¶
Builder.buildFromPlan(andRCSF.build) returnsRCSFBuildOutcome:{ success, placed, failed, reason?, roomCreated? }.Builder.disassembleFromPlanreturnsRCSFDisassembleOutcome:{ success, removed, reason? }.
On failure the builder rolls back everything placed this call (placed will be empty).
Room assignment + event payloads - stable¶
RCSFRoomAssignment(returned byRCSF.Rooms.assign, carried by the room events):{ id, name, rects }.OnRCSFStructureBuiltpayload:{ structureId, plan, character, placed }.OnRCSFStructureDisassembledpayload:{ structureId, character, removed }.
See Events for the full event reference.