2026-03-31 03:00:38 +02:00
|
|
|
import type { Vec3 } from "../core/vector";
|
2026-03-31 05:49:57 +02:00
|
|
|
import { createPlayerStartEntity } from "../entities/entity-instances";
|
2026-03-31 03:00:38 +02:00
|
|
|
|
|
|
|
|
import type { EditorCommand } from "./command";
|
2026-03-31 05:49:57 +02:00
|
|
|
import { createUpsertEntityCommand } from "./upsert-entity-command";
|
2026-03-31 03:00:38 +02:00
|
|
|
|
|
|
|
|
interface SetPlayerStartCommandOptions {
|
|
|
|
|
entityId?: string;
|
|
|
|
|
position: Vec3;
|
|
|
|
|
yawDegrees: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createSetPlayerStartCommand(options: SetPlayerStartCommandOptions): EditorCommand {
|
2026-03-31 05:49:57 +02:00
|
|
|
return createUpsertEntityCommand({
|
|
|
|
|
entity: createPlayerStartEntity({
|
|
|
|
|
id: options.entityId,
|
|
|
|
|
position: options.position,
|
|
|
|
|
yawDegrees: options.yawDegrees
|
|
|
|
|
}),
|
|
|
|
|
label: options.entityId === undefined ? "Place player start" : "Move player start"
|
2026-03-31 03:00:38 +02:00
|
|
|
});
|
|
|
|
|
}
|