Add pauseTime action and bindings for player input
This commit is contained in:
@@ -108,9 +108,13 @@ export const PLAYER_START_LOCOMOTION_ACTIONS = [
|
|||||||
] as const;
|
] as const;
|
||||||
export type PlayerStartLocomotionAction =
|
export type PlayerStartLocomotionAction =
|
||||||
(typeof PLAYER_START_LOCOMOTION_ACTIONS)[number];
|
(typeof PLAYER_START_LOCOMOTION_ACTIONS)[number];
|
||||||
|
export const PLAYER_START_SYSTEM_ACTIONS = ["pauseTime"] as const;
|
||||||
|
export type PlayerStartSystemAction =
|
||||||
|
(typeof PLAYER_START_SYSTEM_ACTIONS)[number];
|
||||||
export type PlayerStartInputAction =
|
export type PlayerStartInputAction =
|
||||||
| PlayerStartMovementAction
|
| PlayerStartMovementAction
|
||||||
| PlayerStartLocomotionAction;
|
| PlayerStartLocomotionAction
|
||||||
|
| PlayerStartSystemAction;
|
||||||
export type PlayerStartKeyboardBindingCode = string;
|
export type PlayerStartKeyboardBindingCode = string;
|
||||||
export const PLAYER_START_GAMEPAD_BINDINGS = [
|
export const PLAYER_START_GAMEPAD_BINDINGS = [
|
||||||
"leftStickUp",
|
"leftStickUp",
|
||||||
@@ -129,6 +133,7 @@ export const PLAYER_START_GAMEPAD_ACTION_BINDINGS = [
|
|||||||
"buttonEast",
|
"buttonEast",
|
||||||
"buttonWest",
|
"buttonWest",
|
||||||
"buttonNorth",
|
"buttonNorth",
|
||||||
|
"buttonMenu",
|
||||||
"leftShoulder",
|
"leftShoulder",
|
||||||
"rightShoulder",
|
"rightShoulder",
|
||||||
"leftTrigger",
|
"leftTrigger",
|
||||||
@@ -152,6 +157,7 @@ export interface PlayerStartKeyboardBindings {
|
|||||||
jump: PlayerStartKeyboardBindingCode;
|
jump: PlayerStartKeyboardBindingCode;
|
||||||
sprint: PlayerStartKeyboardBindingCode;
|
sprint: PlayerStartKeyboardBindingCode;
|
||||||
crouch: PlayerStartKeyboardBindingCode;
|
crouch: PlayerStartKeyboardBindingCode;
|
||||||
|
pauseTime: PlayerStartKeyboardBindingCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlayerStartGamepadBindings {
|
export interface PlayerStartGamepadBindings {
|
||||||
@@ -162,6 +168,7 @@ export interface PlayerStartGamepadBindings {
|
|||||||
jump: PlayerStartGamepadActionBinding;
|
jump: PlayerStartGamepadActionBinding;
|
||||||
sprint: PlayerStartGamepadActionBinding;
|
sprint: PlayerStartGamepadActionBinding;
|
||||||
crouch: PlayerStartGamepadActionBinding;
|
crouch: PlayerStartGamepadActionBinding;
|
||||||
|
pauseTime: PlayerStartGamepadActionBinding;
|
||||||
cameraLook: PlayerStartGamepadCameraLookBinding;
|
cameraLook: PlayerStartGamepadCameraLookBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +402,8 @@ export const DEFAULT_PLAYER_START_KEYBOARD_BINDINGS: PlayerStartKeyboardBindings
|
|||||||
moveRight: "KeyD",
|
moveRight: "KeyD",
|
||||||
jump: "Space",
|
jump: "Space",
|
||||||
sprint: "ShiftLeft",
|
sprint: "ShiftLeft",
|
||||||
crouch: "ControlLeft"
|
crouch: "ControlLeft",
|
||||||
|
pauseTime: "KeyP"
|
||||||
};
|
};
|
||||||
export const DEFAULT_PLAYER_START_GAMEPAD_BINDINGS: PlayerStartGamepadBindings =
|
export const DEFAULT_PLAYER_START_GAMEPAD_BINDINGS: PlayerStartGamepadBindings =
|
||||||
{
|
{
|
||||||
@@ -406,6 +414,7 @@ export const DEFAULT_PLAYER_START_GAMEPAD_BINDINGS: PlayerStartGamepadBindings =
|
|||||||
jump: "buttonSouth",
|
jump: "buttonSouth",
|
||||||
sprint: "leftStickPress",
|
sprint: "leftStickPress",
|
||||||
crouch: "buttonEast",
|
crouch: "buttonEast",
|
||||||
|
pauseTime: "buttonMenu",
|
||||||
cameraLook: "rightStick"
|
cameraLook: "rightStick"
|
||||||
};
|
};
|
||||||
export const DEFAULT_SCENE_ENTRY_YAW_DEGREES = 0;
|
export const DEFAULT_SCENE_ENTRY_YAW_DEGREES = 0;
|
||||||
@@ -632,7 +641,8 @@ export function clonePlayerStartInputBindings(
|
|||||||
moveRight: bindings.keyboard.moveRight,
|
moveRight: bindings.keyboard.moveRight,
|
||||||
jump: bindings.keyboard.jump,
|
jump: bindings.keyboard.jump,
|
||||||
sprint: bindings.keyboard.sprint,
|
sprint: bindings.keyboard.sprint,
|
||||||
crouch: bindings.keyboard.crouch
|
crouch: bindings.keyboard.crouch,
|
||||||
|
pauseTime: bindings.keyboard.pauseTime
|
||||||
},
|
},
|
||||||
gamepad: {
|
gamepad: {
|
||||||
moveForward: bindings.gamepad.moveForward,
|
moveForward: bindings.gamepad.moveForward,
|
||||||
@@ -642,6 +652,7 @@ export function clonePlayerStartInputBindings(
|
|||||||
jump: bindings.gamepad.jump,
|
jump: bindings.gamepad.jump,
|
||||||
sprint: bindings.gamepad.sprint,
|
sprint: bindings.gamepad.sprint,
|
||||||
crouch: bindings.gamepad.crouch,
|
crouch: bindings.gamepad.crouch,
|
||||||
|
pauseTime: bindings.gamepad.pauseTime,
|
||||||
cameraLook: bindings.gamepad.cameraLook
|
cameraLook: bindings.gamepad.cameraLook
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -670,7 +681,10 @@ export function createPlayerStartInputBindings(
|
|||||||
DEFAULT_PLAYER_START_KEYBOARD_BINDINGS.sprint,
|
DEFAULT_PLAYER_START_KEYBOARD_BINDINGS.sprint,
|
||||||
crouch:
|
crouch:
|
||||||
overrides.keyboard?.crouch ??
|
overrides.keyboard?.crouch ??
|
||||||
DEFAULT_PLAYER_START_KEYBOARD_BINDINGS.crouch
|
DEFAULT_PLAYER_START_KEYBOARD_BINDINGS.crouch,
|
||||||
|
pauseTime:
|
||||||
|
overrides.keyboard?.pauseTime ??
|
||||||
|
DEFAULT_PLAYER_START_KEYBOARD_BINDINGS.pauseTime
|
||||||
};
|
};
|
||||||
const gamepad: PlayerStartGamepadBindings = {
|
const gamepad: PlayerStartGamepadBindings = {
|
||||||
moveForward:
|
moveForward:
|
||||||
@@ -693,6 +707,9 @@ export function createPlayerStartInputBindings(
|
|||||||
crouch:
|
crouch:
|
||||||
overrides.gamepad?.crouch ??
|
overrides.gamepad?.crouch ??
|
||||||
DEFAULT_PLAYER_START_GAMEPAD_BINDINGS.crouch,
|
DEFAULT_PLAYER_START_GAMEPAD_BINDINGS.crouch,
|
||||||
|
pauseTime:
|
||||||
|
overrides.gamepad?.pauseTime ??
|
||||||
|
DEFAULT_PLAYER_START_GAMEPAD_BINDINGS.pauseTime,
|
||||||
cameraLook:
|
cameraLook:
|
||||||
overrides.gamepad?.cameraLook ??
|
overrides.gamepad?.cameraLook ??
|
||||||
DEFAULT_PLAYER_START_GAMEPAD_BINDINGS.cameraLook
|
DEFAULT_PLAYER_START_GAMEPAD_BINDINGS.cameraLook
|
||||||
@@ -726,6 +743,10 @@ export function createPlayerStartInputBindings(
|
|||||||
throw new Error("Player Start crouch keyboard binding must be supported.");
|
throw new Error("Player Start crouch keyboard binding must be supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isPlayerStartKeyboardBindingCode(keyboard.pauseTime)) {
|
||||||
|
throw new Error("Player Start pause keyboard binding must be supported.");
|
||||||
|
}
|
||||||
|
|
||||||
if (!isPlayerStartGamepadBinding(gamepad.moveForward)) {
|
if (!isPlayerStartGamepadBinding(gamepad.moveForward)) {
|
||||||
throw new Error("Player Start move-forward gamepad binding must be supported.");
|
throw new Error("Player Start move-forward gamepad binding must be supported.");
|
||||||
}
|
}
|
||||||
@@ -754,6 +775,10 @@ export function createPlayerStartInputBindings(
|
|||||||
throw new Error("Player Start crouch gamepad binding must be supported.");
|
throw new Error("Player Start crouch gamepad binding must be supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isPlayerStartGamepadActionBinding(gamepad.pauseTime)) {
|
||||||
|
throw new Error("Player Start pause gamepad binding must be supported.");
|
||||||
|
}
|
||||||
|
|
||||||
if (!isPlayerStartGamepadCameraLookBinding(gamepad.cameraLook)) {
|
if (!isPlayerStartGamepadCameraLookBinding(gamepad.cameraLook)) {
|
||||||
throw new Error("Player Start camera-look gamepad binding must be supported.");
|
throw new Error("Player Start camera-look gamepad binding must be supported.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user