feat(game-engine): port city changes and NPC troop leaders
This commit is contained in:
@@ -59,6 +59,8 @@ import {
|
||||
createInvaderEndingHandler,
|
||||
createRaiseInvaderHandler,
|
||||
} from './monthlyInvaderAction.js';
|
||||
import { createChangeCityHandler } from './monthlyChangeCityAction.js';
|
||||
import { createProvideNpcTroopLeaderHandler } from './monthlyProvideNpcTroopLeaderAction.js';
|
||||
import { buildCommandEnv } from './reservedTurnCommands.js';
|
||||
import { DatabaseTurnDaemonLease, TurnDaemonLeaseUnavailableError } from '../lifecycle/databaseTurnDaemonLease.js';
|
||||
|
||||
@@ -183,7 +185,8 @@ const createTurnDaemonRuntimeWithLease = async (
|
||||
hasEventAction('RegNeutralNPC') ||
|
||||
hasEventAction('RaiseNPCNation') ||
|
||||
hasEventAction('RaiseInvader') ||
|
||||
hasEventAction('AutoDeleteInvader');
|
||||
hasEventAction('AutoDeleteInvader') ||
|
||||
hasEventAction('ProvideNPCTroopLeader');
|
||||
const reservedTurnStoreHandle =
|
||||
options.generalTurnHandler && !eventRequiresReservedTurns
|
||||
? null
|
||||
@@ -299,6 +302,14 @@ const createTurnDaemonRuntimeWithLease = async (
|
||||
reservedTurns: reservedTurnStoreHandle.store,
|
||||
})
|
||||
);
|
||||
eventActions.set(
|
||||
'ProvideNPCTroopLeader',
|
||||
createProvideNpcTroopLeaderHandler({
|
||||
getWorld: () => worldRef,
|
||||
reservedTurns: reservedTurnStoreHandle.store,
|
||||
env: monthlyCommandEnv,
|
||||
})
|
||||
);
|
||||
eventActions.set(
|
||||
'UpdateNationLevel',
|
||||
createUpdateNationLevelHandler({
|
||||
@@ -315,6 +326,12 @@ const createTurnDaemonRuntimeWithLease = async (
|
||||
getWorld: () => worldRef,
|
||||
})
|
||||
);
|
||||
eventActions.set(
|
||||
'ChangeCity',
|
||||
createChangeCityHandler({
|
||||
getWorld: () => worldRef,
|
||||
})
|
||||
);
|
||||
eventActions.set('ProcessIncome', async (_args, environment) => {
|
||||
await incomeHandler.onMonthChanged?.({
|
||||
previousYear: environment.month === 1 ? environment.year - 1 : environment.year,
|
||||
|
||||
Reference in New Issue
Block a user