remove stripping doafter (#11049)
This commit is contained in:
@@ -9,21 +9,12 @@ namespace Content.Server.Strip
|
||||
[Access(typeof(StrippableSystem))]
|
||||
public sealed class StrippableComponent : SharedStrippableComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("openDelay")]
|
||||
public float OpenDelay = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The strip delay for hands.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("handDelay")]
|
||||
public float HandStripDelay = 3f;
|
||||
public float HandStripDelay = 4f;
|
||||
|
||||
public override bool Drop(DragDropEvent args)
|
||||
{
|
||||
|
||||
@@ -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<StrippableComponent, StrippingHandButtonPressed>(OnStripHandMessage);
|
||||
SubscribeLocalEvent<StrippableComponent, StrippingHandcuffButtonPressed>(OnStripHandcuffMessage);
|
||||
SubscribeLocalEvent<StrippableComponent, StrippingEnsnareButtonPressed>(OnStripEnsnareMessage);
|
||||
|
||||
SubscribeLocalEvent<StrippableComponent, OpenStrippingCompleteEvent>(OnOpenStripComplete);
|
||||
SubscribeLocalEvent<StrippableComponent, OpenStrippingCancelledEvent>(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<ActorComponent>(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<SharedCombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat)
|
||||
return;
|
||||
|
||||
if (TryComp<ActorComponent>(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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user