From 151a31efab70e36e45d3cda9aa7be8365044ee68 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Tue, 20 Oct 2026 20:08:25 -0400 Subject: [PATCH] fix(interior): clear self-referential parentStructure during provisioning --- src/lib/interior/provision.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib/interior/provision.ts b/src/lib/interior/provision.ts index 3691d3dd..a4341087 100644 --- a/src/lib/interior/provision.ts +++ b/src/lib/interior/provision.ts @@ -17,8 +17,22 @@ export async function provisionInterior( payload: Payload, structure: Pick & { type?: number | { id: number } | null; + parentStructure?: number | { id: number } | null; }, ): Promise<{ provisioned: boolean; rooms: number }> { + // Legacy data fix: row #1 (the Superstructure) carried a self-referential + // `parentStructure`, which makes it its own compound child and hides it from + // the map. Clear it before provisioning so interior entry always sees a sane + // hierarchy, and guard against self-parent rows on any structure. + if (relId(structure.parentStructure) === relId(structure.id)) { + await payload.update({ + collection: "game-structures", + id: relId(structure.id)!, + overrideAccess: true, + data: { parentStructure: null }, + }); + } + let snapshot = structure.interior; // Bootstrap the runtime snapshot from the blueprint on first entry. The