Update imports and add cloning functions in set-player-start-command.ts

This commit is contained in:
2026-03-31 03:01:11 +02:00
parent cd5d0b5535
commit 8c21debc44

View File

@@ -1,7 +1,7 @@
import type { EditorSelection } from "../core/selection"; import { cloneEditorSelection, type EditorSelection } from "../core/selection";
import type { Vec3 } from "../core/vector"; import type { Vec3 } from "../core/vector";
import { createOpaqueId } from "../core/ids"; import { createOpaqueId } from "../core/ids";
import { createPlayerStartEntity } from "../entities/entity-instances"; import { cloneEntityInstance, createPlayerStartEntity } from "../entities/entity-instances";
import type { EditorCommand } from "./command"; import type { EditorCommand } from "./command";
@@ -40,11 +40,11 @@ export function createSetPlayerStartCommand(options: SetPlayerStartCommandOption
} }
if (previousSelection === null) { if (previousSelection === null) {
previousSelection = context.getSelection().kind === "none" ? { kind: "none" } : structuredClone(context.getSelection()); previousSelection = cloneEditorSelection(context.getSelection());
} }
if (previousEntity === null && currentEntity !== undefined) { if (previousEntity === null && currentEntity !== undefined) {
previousEntity = currentEntity; previousEntity = cloneEntityInstance(currentEntity);
} }
context.setDocument({ context.setDocument({