Add setting to force mag reload in-place

This commit is contained in:
Tyfon
2024-07-21 14:10:00 -07:00
parent c52435ee37
commit 8046557121
2 changed files with 13 additions and 3 deletions

View File

@@ -112,8 +112,8 @@ public static class ReloadInPlacePatches
[PatchPrefix]
public static bool Prefix(Player.FirearmController __instance, MagazineClass magazine, ItemAddressClass gridItemAddress)
{
// If gridItemAddress isn't null, it already found a place for the current mag, so let it run
if (gridItemAddress != null || !Settings.SwapMags.Value)
// If gridItemAddress isn't null, it already found a place for the current mag, so let it run (unless always swap is enabled)
if (!Settings.SwapMags.Value || (gridItemAddress != null && !Settings.AlwaysSwapMags.Value))
{
return true;
}

View File

@@ -82,6 +82,7 @@ internal class Settings
public static ConfigEntry<bool> ShowMultiSelectDebug { get; set; } // Advanced
public static ConfigEntry<bool> SwapItems { get; set; }
public static ConfigEntry<bool> SwapMags { get; set; }
public static ConfigEntry<bool> AlwaysSwapMags { get; set; }
public static ConfigEntry<bool> SwapImpossibleContainers { get; set; }
public static ConfigEntry<bool> ReorderGrids { get; set; }
public static ConfigEntry<bool> SynchronizeStashScrolling { get; set; }
@@ -406,7 +407,16 @@ internal class Settings
"Reload Magazines In-Place",
true,
new ConfigDescription(
"When reloading a weapon with a magazine, swap locations with the new magazine (if possible)",
"When reloading a weapon with a magazine, swap locations with the new magazine if necessary (and possible)",
null,
new ConfigurationManagerAttributes { })));
configEntries.Add(AlwaysSwapMags = config.Bind(
InventorySection,
"Always Reload Magazines In-Place",
false,
new ConfigDescription(
"Always reload magazines in-place, even if there's space not to. Note that in-place reloads are slower.",
null,
new ConfigurationManagerAttributes { })));