Update tests for player movement validation and serialization, add migration for version 33 Player Start jump settings

This commit is contained in:
2026-04-12 02:06:33 +02:00
parent 8aba9a02d7
commit 9459cbd191
3 changed files with 168 additions and 2 deletions

View File

@@ -465,7 +465,9 @@ describe("scene document JSON", () => {
bufferMs: 120,
coyoteTimeMs: 90,
variableHeight: true,
maxHoldMs: 220
maxHoldMs: 220,
moveWhileJumping: false,
moveWhileFalling: false
},
sprint: {
speedMultiplier: 1.8
@@ -939,6 +941,40 @@ describe("scene document JSON", () => {
);
});
it("migrates version 33 Player Start jump settings to include default air movement flags", () => {
const playerStart = createPlayerStartEntity({
id: "entity-player-start-legacy-air-move-flags",
movementTemplate: {
kind: "responsive"
}
});
const {
moveWhileJumping: _moveWhileJumping,
moveWhileFalling: _moveWhileFalling,
...legacyJump
} = playerStart.movementTemplate.jump;
const legacyDocument = {
...createEmptySceneDocument({
name: "Legacy Player Air Movement Scene"
}),
version: 33,
entities: {
[playerStart.id]: {
...playerStart,
movementTemplate: {
...playerStart.movementTemplate,
jump: legacyJump
}
}
}
};
const migratedDocument = migrateSceneDocument(legacyDocument);
expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION);
expect(migratedDocument.entities[playerStart.id]).toEqual(playerStart);
});
it("round-trips authored third-person Player Start navigation", () => {
const playerStart = createPlayerStartEntity({
id: "entity-player-start-third-person",