Release Healer Man 0.1.9

This commit is contained in:
phenom committed 2026-08-30 14:16:56 -04:00
1 parent c245a199b6
commit d060296ade
74 files changed
+5901 -334

No files matched your search

+21
View File
@@ -30,6 +30,26 @@ export type CombatEventInput = Omit<StructuredCombatEvent, "id">;
export const MAX_COMBAT_EVENT_HISTORY = 200;
export type CombatEventListener = (event: StructuredCombatEvent) => void;
const combatEventListeners = new Set<CombatEventListener>();
/** Lossless event stream for recorders; the in-store history remains a small HUD ring. */
export function subscribeCombatEvents(listener: CombatEventListener): () => void {
combatEventListeners.add(listener);
return () => combatEventListeners.delete(listener);
}
function publishCombatEvent(event: StructuredCombatEvent): void {
for (const listener of combatEventListeners) {
try {
listener(event);
} catch {
// A metrics consumer must never interrupt authoritative combat.
}
}
}
export function appendCombatEvent(
events: readonly StructuredCombatEvent[],
event: CombatEventInput,
@@ -45,5 +65,6 @@ export function appendCombatEvent(
overheal: Math.max(0, Number.isFinite(event.overheal) ? event.overheal : 0),
absorbed: Math.max(0, Number.isFinite(event.absorbed) ? event.absorbed : 0),
});
publishCombatEvent(next);
return Object.freeze([...events, next].slice(-Math.max(1, Math.trunc(maximum))));
}