Files
the-beacon/reference/npc-logic.js
Alexander Whitestone 88224b5d4d
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Successful in 11s
Smoke Test / smoke (pull_request) Failing after 21s
fix: chore: move dormant prototypes to reference/ directory (closes #197)
2026-04-15 22:31:08 -04:00

30 lines
848 B
JavaScript

/**
* DORMANT PROTOTYPE — moved from game/npc-logic.js
*
* Why dormant: Uses ES module syntax (export default) — incompatible with <script> tag loading
*
* To integrate (future):
* 1. Refactor to remove ES module exports
* 2. Add <script src="reference/npc-logic.js"> to index.html
* 3. Wire into game engine lifecycle
* 4. Add tests
*/
class NPCStateMachine {
constructor(states) {
this.states = states;
this.current = 'idle';
}
update(context) {
const state = this.states[this.current];
for (const transition of state.transitions) {
if (transition.condition(context)) {
this.current = transition.target;
console.log(`NPC transitioned to ${this.current}`);
break;
}
}
}
}
export default NPCStateMachine;