Release Healer Man 0.1.21

This commit is contained in:
phenom committed 2026-09-08 10:40:26 -04:00
1 parent 699fc858c9
commit f6f2375145
210 files changed
+976039 -6247

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
import { useEffect, useRef } from "react";
import { useShellStore } from "../app/shellStore";
import {
exportDungeonEncounterCheckpointSnapshots,
subscribeDungeonEncounterSnapshots,
} from "./dungeonEncounterRuntime";
import { DUNGEON_RUN_CHECKPOINT_VERSION } from "./dungeonRunCheckpoint";
import { useGameStore } from "./store";
function checkpointSignature(dungeonId: string): string {
const game = useGameStore.getState();
const encounters = exportDungeonEncounterCheckpointSnapshots(dungeonId, 0);
return JSON.stringify({
dungeonId,
difficultyId: game.activeDifficultyId,
spawn: game.activeSpawn,
encounters,
});
}
/** Persists only reset-projected state when encounter progress reaches a new stable revision. */
export function DungeonRunCheckpointBridge() {
const phase = useShellStore((state) => state.phase);
const activeCharacterId = useShellStore((state) => state.activeCharacter?.id ?? null);
const lastSignature = useRef("");
useEffect(() => {
if (phase !== "game" || !activeCharacterId) return undefined;
const save = () => {
const game = useGameStore.getState();
if (game.gameMode !== "dungeon" || game.gmTestMode) return;
const signature = checkpointSignature(game.activeDungeonId);
if (signature === lastSignature.current) return;
lastSignature.current = signature;
const encounters = exportDungeonEncounterCheckpointSnapshots(game.activeDungeonId, 0);
useShellStore.getState().saveActiveDungeonRunCheckpoint({
version: DUNGEON_RUN_CHECKPOINT_VERSION,
dungeonId: game.activeDungeonId,
difficultyId: game.activeDifficultyId,
checkpointId: encounters.find((entry) => entry.checkpointId)?.checkpointId ?? "entrance",
spawn: game.activeSpawn,
encounters,
savedAt: Date.now(),
});
};
save();
return subscribeDungeonEncounterSnapshots(save);
}, [activeCharacterId, phase]);
return null;
}