From 498109a833047d933a5f72edf87961542c516f58 Mon Sep 17 00:00:00 2001 From: WarMechanic <69510347+WarMechanic@users.noreply.github.com> Date: Fri, 26 Apr 2024 22:31:50 +1000 Subject: [PATCH] fix wieldable guns not being able to cycle inhand (#27307) * Add UnwieldOverride variable that overrides unwielding inhand to enable other interactions * Give LMGs UnwieldOverride * logically inverted UnwieldOverride to UnwieldOnUse * fixed typo --- Content.Shared/Wieldable/Components/WieldableComponent.cs | 7 +++++++ Content.Shared/Wieldable/WieldableSystem.cs | 2 +- .../Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Wieldable/Components/WieldableComponent.cs b/Content.Shared/Wieldable/Components/WieldableComponent.cs index 4a50b93072..5dc6abbbbe 100644 --- a/Content.Shared/Wieldable/Components/WieldableComponent.cs +++ b/Content.Shared/Wieldable/Components/WieldableComponent.cs @@ -26,6 +26,13 @@ public sealed partial class WieldableComponent : Component [AutoNetworkedField, DataField("wielded")] public bool Wielded = false; + /// + /// Whether using the item inhand while wielding causes the item to unwield. + /// Unwielding can conflict with other inhand actions. + /// + [DataField] + public bool UnwieldOnUse = true; + [DataField("wieldedInhandPrefix")] public string? WieldedInhandPrefix = "wielded"; diff --git a/Content.Shared/Wieldable/WieldableSystem.cs b/Content.Shared/Wieldable/WieldableSystem.cs index 6bd406c1ca..ba3f787a4b 100644 --- a/Content.Shared/Wieldable/WieldableSystem.cs +++ b/Content.Shared/Wieldable/WieldableSystem.cs @@ -125,7 +125,7 @@ public sealed class WieldableSystem : EntitySystem if (!component.Wielded) args.Handled = TryWield(uid, component, args.User); - else + else if (component.UnwieldOnUse) args.Handled = TryUnwield(uid, component, args.User); } diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml index 49b2eeaada..79f2e7b45f 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml @@ -14,6 +14,7 @@ slots: - Back - type: Wieldable + unwieldOnUse: false - type: GunWieldBonus minAngle: -20 maxAngle: -20 -- 2.52.0