]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixes battery weapons changing firemode on wield (#37085)
authorimatsoup <93290208+imatsoup@users.noreply.github.com>
Thu, 1 May 2025 05:35:13 +0000 (05:35 +0000)
committerGitHub <noreply@github.com>
Thu, 1 May 2025 05:35:13 +0000 (22:35 -0700)
Credit to Happyrobot33 for the implementation

Co-authored-by: Matthew Herber <32679887+happyrobot33@users.noreply.github.com>
Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs
Content.Shared/Wieldable/SharedWieldableSystem.cs

index 0c90ae1637837f519ae51cced6f15a4d708c0f4d..974bfa1783694eaecd3ae55eb2b7a270089da8d6 100644 (file)
@@ -82,6 +82,10 @@ public sealed class BatteryWeaponFireModesSystem : EntitySystem
 
     private void OnUseInHandEvent(EntityUid uid, BatteryWeaponFireModesComponent component, UseInHandEvent args)
     {
+        if(args.Handled)
+            return;
+
+        args.Handled = true;
         TryCycleFireMode(uid, component, args.User);
     }
 
index 2e50c655fcc37d8975e59332f7fdff67fa64aef5..ec476e6db6a3c4419f7f8644ceb4a4a3d986dd9a 100644 (file)
@@ -44,7 +44,7 @@ public abstract class SharedWieldableSystem : EntitySystem
     {
         base.Initialize();
 
-        SubscribeLocalEvent<WieldableComponent, UseInHandEvent>(OnUseInHand, before: [typeof(SharedGunSystem)]);
+        SubscribeLocalEvent<WieldableComponent, UseInHandEvent>(OnUseInHand, before: [typeof(SharedGunSystem), typeof(BatteryWeaponFireModesSystem)]);
         SubscribeLocalEvent<WieldableComponent, ItemUnwieldedEvent>(OnItemUnwielded);
         SubscribeLocalEvent<WieldableComponent, GotUnequippedHandEvent>(OnItemLeaveHand);
         SubscribeLocalEvent<WieldableComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);