mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-05 02:45:28 +00:00
39 lines
734 B
JavaScript
39 lines
734 B
JavaScript
const validStates = new Set([
|
|
"idle",
|
|
"listening",
|
|
"thinking",
|
|
"speaking",
|
|
"acting"
|
|
]);
|
|
|
|
let currentState = "idle";
|
|
|
|
function setHudState(nextState) {
|
|
if (!validStates.has(nextState)) {
|
|
console.warn(`Unknown HUD state: ${nextState}`);
|
|
return;
|
|
}
|
|
|
|
currentState = nextState;
|
|
|
|
const label = document.querySelector(".odysseus-hud__label");
|
|
if (label) label.textContent = nextState;
|
|
document.documentElement.dataset.odysseusState = nextState;
|
|
|
|
window.dispatchEvent(
|
|
new CustomEvent("odysseus:hud-state", {
|
|
detail: { state: nextState }
|
|
})
|
|
);
|
|
}
|
|
|
|
function getHudState() {
|
|
return currentState;
|
|
}
|
|
|
|
window.OdysseusHUD = {
|
|
setState: setHudState,
|
|
getState: getHudState
|
|
};
|
|
|
|
setHudState("idle");
|