diff --git a/tests/domain/scene-document-validation.test.ts b/tests/domain/scene-document-validation.test.ts index 6eb5f517..6a7c3738 100644 --- a/tests/domain/scene-document-validation.test.ts +++ b/tests/domain/scene-document-validation.test.ts @@ -578,6 +578,7 @@ describe("validateSceneDocument", () => { interactionAngleDegrees: Number.NaN, allowLookInputTargetSwitch: "yes" as unknown as boolean, targetButtonCyclesActiveTarget: 1 as unknown as boolean, + invertMouseCameraHorizontal: "yes" as unknown as boolean, movementTemplate: { kind: "invalidTemplate", moveSpeed: 0, diff --git a/tests/unit/entity-instances.test.ts b/tests/unit/entity-instances.test.ts index eb7eea2b..473ba298 100644 --- a/tests/unit/entity-instances.test.ts +++ b/tests/unit/entity-instances.test.ts @@ -19,6 +19,7 @@ import { DEFAULT_PLAYER_START_CROUCH_SETTINGS, DEFAULT_PLAYER_START_EYE_HEIGHT, DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH, + DEFAULT_PLAYER_START_INVERT_MOUSE_CAMERA_HORIZONTAL, DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES, DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, DEFAULT_PLAYER_START_JUMP_SETTINGS, @@ -59,6 +60,8 @@ describe("entity registry defaults", () => { DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH, targetButtonCyclesActiveTarget: DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET, + invertMouseCameraHorizontal: + DEFAULT_PLAYER_START_INVERT_MOUSE_CAMERA_HORIZONTAL, movementTemplate: { kind: "default", moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED, diff --git a/tests/unit/player-start-interaction-reach-serialization.test.ts b/tests/unit/player-start-interaction-reach-serialization.test.ts index bcb0b5ba..96da400e 100644 --- a/tests/unit/player-start-interaction-reach-serialization.test.ts +++ b/tests/unit/player-start-interaction-reach-serialization.test.ts @@ -3,11 +3,13 @@ import { describe, expect, it } from "vitest"; import { migrateSceneDocument } from "../../src/document/migrate-scene-document"; import { createEmptySceneDocument, + PLAYER_START_TARGETING_SETTINGS_SCENE_DOCUMENT_VERSION, PLAYER_START_INTERACTION_REACH_SCENE_DOCUMENT_VERSION, PLAYER_START_INTERACT_BINDINGS_SCENE_DOCUMENT_VERSION } from "../../src/document/scene-document"; import { DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH, + DEFAULT_PLAYER_START_INVERT_MOUSE_CAMERA_HORIZONTAL, DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES, DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET, @@ -52,6 +54,7 @@ describe("Player Start interaction sector persistence", () => { interactionAngleDegrees: 42, allowLookInputTargetSwitch: false, targetButtonCyclesActiveTarget: true, + invertMouseCameraHorizontal: true, inputBindings: { keyboard: { clearTarget: "KeyQ" @@ -76,6 +79,7 @@ describe("Player Start interaction sector persistence", () => { interactionAngleDegrees: 42, allowLookInputTargetSwitch: false, targetButtonCyclesActiveTarget: true, + invertMouseCameraHorizontal: true, inputBindings: { keyboard: { clearTarget: "KeyQ" @@ -147,4 +151,29 @@ describe("Player Start interaction sector persistence", () => { } }); }); + + it("migrates version 83 player starts to include the mouse inversion default", () => { + const playerStart = createPlayerStartEntity({ + id: "entity-player-start-mouse-invert-legacy" + }); + const legacyPlayerStart = { + ...playerStart + } as Record; + + delete legacyPlayerStart.invertMouseCameraHorizontal; + + const migrated = migrateSceneDocument({ + ...createEmptySceneDocument({ name: "Legacy Player Mouse Invert Scene" }), + version: PLAYER_START_TARGETING_SETTINGS_SCENE_DOCUMENT_VERSION, + entities: { + [playerStart.id]: legacyPlayerStart + } + }); + + expect(migrated.entities[playerStart.id]).toMatchObject({ + kind: "playerStart", + invertMouseCameraHorizontal: + DEFAULT_PLAYER_START_INVERT_MOUSE_CAMERA_HORIZONTAL + }); + }); });