1
0
Fork 0

fix(interior): clear self-referential parentStructure during provisioning

This commit is contained in:
Jason Fraley 2026-10-20 20:08:25 -04:00
parent 54cbf19fdf
commit 151a31efab

View file

@ -17,8 +17,22 @@ export async function provisionInterior(
payload: Payload,
structure: Pick<GameStructure, "id" | "interior"> & {
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