From e2e2e9510eef299103743ecb79eed522f8e47816 Mon Sep 17 00:00:00 2001 From: RedRoryOTheGlen Date: Thu, 2 Jul 2026 10:02:25 +0800 Subject: [PATCH] Added a way for mods to override the player's weapon reach on demand using a getter/setter. --- .../Effects/Special/LycanthropyEffect.cs | 2 +- Assets/Scripts/Game/WeaponManager.cs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Game/MagicAndEffects/Effects/Special/LycanthropyEffect.cs b/Assets/Scripts/Game/MagicAndEffects/Effects/Special/LycanthropyEffect.cs index d47a58dd0b..95ee06e99c 100644 --- a/Assets/Scripts/Game/MagicAndEffects/Effects/Special/LycanthropyEffect.cs +++ b/Assets/Scripts/Game/MagicAndEffects/Effects/Special/LycanthropyEffect.cs @@ -337,7 +337,7 @@ public override bool SetFPSWeapon(FPSWeapon target) target.MetalType = MetalTypes.None; target.DrawWeaponSound = SoundClips.None; target.SwingWeaponSound = SoundClips.SwingHighPitch; - target.Reach = WeaponManager.defaultWeaponReach; + target.Reach = GameManager.Instance.WeaponManager.WeaponReach; return true; } diff --git a/Assets/Scripts/Game/WeaponManager.cs b/Assets/Scripts/Game/WeaponManager.cs index 1849114c42..2bda606956 100644 --- a/Assets/Scripts/Game/WeaponManager.cs +++ b/Assets/Scripts/Game/WeaponManager.cs @@ -34,6 +34,23 @@ public class WeaponManager : MonoBehaviour const float defaultBowReach = 50f; public const float defaultWeaponReach = 2.25f; + float weaponReachOverride = 0; + public float WeaponReach + { + get + { + if (weaponReachOverride > 0) + return weaponReachOverride; + + return defaultWeaponReach; + } + set + { + weaponReachOverride = value; + ScreenWeapon.Reach = WeaponReach; + } + } + // Equip delay times for weapons public static ushort[] EquipDelayTimes = { 500, 700, 1200, 900, 900, 1800, 1600, 1700, 1700, 3000, 3400, 2000, 2200, 2000, 2200, 2000, 4000, 5000 }; @@ -754,7 +771,7 @@ void ApplyWeapon() SetWeapon(ScreenWeapon, currentLeftHandWeapon); } - ScreenWeapon.Reach = defaultWeaponReach; + ScreenWeapon.Reach = WeaponReach; } void SetMelee(FPSWeapon target)