From d0b1a153091dfef836aaa9d26a49e032537f2cf2 Mon Sep 17 00:00:00 2001 From: imatsoup <93290208+imatsoup@users.noreply.github.com> Date: Thu, 1 May 2025 05:35:13 +0000 Subject: [PATCH] Fixes battery weapons changing firemode on wield (#37085) Credit to Happyrobot33 for the implementation Co-authored-by: Matthew Herber <32679887+happyrobot33@users.noreply.github.com> --- .../Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs | 4 ++++ Content.Shared/Wieldable/SharedWieldableSystem.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs b/Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs index 0c90ae1637..974bfa1783 100644 --- a/Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs @@ -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); } diff --git a/Content.Shared/Wieldable/SharedWieldableSystem.cs b/Content.Shared/Wieldable/SharedWieldableSystem.cs index 2e50c655fc..ec476e6db6 100644 --- a/Content.Shared/Wieldable/SharedWieldableSystem.cs +++ b/Content.Shared/Wieldable/SharedWieldableSystem.cs @@ -44,7 +44,7 @@ public abstract class SharedWieldableSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnUseInHand, before: [typeof(SharedGunSystem)]); + SubscribeLocalEvent(OnUseInHand, before: [typeof(SharedGunSystem), typeof(BatteryWeaponFireModesSystem)]); SubscribeLocalEvent(OnItemUnwielded); SubscribeLocalEvent(OnItemLeaveHand); SubscribeLocalEvent(OnVirtualItemDeleted);