remove stripping doafter (#11049)
This commit is contained in:
@@ -9,21 +9,12 @@ namespace Content.Server.Strip
|
|||||||
[Access(typeof(StrippableSystem))]
|
[Access(typeof(StrippableSystem))]
|
||||||
public sealed class StrippableComponent : SharedStrippableComponent
|
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>
|
/// <summary>
|
||||||
/// The strip delay for hands.
|
/// The strip delay for hands.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
[DataField("handDelay")]
|
[DataField("handDelay")]
|
||||||
public float HandStripDelay = 3f;
|
public float HandStripDelay = 4f;
|
||||||
|
|
||||||
public override bool Drop(DragDropEvent args)
|
public override bool Drop(DragDropEvent args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.ComponentModel;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Server.Cuffs.Components;
|
using Content.Server.Cuffs.Components;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
@@ -17,8 +16,8 @@ using Content.Shared.Inventory.Events;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Strip.Components;
|
using Content.Shared.Strip.Components;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.CombatMode;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Strip
|
namespace Content.Server.Strip
|
||||||
@@ -30,6 +29,7 @@ namespace Content.Server.Strip
|
|||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly EnsnareableSystem _ensnaring = default!;
|
[Dependency] private readonly EnsnareableSystem _ensnaring = default!;
|
||||||
|
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
|
||||||
|
|
||||||
// TODO: ECS popups. Not all of these have ECS equivalents yet.
|
// 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, StrippingHandButtonPressed>(OnStripHandMessage);
|
||||||
SubscribeLocalEvent<StrippableComponent, StrippingHandcuffButtonPressed>(OnStripHandcuffMessage);
|
SubscribeLocalEvent<StrippableComponent, StrippingHandcuffButtonPressed>(OnStripHandcuffMessage);
|
||||||
SubscribeLocalEvent<StrippableComponent, StrippingEnsnareButtonPressed>(OnStripEnsnareMessage);
|
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)
|
private void OnStripHandcuffMessage(EntityUid uid, StrippableComponent component, StrippingHandcuffButtonPressed args)
|
||||||
{
|
{
|
||||||
if (args.Session.AttachedEntity is not {Valid: true} user)
|
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 (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;
|
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)
|
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"),
|
Text = Loc.GetString("strip-verb-get-data-text"),
|
||||||
IconTexture = "/Textures/Interface/VerbIcons/outfit.svg.192dpi.png",
|
IconTexture = "/Textures/Interface/VerbIcons/outfit.svg.192dpi.png",
|
||||||
Act = () => StartOpeningStripper(args.User, component),
|
Act = () => StartOpeningStripper(args.User, component, true),
|
||||||
};
|
};
|
||||||
args.Verbs.Add(verb);
|
args.Verbs.Add(verb);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public sealed class SlotDefinition
|
|||||||
|
|
||||||
[DataField("slotFlags")] public SlotFlags SlotFlags { get; } = SlotFlags.PREVENTEQUIP;
|
[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;
|
[DataField("uiContainer")] public SlotUIContainer UIContainer { get; } = SlotUIContainer.None;
|
||||||
|
|
||||||
|
|||||||
@@ -4,21 +4,21 @@
|
|||||||
- name: shoes
|
- name: shoes
|
||||||
slotTexture: shoes
|
slotTexture: shoes
|
||||||
slotFlags: FEET
|
slotFlags: FEET
|
||||||
stripTime: 2
|
stripTime: 3
|
||||||
uiContainer: Top
|
uiContainer: Top
|
||||||
uiWindowPos: 1,3
|
uiWindowPos: 1,3
|
||||||
displayName: Shoes
|
displayName: Shoes
|
||||||
- name: jumpsuit
|
- name: jumpsuit
|
||||||
slotTexture: uniform
|
slotTexture: uniform
|
||||||
slotFlags: INNERCLOTHING
|
slotFlags: INNERCLOTHING
|
||||||
stripTime: 5
|
stripTime: 6
|
||||||
uiContainer: Top
|
uiContainer: Top
|
||||||
uiWindowPos: 0,2
|
uiWindowPos: 0,2
|
||||||
displayName: Jumpsuit
|
displayName: Jumpsuit
|
||||||
- name: outerClothing
|
- name: outerClothing
|
||||||
slotTexture: suit
|
slotTexture: suit
|
||||||
slotFlags: OUTERCLOTHING
|
slotFlags: OUTERCLOTHING
|
||||||
stripTime: 5
|
stripTime: 6
|
||||||
uiContainer: Top
|
uiContainer: Top
|
||||||
uiWindowPos: 1,2
|
uiWindowPos: 1,2
|
||||||
displayName: Suit
|
displayName: Suit
|
||||||
@@ -43,14 +43,14 @@
|
|||||||
- name: eyes
|
- name: eyes
|
||||||
slotTexture: glasses
|
slotTexture: glasses
|
||||||
slotFlags: EYES
|
slotFlags: EYES
|
||||||
stripTime: 2
|
stripTime: 3
|
||||||
uiContainer: Top
|
uiContainer: Top
|
||||||
uiWindowPos: 0,0
|
uiWindowPos: 0,0
|
||||||
displayName: Eyes
|
displayName: Eyes
|
||||||
- name: ears
|
- name: ears
|
||||||
slotTexture: ears
|
slotTexture: ears
|
||||||
slotFlags: EARS
|
slotFlags: EARS
|
||||||
stripTime: 2
|
stripTime: 3
|
||||||
uiContainer: Top
|
uiContainer: Top
|
||||||
uiWindowPos: 2,0
|
uiWindowPos: 2,0
|
||||||
displayName: Ears
|
displayName: Ears
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
- name: pocket1
|
- name: pocket1
|
||||||
slotTexture: pocket
|
slotTexture: pocket
|
||||||
slotFlags: POCKET
|
slotFlags: POCKET
|
||||||
stripTime: 2
|
stripTime: 3
|
||||||
uiContainer: BottomRight
|
uiContainer: BottomRight
|
||||||
uiWindowPos: 0,3
|
uiWindowPos: 0,3
|
||||||
dependsOn: jumpsuit
|
dependsOn: jumpsuit
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
- name: pocket2
|
- name: pocket2
|
||||||
slotTexture: pocket
|
slotTexture: pocket
|
||||||
slotFlags: POCKET
|
slotFlags: POCKET
|
||||||
stripTime: 2
|
stripTime: 3
|
||||||
uiContainer: BottomRight
|
uiContainer: BottomRight
|
||||||
uiWindowPos: 2,3
|
uiWindowPos: 2,3
|
||||||
dependsOn: jumpsuit
|
dependsOn: jumpsuit
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
- name: suitstorage
|
- name: suitstorage
|
||||||
slotTexture: suit_storage
|
slotTexture: suit_storage
|
||||||
slotFlags: SUITSTORAGE
|
slotFlags: SUITSTORAGE
|
||||||
stripTime: 2
|
stripTime: 3
|
||||||
uiContainer: BottomLeft
|
uiContainer: BottomLeft
|
||||||
uiWindowPos: 2,0
|
uiWindowPos: 2,0
|
||||||
dependsOn: outerClothing
|
dependsOn: outerClothing
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
- name: id
|
- name: id
|
||||||
slotTexture: id
|
slotTexture: id
|
||||||
slotFlags: IDCARD
|
slotFlags: IDCARD
|
||||||
stripTime: 5
|
stripTime: 6
|
||||||
uiContainer: BottomRight
|
uiContainer: BottomRight
|
||||||
uiWindowPos: 2,1
|
uiWindowPos: 2,1
|
||||||
dependsOn: jumpsuit
|
dependsOn: jumpsuit
|
||||||
@@ -97,14 +97,14 @@
|
|||||||
- name: belt
|
- name: belt
|
||||||
slotTexture: belt
|
slotTexture: belt
|
||||||
slotFlags: BELT
|
slotFlags: BELT
|
||||||
stripTime: 5
|
stripTime: 6
|
||||||
uiContainer: BottomLeft
|
uiContainer: BottomLeft
|
||||||
uiWindowPos: 3,1
|
uiWindowPos: 3,1
|
||||||
displayName: Belt
|
displayName: Belt
|
||||||
- name: back
|
- name: back
|
||||||
slotTexture: back
|
slotTexture: back
|
||||||
slotFlags: BACK
|
slotFlags: BACK
|
||||||
stripTime: 5
|
stripTime: 6
|
||||||
uiContainer: BottomLeft
|
uiContainer: BottomLeft
|
||||||
uiWindowPos: 3,0
|
uiWindowPos: 3,0
|
||||||
displayName: Back
|
displayName: Back
|
||||||
|
|||||||
Reference in New Issue
Block a user