fix(engine): align monthly post tail ordering

This commit is contained in:
2026-07-25 22:33:36 +00:00
parent 86ceaab8a6
commit de006181b7
6 changed files with 392 additions and 17 deletions
+15 -4
View File
@@ -456,8 +456,13 @@ const createTurnDaemonRuntimeWithLease = async (
startYear: snapshot.scenarioMeta?.startYear ?? state.currentYear,
commandEnv: monthlyCommandEnv,
});
let monthlyNationPowerRollCount = snapshot.nations.length;
let monthlyTournamentRollConsumed = false;
const monthlyNationStatsHandler = createMonthlyNationStatsHandler({
getWorld: () => worldRef,
onNationPowerRollCount: (count) => {
monthlyNationPowerRollCount = count;
},
});
const monthlyDiplomacyHandler = createMonthlyDiplomacyHandler({
getWorld: () => worldRef,
@@ -483,12 +488,18 @@ const createTurnDaemonRuntimeWithLease = async (
getWorld: () => worldRef,
getRedisClient: () => redisConnector?.client,
getWorldConfig: () => snapshot.worldConfig ?? null,
getNationPowerRollCount: () => monthlyNationPowerRollCount,
getTournamentRollConsumed: () => monthlyTournamentRollConsumed,
});
const tournamentAutoStartHandler = createTournamentAutoStartHandler({
profileName: options.profileName ?? options.profile,
getWorld: () => worldRef,
getRedisClient: () => redisConnector?.client,
getWorldConfig: () => snapshot.worldConfig ?? null,
getTickSeconds: () => worldRef?.getState().tickSeconds ?? null,
getNationPowerRollCount: () => monthlyNationPowerRollCount,
onTournamentRollConsumed: (consumed) => {
monthlyTournamentRollConsumed = consumed;
},
});
const yearbookHandler = createYearbookHandler({
databaseUrl: options.databaseUrl,
@@ -497,6 +508,7 @@ const createTurnDaemonRuntimeWithLease = async (
});
const calendarHandler = composeCalendarHandlers(
monthlyEventHandler,
hasEventAction('ProcessIncome') ? null : incomeHandler,
yearbookHandler.handler,
monthlyBoundaryPreHandler,
nationTurnMonthlyHandler,
@@ -506,10 +518,9 @@ const createTurnDaemonRuntimeWithLease = async (
monthlyWanderHandler,
monthlyNationCountHandler,
options.calendarHandler ?? unification?.handler,
hasEventAction('ProcessIncome') ? null : incomeHandler,
frontStateHandler,
tournamentAutoStartHandler,
neutralAuctionRegistrar.handler,
tournamentAutoStartHandler
frontStateHandler
);
const worldOptions: InMemoryTurnWorldOptions = {
schedule,