forked from phenom/healer-man
Release Healer Man 0.1.29
This commit is contained in:
1 parent
8c9809d3e0
commit
544c1bee91
120 files changed
+4363
-1036
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { normalizeInputPreferences, type InputPreferences } from "./keybinds";
|
||||
|
||||
// Kept independent of React, account storage and gameplay stores. The profile store
|
||||
// publishes changes here so shell menus, native input and the simulation agree.
|
||||
let preferences = normalizeInputPreferences(null);
|
||||
let capturing = false;
|
||||
const listeners = new Set<() => void>();
|
||||
export function getInputPreferences(): InputPreferences { return preferences; }
|
||||
export function publishInputPreferences(next: InputPreferences): void {
|
||||
if (preferences === next) return;
|
||||
preferences = next;
|
||||
for (const listener of listeners) listener();
|
||||
}
|
||||
export function subscribeInputPreferences(listener: () => void): () => void {
|
||||
listeners.add(listener); return () => { listeners.delete(listener); };
|
||||
}
|
||||
export function isCapturingInput(): boolean { return capturing; }
|
||||
export function setCapturingInput(value: boolean): void { capturing = value; }
|
||||
export function controllerModifierTokens(): Set<string> {
|
||||
return new Set(Object.values(preferences.controller).flatMap((key) => key?.split("&").slice(0, -1) ?? []));
|
||||
}
|
||||
Reference in new issue
Block a user