From 0be056186947c5a248efbd8efdf251aafb9baef3 Mon Sep 17 00:00:00 2001 From: keronshb <54602815+keronshb@users.noreply.github.com> Date: Wed, 22 Jun 2022 19:58:53 -0400 Subject: [PATCH] Notifies you if you're being stripped or dressed. (#9029) --- Content.Server/Strip/StrippableSystem.cs | 37 +++++++++++++++++++ .../en-US/strip/strippable-component.ftl | 3 ++ 2 files changed, 40 insertions(+) diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 5c51f9ba44..147e282f44 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Popups; using Content.Shared.Strip.Components; using Content.Shared.Verbs; using Robust.Server.GameObjects; +using Robust.Shared.Player; namespace Content.Server.Strip { @@ -21,6 +22,7 @@ namespace Content.Server.Strip [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; + [Dependency] private readonly SharedPopupSystem _popupSystem = default!; // TODO: ECS popups. Not all of these have ECS equivalents yet. @@ -300,6 +302,14 @@ namespace Content.Server.Strip NeedHand = true, }; + if (Check()) + { + if (userHands.ActiveHandEntity != null) + { + _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", user), ("item", userHands.ActiveHandEntity)), component.Owner, Filter.Entities(component.Owner)); + } + } + var result = await _doAfterSystem.WaitDoAfter(doAfterArgs); if (result != DoAfterStatus.Finished) return; @@ -354,6 +364,14 @@ namespace Content.Server.Strip NeedHand = true, }; + if (Check() && userHands.Hands.TryGetValue(handName, out var handSlot)) + { + if (handSlot.HeldEntity != null) + { + _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", user), ("item", handSlot.HeldEntity)), component.Owner, Filter.Entities(component.Owner)); + } + } + var result = await _doAfterSystem.WaitDoAfter(doAfterArgs); if (result != DoAfterStatus.Finished) return; @@ -405,6 +423,17 @@ namespace Content.Server.Strip BreakOnUserMove = true, }; + if (Check()) + { + if (slotDef.StripHidden) + _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-hidden", ("slot", slot)), component.Owner, Filter.Entities(component.Owner)); + else + { + if (_inventorySystem.TryGetSlotEntity(component.Owner, slot, out var slotItem)) + _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", user), ("item", slotItem)), component.Owner, Filter.Entities(component.Owner)); + } + } + var result = await _doAfterSystem.WaitDoAfter(doAfterArgs); if (result != DoAfterStatus.Finished) return; @@ -456,6 +485,14 @@ namespace Content.Server.Strip BreakOnUserMove = true, }; + if (Check() && hands.Hands.TryGetValue(handName, out var handSlot)) + { + if (handSlot.HeldEntity != null) + { + _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", user), ("item", handSlot.HeldEntity)), component.Owner, Filter.Entities(component.Owner)); + } + } + var result = await _doAfterSystem.WaitDoAfter(doAfterArgs); if (result != DoAfterStatus.Finished) return; diff --git a/Resources/Locale/en-US/strip/strippable-component.ftl b/Resources/Locale/en-US/strip/strippable-component.ftl index d2a61cac6e..15d9a85578 100644 --- a/Resources/Locale/en-US/strip/strippable-component.ftl +++ b/Resources/Locale/en-US/strip/strippable-component.ftl @@ -6,6 +6,9 @@ strippable-component-cannot-put-message = {$owner} cannot put that there! strippable-component-item-slot-free-message = {$owner} has nothing there! strippable-component-cannot-unequip-message = {$owner} cannot unequip that! strippable-component-cannot-drop-message = {$owner} cannot drop that! +strippable-component-alert-owner = {$user} is removing your {$item}! +strippable-component-alert-owner-hidden = You feel someone fumbling in your {$slot}! +strippable-component-alert-owner-insert = {$user} is putting {$item} on you! # StripVerb strip-verb-get-data-text = Strip