Adds delay to internals alert (#13195)
closes https://github.com/space-wizards/space-station-14/issues/12721
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Alert.Click;
|
||||
|
||||
|
||||
@@ -188,9 +188,12 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
public void ConnectToInternals(GasTankComponent component)
|
||||
{
|
||||
if (component.IsConnected || !CanConnectToInternals(component)) return;
|
||||
if (component.IsConnected || !CanConnectToInternals(component))
|
||||
return;
|
||||
|
||||
var internals = GetInternalsComponent(component);
|
||||
if (internals == null) return;
|
||||
if (internals == null)
|
||||
return;
|
||||
|
||||
if (_internals.TryConnectTank(internals, component.Owner))
|
||||
component.User = internals.Owner;
|
||||
@@ -198,7 +201,8 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
_actions.SetToggled(component.ToggleAction, component.IsConnected);
|
||||
|
||||
// Couldn't toggle!
|
||||
if (!component.IsConnected) return;
|
||||
if (!component.IsConnected)
|
||||
return;
|
||||
|
||||
component.ConnectStream?.Stop();
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Server.Popups;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Server.DoAfter;
|
||||
using System.Threading;
|
||||
|
||||
@@ -86,12 +85,15 @@ public sealed class InternalsSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
// Is the target not you? If yes, use a do-after to give them time to respond.
|
||||
if (!force && uid != user)
|
||||
if (!force)
|
||||
{
|
||||
// Is the target not you? If yes, use a do-after to give them time to respond.
|
||||
//If no, do a short delay. There's no reason it should be beyond 1 second.
|
||||
var delay = uid != user ? internals.Delay : 1.0f;
|
||||
|
||||
internals.CancelToken?.Cancel();
|
||||
internals.CancelToken = new CancellationTokenSource();
|
||||
_doAfter.DoAfter(new DoAfterEventArgs(user, internals.Delay, internals.CancelToken.Token, uid)
|
||||
_doAfter.DoAfter(new DoAfterEventArgs(user, delay, internals.CancelToken.Token, uid)
|
||||
{
|
||||
BreakOnUserMove = true,
|
||||
BreakOnDamage = true,
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
sprite: Interface/Alerts/internals.rsi
|
||||
state: internal1
|
||||
event: !type:ToggleActionEvent
|
||||
useDelay: 1.0
|
||||
useDelay: 1
|
||||
- type: Explosive
|
||||
explosionType: Default
|
||||
maxIntensity: 20
|
||||
|
||||
Reference in New Issue
Block a user