diff --git a/Content.Server/Strip/StrippableComponent.cs b/Content.Server/Strip/StrippableComponent.cs index 542d0df1cb..0b63c12c9f 100644 --- a/Content.Server/Strip/StrippableComponent.cs +++ b/Content.Server/Strip/StrippableComponent.cs @@ -9,21 +9,12 @@ namespace Content.Server.Strip [Access(typeof(StrippableSystem))] public sealed class StrippableComponent : SharedStrippableComponent { - /// - /// How long it takes to open the strip menu. - /// This should be relatively short so it's not a hassle - /// but so it also doesn't open immediately during melee combat - /// - [ViewVariables] - [DataField("openDelay")] - public float OpenDelay = 1f; - /// /// The strip delay for hands. /// [ViewVariables] [DataField("handDelay")] - public float HandStripDelay = 3f; + public float HandStripDelay = 4f; public override bool Drop(DragDropEvent args) { diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 2e096212ee..21a03e8e6f 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -1,4 +1,3 @@ -using System.ComponentModel; using System.Threading; using Content.Server.Cuffs.Components; using Content.Server.DoAfter; @@ -17,8 +16,8 @@ using Content.Shared.Inventory.Events; using Content.Shared.Popups; using Content.Shared.Strip.Components; using Content.Shared.Verbs; +using Content.Shared.CombatMode; using Robust.Server.GameObjects; -using Robust.Shared.Map; using Robust.Shared.Player; namespace Content.Server.Strip @@ -30,6 +29,7 @@ namespace Content.Server.Strip [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly EnsnareableSystem _ensnaring = default!; + [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; // TODO: ECS popups. Not all of these have ECS equivalents yet. @@ -49,25 +49,7 @@ namespace Content.Server.Strip SubscribeLocalEvent(OnStripHandMessage); SubscribeLocalEvent(OnStripHandcuffMessage); SubscribeLocalEvent(OnStripEnsnareMessage); - - SubscribeLocalEvent(OnOpenStripComplete); - SubscribeLocalEvent(OnOpenStripCancelled); } - - private void OnOpenStripCancelled(EntityUid uid, StrippableComponent component, OpenStrippingCancelledEvent args) - { - component.CancelTokens.Remove(args.User); - } - - private void OnOpenStripComplete(EntityUid uid, StrippableComponent component, OpenStrippingCompleteEvent args) - { - component.CancelTokens.Remove(args.User); - - if (!TryComp(args.User, out var actor)) return; - - uid.GetUIOrNull(StrippingUiKey.Key)?.Open(actor.PlayerSession); - } - private void OnStripHandcuffMessage(EntityUid uid, StrippableComponent component, StrippingHandcuffButtonPressed args) { if (args.Session.AttachedEntity is not {Valid: true} user) @@ -144,31 +126,17 @@ namespace Content.Server.Strip } } - public void StartOpeningStripper(EntityUid user, StrippableComponent component) + public void StartOpeningStripper(EntityUid user, StrippableComponent component, bool openInCombat = false) { - if (component.CancelTokens.ContainsKey(user)) return; + if (TryComp(user, out var mode) && mode.IsInCombatMode && !openInCombat) + return; if (TryComp(user, out var actor)) { - if (component.Owner.GetUIOrNull(StrippingUiKey.Key)?.SessionHasOpen(actor.PlayerSession) == true) + if (_userInterfaceSystem.SessionHasOpenUi(component.Owner, StrippingUiKey.Key, actor.PlayerSession)) return; + _userInterfaceSystem.TryOpen(component.Owner, StrippingUiKey.Key, actor.PlayerSession); } - - var token = new CancellationTokenSource(); - - var doAfterArgs = new DoAfterEventArgs(user, component.OpenDelay, token.Token, component.Owner) - { - BreakOnStun = true, - BreakOnDamage = true, - BreakOnTargetMove = true, - BreakOnUserMove = true, - NeedHand = true, - TargetCancelledEvent = new OpenStrippingCancelledEvent(user), - TargetFinishedEvent = new OpenStrippingCompleteEvent(user), - }; - - component.CancelTokens[user] = token; - _doAfterSystem.DoAfter(doAfterArgs); } private void OnCompInit(EntityUid uid, StrippableComponent component, ComponentInit args) @@ -283,7 +251,7 @@ namespace Content.Server.Strip { Text = Loc.GetString("strip-verb-get-data-text"), IconTexture = "/Textures/Interface/VerbIcons/outfit.svg.192dpi.png", - Act = () => StartOpeningStripper(args.User, component), + Act = () => StartOpeningStripper(args.User, component, true), }; args.Verbs.Add(verb); } diff --git a/Content.Shared/Inventory/InventoryTemplatePrototype.cs b/Content.Shared/Inventory/InventoryTemplatePrototype.cs index d8b51c9512..89884c36a8 100644 --- a/Content.Shared/Inventory/InventoryTemplatePrototype.cs +++ b/Content.Shared/Inventory/InventoryTemplatePrototype.cs @@ -21,7 +21,7 @@ public sealed class SlotDefinition [DataField("slotFlags")] public SlotFlags SlotFlags { get; } = SlotFlags.PREVENTEQUIP; - [DataField("stripTime")] public float StripTime { get; } = 3f; + [DataField("stripTime")] public float StripTime { get; } = 4f; [DataField("uiContainer")] public SlotUIContainer UIContainer { get; } = SlotUIContainer.None; diff --git a/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml index 376455d4f6..851ba4c078 100644 --- a/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml @@ -4,21 +4,21 @@ - name: shoes slotTexture: shoes slotFlags: FEET - stripTime: 2 + stripTime: 3 uiContainer: Top uiWindowPos: 1,3 displayName: Shoes - name: jumpsuit slotTexture: uniform slotFlags: INNERCLOTHING - stripTime: 5 + stripTime: 6 uiContainer: Top uiWindowPos: 0,2 displayName: Jumpsuit - name: outerClothing slotTexture: suit slotFlags: OUTERCLOTHING - stripTime: 5 + stripTime: 6 uiContainer: Top uiWindowPos: 1,2 displayName: Suit @@ -43,14 +43,14 @@ - name: eyes slotTexture: glasses slotFlags: EYES - stripTime: 2 + stripTime: 3 uiContainer: Top uiWindowPos: 0,0 displayName: Eyes - name: ears slotTexture: ears slotFlags: EARS - stripTime: 2 + stripTime: 3 uiContainer: Top uiWindowPos: 2,0 displayName: Ears @@ -63,7 +63,7 @@ - name: pocket1 slotTexture: pocket slotFlags: POCKET - stripTime: 2 + stripTime: 3 uiContainer: BottomRight uiWindowPos: 0,3 dependsOn: jumpsuit @@ -72,7 +72,7 @@ - name: pocket2 slotTexture: pocket slotFlags: POCKET - stripTime: 2 + stripTime: 3 uiContainer: BottomRight uiWindowPos: 2,3 dependsOn: jumpsuit @@ -81,7 +81,7 @@ - name: suitstorage slotTexture: suit_storage slotFlags: SUITSTORAGE - stripTime: 2 + stripTime: 3 uiContainer: BottomLeft uiWindowPos: 2,0 dependsOn: outerClothing @@ -89,7 +89,7 @@ - name: id slotTexture: id slotFlags: IDCARD - stripTime: 5 + stripTime: 6 uiContainer: BottomRight uiWindowPos: 2,1 dependsOn: jumpsuit @@ -97,14 +97,14 @@ - name: belt slotTexture: belt slotFlags: BELT - stripTime: 5 + stripTime: 6 uiContainer: BottomLeft uiWindowPos: 3,1 displayName: Belt - name: back slotTexture: back slotFlags: BACK - stripTime: 5 + stripTime: 6 uiContainer: BottomLeft uiWindowPos: 3,0 displayName: Back