diff --git a/scripts/list-authorable-fields.ts b/scripts/list-authorable-fields.ts index 2b13317f..13c40937 100644 --- a/scripts/list-authorable-fields.ts +++ b/scripts/list-authorable-fields.ts @@ -788,35 +788,4 @@ for (const group of groupedFields) { 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`); diff --git a/tests/unit/entity-instances.test.ts b/tests/unit/entity-instances.test.ts index 81ee52f6..eb7eea2b 100644 --- a/tests/unit/entity-instances.test.ts +++ b/tests/unit/entity-instances.test.ts @@ -18,12 +18,14 @@ import { DEFAULT_PLAYER_START_CAPSULE_RADIUS, DEFAULT_PLAYER_START_CROUCH_SETTINGS, DEFAULT_PLAYER_START_EYE_HEIGHT, + DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH, DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES, DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, DEFAULT_PLAYER_START_JUMP_SETTINGS, DEFAULT_PLAYER_START_MOVE_SPEED, DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES, DEFAULT_PLAYER_START_SPRINT_SETTINGS, + DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET, DEFAULT_SPOT_LIGHT_ANGLE_DEGREES, DEFAULT_SPOT_LIGHT_COLOR_HEX, DEFAULT_SPOT_LIGHT_DISTANCE, @@ -53,6 +55,10 @@ describe("entity registry defaults", () => { navigationMode: "firstPerson", interactionReachMeters: DEFAULT_PLAYER_START_INTERACTION_REACH_METERS, 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: { kind: "default", moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED, @@ -78,6 +84,7 @@ describe("entity registry defaults", () => { sprint: "ShiftLeft", crouch: "ControlLeft", interact: "MouseLeft", + clearTarget: "Escape", pauseTime: "KeyP" }, gamepad: { @@ -89,6 +96,7 @@ describe("entity registry defaults", () => { sprint: "leftStickPress", crouch: "buttonEast", interact: "buttonWest", + clearTarget: "buttonNorth", pauseTime: "buttonMenu", cameraLook: "rightStick" } diff --git a/tests/unit/player-input-bindings.test.ts b/tests/unit/player-input-bindings.test.ts index e6b035c8..cd058afc 100644 --- a/tests/unit/player-input-bindings.test.ts +++ b/tests/unit/player-input-bindings.test.ts @@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest"; import { createPlayerStartInputBindings } from "../../src/entities/entity-instances"; import { + resolvePlayerStartClearTargetInput, resolvePlayerStartInteractInput, resolvePlayerStartPauseInput } from "../../src/runtime-three/player-input-bindings"; @@ -85,3 +86,34 @@ describe("player-input-bindings interact input", () => { ).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(), bindings, [ + createMockGamepad([3]) + ]) + ).toBe(1); + }); +});