fix(client): usable GM column and phone HUD (#89)

This commit is contained in:
2026-11-21 23:39:09 +01:00
parent f170b9c91a
commit e2295aa416
23 changed files with 521 additions and 75 deletions
+6 -1
View File
@@ -11,6 +11,7 @@ import { UPDATE_PRIORITY } from 'pixi.js'
import type { Ticker } from 'pixi.js'
import type { RenderModule } from '../stage.ts'
import { viewport } from '../../viewport.ts'
import { adminTokens } from '../../slices/admin.ts'
import { tokensOf } from '../../slices/tokens.ts'
import { formatSnapshot, PerfWindow, perfEnabled } from '../../perf.ts'
@@ -49,7 +50,11 @@ export const renderModule: RenderModule = {
if (now - lastUpdate < UPDATE_EVERY_MS) return
lastUpdate = now
const snapshot = windowStats.snapshot(now)
node.textContent = formatSnapshot(snapshot, tokensOf(store.state).length, viewport.state.camera.zoom)
const visible = tokensOf(store.state).length
// A player only ever receives tokens in sight, so its total is what it knows. The GM sees
// the whole table in the admin slice, which is the meaningful total there.
const total = store.state.session.role === 'gm' ? adminTokens(store.state).length : visible
node.textContent = formatSnapshot(snapshot, visible, total, viewport.state.camera.zoom)
}
app.ticker.add(begin, undefined, UPDATE_PRIORITY.INTERACTION)