From d1b9cbbfc5358b1145c65d31d929111748aa881c Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 29 Dec 2023 19:09:03 +0000 Subject: [PATCH] Enable snow for christmas/new years --- project/assets/configs/weather.json | 1 + project/src/controllers/WeatherController.ts | 2 +- project/src/models/spt/config/IWeatherConfig.ts | 1 + project/src/services/SeasonalEventService.ts | 10 ++++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/project/assets/configs/weather.json b/project/assets/configs/weather.json index e2988ee5..805f9316 100644 --- a/project/assets/configs/weather.json +++ b/project/assets/configs/weather.json @@ -1,5 +1,6 @@ { "acceleration": 7, + "enableWinterEvent": false, "weather": { "clouds": { "values": [-1.5, -1, 0, 0.5, 1, 1.5], diff --git a/project/src/controllers/WeatherController.ts b/project/src/controllers/WeatherController.ts index 36c7e962..d2d6410c 100644 --- a/project/src/controllers/WeatherController.ts +++ b/project/src/controllers/WeatherController.ts @@ -24,7 +24,7 @@ export class WeatherController /** Handle client/weather */ public generate(): IWeatherData { - let result: IWeatherData = { acceleration: 0, time: "", date: "", weather: null, winterEventEnabled: false }; + let result: IWeatherData = { acceleration: 0, time: "", date: "", weather: null, winterEventEnabled: this.weatherConfig.enableWinterEvent }; result = this.weatherGenerator.calculateGameTime(result); result.weather = this.weatherGenerator.generateWeather(); diff --git a/project/src/models/spt/config/IWeatherConfig.ts b/project/src/models/spt/config/IWeatherConfig.ts index 08c738b2..3a5eb703 100644 --- a/project/src/models/spt/config/IWeatherConfig.ts +++ b/project/src/models/spt/config/IWeatherConfig.ts @@ -7,6 +7,7 @@ export interface IWeatherConfig extends IBaseConfig kind: "aki-weather"; acceleration: number; weather: Weather; + enableWinterEvent: boolean; } export interface Weather diff --git a/project/src/services/SeasonalEventService.ts b/project/src/services/SeasonalEventService.ts index ce7cd308..de759ab4 100644 --- a/project/src/services/SeasonalEventService.ts +++ b/project/src/services/SeasonalEventService.ts @@ -10,6 +10,7 @@ import { SeasonalEventType } from "@spt-aki/models/enums/SeasonalEventType"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "@spt-aki/models/spt/config/ISeasonalEventConfig"; +import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig"; import { ILocationData } from "@spt-aki/models/spt/server/ILocations"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; @@ -24,6 +25,7 @@ export class SeasonalEventService protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; protected httpConfig: IHttpConfig; + protected weatherConfig: IWeatherConfig; protected halloweenEventActive = undefined; protected christmasEventActive = undefined; @@ -42,6 +44,7 @@ export class SeasonalEventService this.seasonalEventConfig = this.configServer.getConfig(ConfigTypes.SEASONAL_EVENT); this.questConfig = this.configServer.getConfig(ConfigTypes.QUEST); this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP); + this.weatherConfig = this.configServer.getConfig(ConfigTypes.WEATHER); this.cacheActiveEvents(); } @@ -325,9 +328,11 @@ export class SeasonalEventService this.addLootItemsToGifterDropItemsList(); this.enableDancingTree(); this.giveGift(sessionId, "Christmas2022"); + this.enableSnow(); break; case SeasonalEventType.NEW_YEARS.toLowerCase(): this.giveGift(sessionId, "NewYear2023"); + this.enableSnow(); break; default: // Likely a mod event @@ -550,4 +555,9 @@ export class SeasonalEventService { return this.seasonalEventConfig.eventBotMapping[eventBotRole]; } + + public enableSnow(): void + { + this.weatherConfig.enableWinterEvent = true; + } }