From fdedd6f4d0064700bf6923cab2349bf779a1fecb Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 25 Apr 2026 09:51:53 -0400 Subject: [PATCH] Fix model freshness stuck at 0% by calling onModelDeployed on deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit onModelDeployed was defined but never invoked — lastModelReleaseTick stayed at 0 so the freshness guard always returned 0. Now deployModel updates obsolescence state, setting freshness to 1.0 with proper decay. Co-Authored-By: Claude Opus 4.6 --- apps/web/src/store/index.ts | 6 +++++- packages/game-engine/src/index.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/src/store/index.ts b/apps/web/src/store/index.ts index f1c33c9..0e96482 100644 --- a/apps/web/src/store/index.ts +++ b/apps/web/src/store/index.ts @@ -42,7 +42,7 @@ import { } from '@ai-tycoon/shared'; import { emptyDCNetworkSummary, emptyCampusNetworkSummary, emptyClusterNetworkSummary, - BENCHMARKS, TECH_TREE, + BENCHMARKS, TECH_TREE, onModelDeployed, } from '@ai-tycoon/game-engine'; import { INITIAL_RIVALS } from '@ai-tycoon/game-engine'; @@ -1082,6 +1082,10 @@ export const useGameStore = create()( ...pl, modelId, isActive: true, })), }, + market: { + ...s.market, + obsolescence: onModelDeployed(s.market.obsolescence, s.meta.tickCount), + }, })), deployVariant: (familyId, variantId) => set((s) => ({ diff --git a/packages/game-engine/src/index.ts b/packages/game-engine/src/index.ts index f3504c1..35031b4 100644 --- a/packages/game-engine/src/index.ts +++ b/packages/game-engine/src/index.ts @@ -5,6 +5,7 @@ export { getAvailableResearch, getResearchNode } from './systems/researchSystem' export { getResearchBonuses } from './systems/researchBonuses'; export type { ResearchBonuses } from './systems/researchBonuses'; export { emptyDCNetworkSummary, emptyCampusNetworkSummary, emptyClusterNetworkSummary } from './systems/infrastructureSystem'; +export { onModelDeployed } from './systems/market/obsolescenceSystem'; export { canRaiseFunding, getNextFundingRound, computeValuation } from './systems/fundingSystem'; export { TECH_TREE } from './data/techTree'; export { INITIAL_RIVALS } from './data/competitors';