From f0d17e328c4f2c5d154bcfa6e151df929e073983 Mon Sep 17 00:00:00 2001 From: Level10Cybermancer <71363161+Level10Cybermancer@users.noreply.github.com> Date: Sat, 30 Jul 2022 23:02:27 -0700 Subject: [PATCH] Thieving gloves now actually hide stripping messages (#9933) * changed the description of thieving gloves * fixed the strip/place popups not being hidden * moved the ev.Stealth check * Revert "changed the description of thieving gloves" This reverts commit e0d242ddb8902873fbcd095a58e49641588414f5. * Refactor/format Co-authored-by: wrexbe --- Content.Server/Strip/StrippableSystem.cs | 29 +++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 8b6dfca3cd..3b6f6b6f9c 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -293,7 +293,11 @@ namespace Content.Server.Strip return; } - var doAfterArgs = new DoAfterEventArgs(user, slotDef.StripTime, CancellationToken.None, component.Owner) + var ev = new BeforeStripEvent(slotDef.StripTime); + RaiseLocalEvent(user, ev); + var finalStripTime = ev.Time + ev.Additive; + + var doAfterArgs = new DoAfterEventArgs(user, finalStripTime, CancellationToken.None, component.Owner) { ExtraCheck = Check, BreakOnStun = true, @@ -303,13 +307,11 @@ namespace Content.Server.Strip NeedHand = true, }; - if (Check()) + if (!ev.Stealth && Check() && userHands.ActiveHandEntity != null) { - if (userHands.ActiveHandEntity != null) - { - _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", Identity.Entity(user, EntityManager)), ("item", userHands.ActiveHandEntity)), component.Owner, - Filter.Entities(component.Owner), PopupType.Large); - } + var message = Loc.GetString("strippable-component-alert-owner-insert", + ("user", Identity.Entity(user, EntityManager)), ("item", userHands.ActiveHandEntity)); + _popupSystem.PopupEntity(message, component.Owner, Filter.Entities(component.Owner), PopupType.Large); } var result = await _doAfterSystem.WaitDoAfter(doAfterArgs); @@ -430,16 +432,17 @@ namespace Content.Server.Strip BreakOnUserMove = true, }; - if (Check()) + if (!ev.Stealth && Check()) { - if (slotDef.StripHidden && !ev.Stealth) + if (slotDef.StripHidden) + { _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-hidden", ("slot", slot)), component.Owner, Filter.Entities(component.Owner), PopupType.Large); - else + } + else if (_inventorySystem.TryGetSlotEntity(component.Owner, slot, out var slotItem)) { - if (_inventorySystem.TryGetSlotEntity(component.Owner, slot, out var slotItem)) - _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", slotItem)), component.Owner, - Filter.Entities(component.Owner), PopupType.Large); + _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", slotItem)), component.Owner, + Filter.Entities(component.Owner), PopupType.Large); } }