From 0acb3cb9cc21b90ea007e867f1e8dfdea442ae0d Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 4 Oct 2025 13:22:06 +0100 Subject: [PATCH] Moved shotgun tpls from `FixShotgunDispersions` to config --- .../SPT_Data/configs/core.json | 6 ++++++ .../Models/Spt/Config/CoreConfig.cs | 3 +++ .../Services/PostDbLoadService.cs | 13 +++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json index 975a1316..1c645965 100644 --- a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json +++ b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json @@ -14,6 +14,12 @@ }, "fixes": { "fixShotgunDispersion": true, + "shotgunIdsToFix": [ + "576165642459773c7a400233", + "5a38e6bac4a2826c6e06d79b", + "5a7828548dc32e5a9c28b516", + "674fe9a75e51f1c47c04ec23" + ], "removeModItemsFromProfile": false, "removeInvalidTradersFromProfile": false, "fixProfileBreakingInventoryItemIssues": false diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs index 615129be..6c8ba5c7 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs @@ -180,6 +180,9 @@ public record GameFixes [JsonPropertyName("fixShotgunDispersion")] public bool FixShotgunDispersion { get; set; } + [JsonPropertyName("shotgunIdsToFix")] + public IEnumerable ShotgunIdsToFix { get; set; } + /// /// Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load /// diff --git a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs index 8605fa10..3fa81706 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs @@ -54,7 +54,7 @@ public class PostDbLoadService( if (CoreConfig.Fixes.FixShotgunDispersion) { - FixShotgunDispersions(); + FixShotgunDispersions(CoreConfig.Fixes.ShotgunIdsToFix); } if (LocationConfig.AddOpenZonesToAllMaps) @@ -407,18 +407,11 @@ public class PostDbLoadService( } // BSG have two values for shotgun dispersion, we make sure both have the same value - protected void FixShotgunDispersions() + protected void FixShotgunDispersions(IEnumerable shotgunIds) { var itemDb = databaseService.GetItems(); - var shotguns = new List - { - Weapons.SHOTGUN_12G_SAIGA_12K, - Weapons.SHOTGUN_20G_TOZ_106, - Weapons.SHOTGUN_12G_M870, - Weapons.SHOTGUN_12G_SAIGA_12K_FA, - }; - foreach (var shotgunId in shotguns) + foreach (var shotgunId in shotgunIds) { if (itemDb.TryGetValue(shotgunId, out var shotgun) && shotgun.Properties.ShotgunDispersion.HasValue) {