feat: add StateManager.dump() and expose window.__sm for debugging
- StateManager.dump(): console.table formatted dump of variables, flags, history - window.__sm: exposes engine.stateManager in dev mode for console inspection
This commit is contained in:
@@ -91,4 +91,12 @@ export class StateManager {
|
||||
this.flags = new Set(data.flags)
|
||||
this.history = [...data.history]
|
||||
}
|
||||
|
||||
dump() {
|
||||
console.group('StateManager')
|
||||
console.table(this.variables)
|
||||
console.log('flags:', [...this.flags])
|
||||
console.table(this.history)
|
||||
console.groupEnd()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
|
||||
const saveSystem = new SaveSystem()
|
||||
const store = useGameStore()
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
;(window as any).__sm = engine.stateManager
|
||||
}
|
||||
|
||||
async function loadGame(dataUrl: string) {
|
||||
const resp = await fetch(dataUrl)
|
||||
const data: GameData = await resp.json()
|
||||
|
||||
Reference in New Issue
Block a user