fix(interior): clear self-referential parentStructure during provisioning
This commit is contained in:
parent
54cbf19fdf
commit
151a31efab
1 changed files with 14 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue