From c7155630a3127006fb1b708a63cffe0b2237128b Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 20 Dec 2025 15:59:52 +0000 Subject: [PATCH] Moved logic to better location --- .../Services/LocationLifecycleService.cs | 14 +++++++++- .../Services/SeasonalEventService.cs | 26 ------------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs index 78d50340..0ece0f80 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs @@ -58,6 +58,7 @@ public class LocationLifecycleService( protected readonly PmcConfig PMCConfig = configServer.GetConfig(); protected readonly BotConfig BotConfig = configServer.GetConfig(); protected readonly LostOnDeathConfig LostOnDeathConfig = configServer.GetConfig(); + protected readonly SeasonalEventConfig SeasonalEventConfig = configServer.GetConfig(); protected const string Pmc = "pmc"; protected const string Savage = "savage"; @@ -118,7 +119,18 @@ public class LocationLifecycleService( // Handle Runddans / Khorovod event if (transitionType == TransitionType.EVENT && isRundansActive) { - foreach (var transits in location.Transits ?? []) + // TODO - wire up this first part to EnableKhorvodEvent in Seasonal config + move isRundansActive check to below block + if (location.Transits != null) + { + // Get whitelist for maps transits, event should have 1 only + var matchingTransitWhitelist = SeasonalEventConfig.KhorvodEventTransitWhitelist?.GetValueOrDefault(location.Id, null); + if (matchingTransitWhitelist != null) + { + location.Transits = location.Transits.Where(transit => matchingTransitWhitelist.Contains(transit.Id.Value)).ToList(); + } + } + + foreach (var transits in location.Transits) { transits.ActivateAfterSeconds = 300; transits.Events = true; diff --git a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs index 469e6ee9..3656a68a 100644 --- a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs @@ -519,35 +519,9 @@ public class SeasonalEventService( EnableRunnansEvent(databaseService.GetGlobals()); } - if (eventType.Settings?.EnableKhorvodEvent ?? false) - { - AdjustTransitsToKhorvodEvent(); - } - ChangeBtrToTarColaSkin(); } - protected void AdjustTransitsToKhorvodEvent() - { - var locations = databaseService.GetLocations().GetDictionary(); - - foreach (var (locationName, locationBase) in locations) - { - if (LocationConfig.NonMaps.Contains(locationName)) - { - continue; - } - - var matchingTransitWhitelist = SeasonalEventConfig.KhorvodEventTransitWhitelist.GetValueOrDefault(locationBase.Base.Id, null); - if (matchingTransitWhitelist is null) - { - continue; - } - - locationBase.Base.Transits = locationBase.Base.Transits.Where(t => matchingTransitWhitelist.Contains(t.Id.Value)).ToList(); - } - } - protected void EnableRunnansEvent(Globals globals) { globals.Configuration.RunddansSettings.Active = true;