Feat: Add player start settings and clear target input binding tests

This commit is contained in:
2026-04-27 16:00:56 +02:00
parent 7b56e540bf
commit d5ba85b55f
3 changed files with 40 additions and 31 deletions

View File

@@ -788,35 +788,4 @@ for (const group of groupedFields) {
lines.push(""); lines.push("");
} }
process.stdout.write(`${lines.join("\n").trimEnd()}\n`);
const entries: FieldEntry[] = [];
collectFields(getRootType(root), root.path, entries, {
condition: null,
skipProperties: new Set(root.skipProperties ?? [])
});
return {
title: root.title,
fields: uniqueEntries(entries).map(formatEntry)
};
});
const totalFieldCount = groupedFields.reduce(
(sum, group) => sum + group.fields.length,
0
);
const lines = [
"Authorable field inventory",
"Source: current canonical TypeScript authoring schemas",
"Excludes: ids, version, kind discriminators, textures, and generated imported-asset metadata/storage fields.",
`Total: ${totalFieldCount} field paths across ${groupedFields.length} groups.`,
""
];
for (const group of groupedFields) {
lines.push(`${group.title} (${group.fields.length})`);
lines.push(...wrapFieldList(group.fields));
lines.push("");
}
process.stdout.write(`${lines.join("\n").trimEnd()}\n`); process.stdout.write(`${lines.join("\n").trimEnd()}\n`);

View File

@@ -18,12 +18,14 @@ import {
DEFAULT_PLAYER_START_CAPSULE_RADIUS, DEFAULT_PLAYER_START_CAPSULE_RADIUS,
DEFAULT_PLAYER_START_CROUCH_SETTINGS, DEFAULT_PLAYER_START_CROUCH_SETTINGS,
DEFAULT_PLAYER_START_EYE_HEIGHT, DEFAULT_PLAYER_START_EYE_HEIGHT,
DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH,
DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES, DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES,
DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
DEFAULT_PLAYER_START_JUMP_SETTINGS, DEFAULT_PLAYER_START_JUMP_SETTINGS,
DEFAULT_PLAYER_START_MOVE_SPEED, DEFAULT_PLAYER_START_MOVE_SPEED,
DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES, DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES,
DEFAULT_PLAYER_START_SPRINT_SETTINGS, DEFAULT_PLAYER_START_SPRINT_SETTINGS,
DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET,
DEFAULT_SPOT_LIGHT_ANGLE_DEGREES, DEFAULT_SPOT_LIGHT_ANGLE_DEGREES,
DEFAULT_SPOT_LIGHT_COLOR_HEX, DEFAULT_SPOT_LIGHT_COLOR_HEX,
DEFAULT_SPOT_LIGHT_DISTANCE, DEFAULT_SPOT_LIGHT_DISTANCE,
@@ -53,6 +55,10 @@ describe("entity registry defaults", () => {
navigationMode: "firstPerson", navigationMode: "firstPerson",
interactionReachMeters: DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, interactionReachMeters: DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
interactionAngleDegrees: DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES, interactionAngleDegrees: DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES,
allowLookInputTargetSwitch:
DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH,
targetButtonCyclesActiveTarget:
DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET,
movementTemplate: { movementTemplate: {
kind: "default", kind: "default",
moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED, moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED,
@@ -78,6 +84,7 @@ describe("entity registry defaults", () => {
sprint: "ShiftLeft", sprint: "ShiftLeft",
crouch: "ControlLeft", crouch: "ControlLeft",
interact: "MouseLeft", interact: "MouseLeft",
clearTarget: "Escape",
pauseTime: "KeyP" pauseTime: "KeyP"
}, },
gamepad: { gamepad: {
@@ -89,6 +96,7 @@ describe("entity registry defaults", () => {
sprint: "leftStickPress", sprint: "leftStickPress",
crouch: "buttonEast", crouch: "buttonEast",
interact: "buttonWest", interact: "buttonWest",
clearTarget: "buttonNorth",
pauseTime: "buttonMenu", pauseTime: "buttonMenu",
cameraLook: "rightStick" cameraLook: "rightStick"
} }

View File

@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import { createPlayerStartInputBindings } from "../../src/entities/entity-instances"; import { createPlayerStartInputBindings } from "../../src/entities/entity-instances";
import { import {
resolvePlayerStartClearTargetInput,
resolvePlayerStartInteractInput, resolvePlayerStartInteractInput,
resolvePlayerStartPauseInput resolvePlayerStartPauseInput
} from "../../src/runtime-three/player-input-bindings"; } from "../../src/runtime-three/player-input-bindings";
@@ -85,3 +86,34 @@ describe("player-input-bindings interact input", () => {
).toBe(1); ).toBe(1);
}); });
}); });
describe("player-input-bindings clear-target input", () => {
it("resolves authored keyboard clear-target bindings", () => {
const bindings = createPlayerStartInputBindings({
keyboard: {
clearTarget: "KeyQ"
}
});
expect(
resolvePlayerStartClearTargetInput(new Set(["Escape"]), bindings, [])
).toBe(0);
expect(
resolvePlayerStartClearTargetInput(new Set(["KeyQ"]), bindings, [])
).toBe(1);
});
it("resolves the authored gamepad clear-target binding from the standard north button", () => {
const bindings = createPlayerStartInputBindings({
gamepad: {
clearTarget: "buttonNorth"
}
});
expect(
resolvePlayerStartClearTargetInput(new Set<string>(), bindings, [
createMockGamepad([3])
])
).toBe(1);
});
});