refactor: tick pipeline pattern — read all → compute all → write all (issue #103)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m19s

- New tick-pipeline.ts: TickContext/TickWrites types + buildTickContext/applyTickWrites orchestrator
- gameStore.ts tick(): refactored to 3-phase pipeline (read snapshot → compute updates → batch writes)
- combat-actions.ts: accept signedPacts as parameter instead of usePrestigeStore.getState() in combat loop
- combatStore.ts/combat-state.types.ts: updated processCombatTick signature for signedPacts passthrough
- craftingStore.ts: removed tempState = { ...get(), rawMana } as any anti-pattern
- preparation-actions.ts: accept rawMana as explicit parameter instead of GameState bag
This commit is contained in:
2026-05-20 19:48:40 +02:00
parent ce084a61a3
commit ee893e8973
10 changed files with 317 additions and 109 deletions
+7 -5
View File
@@ -206,15 +206,17 @@ export const useCraftingStore = create<CraftingStore>()(
// Preparation actions
startPreparing: (equipmentInstanceId) => {
// Get rawMana from manaStore
const rawMana = useManaStore.getState().rawMana;
// Temporary state to pass to preparation action
const tempState = { ...get(), rawMana } as any;
return PreparationActions.startPreparing(
const result = PreparationActions.startPreparing(
equipmentInstanceId,
() => tempState,
rawMana,
get,
set
);
if (result) {
useCombatStore.setState({ currentAction: 'prepare' });
}
return result;
},
cancelPreparation: () => {