From 643cf9a26839453e444f0a3ae0320a9d5297d8d4 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 9 Aug 2023 12:04:31 +0100 Subject: [PATCH] Regenerate item cache on game start Fixes 'item missing from cache' errors seen when using multiple mods that add items to the game --- project/src/controllers/GameController.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index eb9229bb..f57a5e45 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -28,6 +28,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { GiftService } from "../services/GiftService"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocalisationService } from "../services/LocalisationService"; import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileFixerService } from "../services/ProfileFixerService"; @@ -64,6 +65,7 @@ export class GameController @inject("CustomLocationWaveService") protected customLocationWaveService: CustomLocationWaveService, @inject("OpenZoneService") protected openZoneService: OpenZoneService, @inject("SeasonalEventService") protected seasonalEventService: SeasonalEventService, + @inject("ItemBaseClassService") protected itemBaseClassService: ItemBaseClassService, @inject("GiftService") protected giftService: GiftService, @inject("ApplicationContext") protected applicationContext: ApplicationContext, @inject("ConfigServer") protected configServer: ConfigServer @@ -84,6 +86,10 @@ export class GameController // Store start time in app context this.applicationContext.addValue(ContextVariableType.CLIENT_START_TIMESTAMP, startTimeStampMS); + // Regenerate basecache now mods are loaded and game is starting + // Mods that add items and use the baseclass service generate the cache including their items, the next mod that add items gets left out,causing warnings + this.itemBaseClassService.hydrateItemBaseClassCache(); + if (this.coreConfig.fixes.fixShotgunDispersion) { this.fixShotgunDispersions();