forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
9d7e0e2f9e
commit
35dfdaed61
94 files changed
+17034
-418
No files matched your search
@@ -46,6 +46,8 @@ export interface InputActions {
|
||||
confirmGroundTarget: () => void;
|
||||
cancelGroundTarget: () => void;
|
||||
gameplayActionsBlocked: () => boolean;
|
||||
/** Editors may disable combat actions while retaining movement and camera controls. */
|
||||
movementBlocked?: () => boolean;
|
||||
setCameraLookActive: (active: boolean) => void;
|
||||
setInputMode: (mode: "keyboard" | "gamepad") => void;
|
||||
setActionLayer: (layer: ActionBindingLayer) => void;
|
||||
@@ -243,6 +245,7 @@ export function installInput(nextActions: InputActions): () => void {
|
||||
actions = nextActions;
|
||||
const keyboardModifiers = new Set<string>();
|
||||
const suspended = () => isCapturingInput() || nextActions.inputSuspended?.();
|
||||
const movementBlocked = () => nextActions.movementBlocked?.() ?? nextActions.gameplayActionsBlocked();
|
||||
const publishActionLayer = () => {
|
||||
const held = getControllerHeldTokens();
|
||||
const layerHeld = (layer: string) => Object.entries(bindingsFor("controller")).some(([id, key]) => {
|
||||
@@ -265,6 +268,7 @@ export function installInput(nextActions: InputActions): () => void {
|
||||
};
|
||||
const candidates = (device: InputDevice) => INPUT_ACTIONS.filter((entry) => {
|
||||
if (entry.context === "global" || entry.context === "menu" || entry.context === "ability-editor") return false;
|
||||
if (entry.continuous || entry.id === "jump") return !movementBlocked();
|
||||
if (entry.context === "ground") return nextActions.groundTargetActive() && !nextActions.gameplayActionsBlocked();
|
||||
if (entry.id.startsWith("bar:") && (!nextActions.desktopActionBarsActive?.() || Number(entry.id.split(":")[1]) >= 5)) return false;
|
||||
if (device === "pc" && entry.id.startsWith("ability:") && nextActions.desktopActionBarsActive?.()) return false;
|
||||
@@ -303,11 +307,11 @@ export function installInput(nextActions: InputActions): () => void {
|
||||
const key = inputKeyForEvent(event);
|
||||
if (!key) return;
|
||||
const bindings = bindingsFor("pc");
|
||||
if (nextActions.gameplayActionsBlocked() && INPUT_ACTIONS.some((entry) => entry.context === "menu" && bindings[entry.id] === key)) return;
|
||||
if (movementBlocked() && INPUT_ACTIONS.some((entry) => entry.context === "menu" && bindings[entry.id] === key)) return;
|
||||
const matches = candidates("pc").filter((entry) => bindings[entry.id] === key)
|
||||
.sort((a, b) => Number(b.context === "ground") - Number(a.context === "ground"));
|
||||
// Preserve ordinary movement while a modifier is held (e.g. Shift + W).
|
||||
const continuous = !nextActions.gameplayActionsBlocked() && INPUT_ACTIONS.some((entry) => entry.continuous && (bindings[entry.id] === event.code || bindings[entry.id] === key));
|
||||
const continuous = !movementBlocked() && INPUT_ACTIONS.some((entry) => entry.continuous && (bindings[entry.id] === event.code || bindings[entry.id] === key));
|
||||
if (continuous) { keys.add(event.code); keys.add(key); event.preventDefault(); nextActions.setInputMode("keyboard"); }
|
||||
if (!matches.length) return;
|
||||
const entry = matches[0];
|
||||
@@ -389,7 +393,7 @@ export function consumeMouseLook(): readonly [number, number] {
|
||||
}
|
||||
|
||||
export function readInputSnapshot(): InputSnapshot {
|
||||
if (isCapturingInput() || actions?.inputSuspended?.() || actions?.gameplayActionsBlocked()) {
|
||||
if (isCapturingInput() || actions?.inputSuspended?.() || (actions?.movementBlocked?.() ?? actions?.gameplayActionsBlocked())) {
|
||||
keys.clear();
|
||||
return { moveX: 0, moveForward: 0, lookX: 0, lookY: 0, gamepadActive: false };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user