From 2f228e1c61cfcdabaae7a68a6e37d33f859567a8 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 3 Oct 2024 02:11:56 +0200 Subject: [PATCH] Fix borg hands showing up in stripping menu (#32606) * Fix borg hands showing up in stripping menu Borgs can't drop their items anyways, and the amount of hands borgs have causes the UI to just bug out. * Add more checks (cherry picked from commit 2d644095e342cfb5727765210bafce7c339252c0) --- Content.Client/Inventory/StrippableBoundUserInterface.cs | 2 +- Content.Shared/Hands/Components/HandsComponent.cs | 6 ++++++ Content.Shared/Strip/SharedStrippableSystem.cs | 9 +++++++++ .../Entities/Mobs/Cyborgs/base_borg_chassis.yml | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs index 6631fd61b8..a2a5dd7f80 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -104,7 +104,7 @@ namespace Content.Client.Inventory } } - if (EntMan.TryGetComponent(Owner, out var handsComp)) + if (EntMan.TryGetComponent(Owner, out var handsComp) && handsComp.CanBeStripped) { // good ol hands shit code. there is a GuiHands comparer that does the same thing... but these are hands // and not gui hands... which are different... diff --git a/Content.Shared/Hands/Components/HandsComponent.cs b/Content.Shared/Hands/Components/HandsComponent.cs index 318f9f512e..3147606a71 100644 --- a/Content.Shared/Hands/Components/HandsComponent.cs +++ b/Content.Shared/Hands/Components/HandsComponent.cs @@ -81,6 +81,12 @@ public sealed partial class HandsComponent : Component [DataField] public DisplacementData? HandDisplacement; + + /// + /// If false, hands cannot be stripped, and they do not show up in the stripping menu. + /// + [DataField] + public bool CanBeStripped = true; } [Serializable, NetSerializable] diff --git a/Content.Shared/Strip/SharedStrippableSystem.cs b/Content.Shared/Strip/SharedStrippableSystem.cs index 123cfdc4fe..bd8f4ce4d4 100644 --- a/Content.Shared/Strip/SharedStrippableSystem.cs +++ b/Content.Shared/Strip/SharedStrippableSystem.cs @@ -120,6 +120,9 @@ public abstract class SharedStrippableSystem : EntitySystem !Resolve(target, ref targetStrippable)) return; + if (!target.Comp.CanBeStripped) + return; + if (!_handsSystem.TryGetHand(target.Owner, handId, out var handSlot)) return; @@ -353,6 +356,9 @@ public abstract class SharedStrippableSystem : EntitySystem !Resolve(target, ref target.Comp)) return false; + if (!target.Comp.CanBeStripped) + return false; + if (user.Comp.ActiveHand == null) return false; @@ -454,6 +460,9 @@ public abstract class SharedStrippableSystem : EntitySystem if (!Resolve(target, ref target.Comp)) return false; + if (!target.Comp.CanBeStripped) + return false; + if (!_handsSystem.TryGetHand(target, handName, out var handSlot, target.Comp)) { _popupSystem.PopupCursor(Loc.GetString("strippable-component-item-slot-free-message", ("owner", Identity.Name(target, EntityManager, user)))); diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index 0e38e5342e..28302a7b60 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -88,6 +88,7 @@ - type: Hands showInHands: false disableExplosionRecursion: true + canBeStripped: false - type: ComplexInteraction - type: IntrinsicRadioReceiver - type: IntrinsicRadioTransmitter