diff --git a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs index 80b9f73d..eeaf99cc 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs @@ -467,7 +467,7 @@ public class HideoutController( } // Handle areas that have resources that can be placed in/taken out of slots from the area - if (_areasWithResources.Contains(hideoutArea.Type ?? HideoutAreas.NotSet)) + if (_areasWithResources.Contains(hideoutArea.Type)) { var response = RemoveResourceFromArea(sessionID, pmcData, request, output, hideoutArea); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs index 0bd020aa..28349b61 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs @@ -606,7 +606,8 @@ public class HideoutHelper( throw new HideoutHelperException(message); } - foreach (var area in pmcData.Hideout.Areas ?? []) + var areas = GetAreasWithResourceUse(pmcData.Hideout.Areas ?? []); + foreach (var area in areas) { switch (area.Type) { @@ -628,13 +629,24 @@ public class HideoutHelper( default: if (logger.IsLogEnabled(LogLevel.Debug)) { - logger.Debug($"Unhandled area type {area.Type} when trying to update areas with resources"); + logger.Debug($"Unhandled area type: {area.Type} when trying to update areas with resources"); } break; } } } + /// + /// Get Hideout areas that consume resources + /// + /// Areas to filter + /// Collection of hideout areas + protected IEnumerable GetAreasWithResourceUse(List hideoutAreas) + { + HashSet resourceUseAreas = [HideoutAreas.Generator, HideoutAreas.WaterCollector, HideoutAreas.AirFilteringUnit]; + return hideoutAreas.Where(area => resourceUseAreas.Contains(area.Type)); + } + /// /// Decrease fuel from generator slots based on amount of time since last time this occurred /// diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs index 1b71f474..7575b520 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs @@ -926,7 +926,7 @@ public record BotHideoutArea public Dictionary? ExtensionData { get; set; } [JsonPropertyName("type")] - public HideoutAreas? Type { get; set; } + public HideoutAreas Type { get; set; } [JsonPropertyName("level")] public int? Level { get; set; }