diff --git a/server/src/game/GameLoop.ts b/server/src/game/GameLoop.ts index 6b12ccb..95a322a 100644 --- a/server/src/game/GameLoop.ts +++ b/server/src/game/GameLoop.ts @@ -77,6 +77,7 @@ export class GameLoop { this.narrationService, this.eventMemoryService, (summary) => this.onInventionCreated?.(summary), + () => this.getDayNumber(), ); this.desireGeneratorSystem = createDesireGeneratorSystem(this.llmService, this.eventMemoryService); diff --git a/server/src/systems/inventionSystem.ts b/server/src/systems/inventionSystem.ts index c955d3e..0a3087d 100644 --- a/server/src/systems/inventionSystem.ts +++ b/server/src/systems/inventionSystem.ts @@ -11,7 +11,6 @@ import { parseInventionResponse } from '../industry/inventionParser.js'; import { validateInvention } from '../industry/inventionValidator.js'; import { registerInvention } from '../industry/inventionRegistrar.js'; import { industryConfig } from '../config/industryConfig.js'; -import { ENERGY_DECAY_PER_TICK, DAY_NIGHT_RATIO } from '@dflike/shared'; import { logLlmDebug } from '../llm/llmDebugLog.js'; export interface InventionSystem { @@ -23,6 +22,7 @@ export function createInventionSystem( narrationService: NarrationService, eventMemoryService: EventMemoryService, onInventionCreated?: (summary: InventionSummary) => void, + getDayNumber?: () => number, ): InventionSystem { // Track in-flight requests to avoid duplicates const pendingEntities = new Set(); @@ -145,11 +145,7 @@ export function createInventionSystem( } pendingItemIds.add(validation.itemId!); - // Compute current day - const dayTicks = 100 / ENERGY_DECAY_PER_TICK; - const nightTicks = dayTicks / DAY_NIGHT_RATIO; - const cycleTicks = Math.round(dayTicks + nightTicks); - const day = Math.floor(tick / cycleTicks) + 1; + const day = getDayNumber ? getDayNumber() : 1; console.log(`[Invention] SUCCESS npc=${name} (${entityId}) invented "${parsed.name}" (${validation.itemId}) cat=${parsed.category}`);