Moved shotgun tpls from FixShotgunDispersions to config

This commit is contained in:
Chomp
2025-10-04 13:22:06 +01:00
parent af61720a4d
commit 0acb3cb9cc
3 changed files with 12 additions and 10 deletions
@@ -14,6 +14,12 @@
}, },
"fixes": { "fixes": {
"fixShotgunDispersion": true, "fixShotgunDispersion": true,
"shotgunIdsToFix": [
"576165642459773c7a400233",
"5a38e6bac4a2826c6e06d79b",
"5a7828548dc32e5a9c28b516",
"674fe9a75e51f1c47c04ec23"
],
"removeModItemsFromProfile": false, "removeModItemsFromProfile": false,
"removeInvalidTradersFromProfile": false, "removeInvalidTradersFromProfile": false,
"fixProfileBreakingInventoryItemIssues": false "fixProfileBreakingInventoryItemIssues": false
@@ -180,6 +180,9 @@ public record GameFixes
[JsonPropertyName("fixShotgunDispersion")] [JsonPropertyName("fixShotgunDispersion")]
public bool FixShotgunDispersion { get; set; } public bool FixShotgunDispersion { get; set; }
[JsonPropertyName("shotgunIdsToFix")]
public IEnumerable<MongoId> ShotgunIdsToFix { get; set; }
/// <summary> /// <summary>
/// Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load /// Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load
/// </summary> /// </summary>
@@ -54,7 +54,7 @@ public class PostDbLoadService(
if (CoreConfig.Fixes.FixShotgunDispersion) if (CoreConfig.Fixes.FixShotgunDispersion)
{ {
FixShotgunDispersions(); FixShotgunDispersions(CoreConfig.Fixes.ShotgunIdsToFix);
} }
if (LocationConfig.AddOpenZonesToAllMaps) 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 // BSG have two values for shotgun dispersion, we make sure both have the same value
protected void FixShotgunDispersions() protected void FixShotgunDispersions(IEnumerable<MongoId> shotgunIds)
{ {
var itemDb = databaseService.GetItems(); var itemDb = databaseService.GetItems();
var shotguns = new List<MongoId> foreach (var shotgunId in shotgunIds)
{
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)
{ {
if (itemDb.TryGetValue(shotgunId, out var shotgun) && shotgun.Properties.ShotgunDispersion.HasValue) if (itemDb.TryGetValue(shotgunId, out var shotgun) && shotgun.Properties.ShotgunDispersion.HasValue)
{ {