From 2d644095e342cfb5727765210bafce7c339252c0 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 --- 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 97172f8de8..2ce07758c9 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -98,7 +98,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 f218455c0b..b3cb51ae35 100644 --- a/Content.Shared/Hands/Components/HandsComponent.cs +++ b/Content.Shared/Hands/Components/HandsComponent.cs @@ -80,6 +80,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 a68bf755d4..e1c3d8ef0d 100644 --- a/Content.Shared/Strip/SharedStrippableSystem.cs +++ b/Content.Shared/Strip/SharedStrippableSystem.cs @@ -118,6 +118,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; @@ -349,6 +352,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; @@ -449,6 +455,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 54bd58af78..c65db8fe19 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -85,6 +85,7 @@ - type: Hands showInHands: false disableExplosionRecursion: true + canBeStripped: false - type: ComplexInteraction - type: IntrinsicRadioReceiver - type: IntrinsicRadioTransmitter