From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:56:03 +0000 (+1100) Subject: Fix toggleable helmets (#22195) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3252a2b8bb911e2d2fd88decedfdc95581fed529;p=space-station-14.git Fix toggleable helmets (#22195) --- diff --git a/Content.Shared/Clothing/EntitySystems/ToggleableClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ToggleableClothingSystem.cs index fa8c1af208..e3110eca35 100644 --- a/Content.Shared/Clothing/EntitySystems/ToggleableClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ToggleableClothingSystem.cs @@ -42,6 +42,7 @@ public sealed class ToggleableClothingSystem : EntitySystem SubscribeLocalEvent(OnInteractHand); SubscribeLocalEvent(OnAttachedUnequip); SubscribeLocalEvent(OnRemoveAttached); + SubscribeLocalEvent(OnAttachedUnequipAttempt); SubscribeLocalEvent>>(GetRelayedVerbs); SubscribeLocalEvent>(OnGetVerbs); @@ -176,6 +177,11 @@ public sealed class ToggleableClothingSystem : EntitySystem QueueDel(component.ClothingUid.Value); } + private void OnAttachedUnequipAttempt(EntityUid uid, AttachedClothingComponent component, BeingUnequippedAttemptEvent args) + { + args.Cancel(); + } + private void OnRemoveAttached(EntityUid uid, AttachedClothingComponent component, ComponentRemove args) { // if the attached component is being removed (maybe entity is being deleted?) we will just remove the @@ -242,7 +248,7 @@ public sealed class ToggleableClothingSystem : EntitySystem var parent = Transform(target).ParentUid; if (component.Container.ContainedEntity == null) - _inventorySystem.TryUnequip(user, parent, component.Slot); + _inventorySystem.TryUnequip(user, parent, component.Slot, force: true); else if (_inventorySystem.TryGetSlotEntity(parent, component.Slot, out var existing)) { _popupSystem.PopupClient(Loc.GetString("toggleable-clothing-remove-first", ("entity", existing)),