feat(control): трекер инициативы в отдельном окне

Очередь NPC/игроков с DnD, курсором на сцене, состояниями и запасом; сброс при смене сцены.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-09-04 10:09:51 +08:00
parent db1168a46c
commit 86d6d157f0
28 changed files with 1783 additions and 4 deletions
@@ -0,0 +1,37 @@
import type { InitiativeConditionId, InitiativeState } from '../../../shared/types/initiative';
import {
initiativeNpcEntryId,
initiativePlayerEntryId,
} from '../../../shared/types/initiative';
export function initiativeHighlightForNpc(
state: InitiativeState | null | undefined,
placementId: string,
): boolean {
if (!state?.enabled || !state.activeId) return false;
return state.activeId === initiativeNpcEntryId(placementId);
}
export function initiativeHighlightForPlayer(
state: InitiativeState | null | undefined,
playerId: string,
): boolean {
if (!state?.enabled || !state.activeId) return false;
return state.activeId === initiativePlayerEntryId(playerId);
}
export function initiativeConditionsForNpc(
state: InitiativeState | null | undefined,
placementId: string,
): InitiativeConditionId[] {
if (!state) return [];
return state.conditions[initiativeNpcEntryId(placementId)] ?? [];
}
export function initiativeConditionsForPlayer(
state: InitiativeState | null | undefined,
playerId: string,
): InitiativeConditionId[] {
if (!state) return [];
return state.conditions[initiativePlayerEntryId(playerId)] ?? [];
}