Adds delay to internals alert (#13195)

closes https://github.com/space-wizards/space-station-14/issues/12721
This commit is contained in:
keronshb
2023-01-01 19:03:19 -05:00
committed by GitHub
parent b33d1f003b
commit f6e1dc15ac
4 changed files with 14 additions and 14 deletions

View File

@@ -1,12 +1,6 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Server.Popups;
using Content.Server.Shuttles.Systems;
using Content.Shared.Alert; using Content.Shared.Alert;
using Content.Shared.Shuttles.Components;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Player;
namespace Content.Server.Alert.Click; namespace Content.Server.Alert.Click;

View File

@@ -188,9 +188,12 @@ namespace Content.Server.Atmos.EntitySystems
public void ConnectToInternals(GasTankComponent component) public void ConnectToInternals(GasTankComponent component)
{ {
if (component.IsConnected || !CanConnectToInternals(component)) return; if (component.IsConnected || !CanConnectToInternals(component))
return;
var internals = GetInternalsComponent(component); var internals = GetInternalsComponent(component);
if (internals == null) return; if (internals == null)
return;
if (_internals.TryConnectTank(internals, component.Owner)) if (_internals.TryConnectTank(internals, component.Owner))
component.User = internals.Owner; component.User = internals.Owner;
@@ -198,7 +201,8 @@ namespace Content.Server.Atmos.EntitySystems
_actions.SetToggled(component.ToggleAction, component.IsConnected); _actions.SetToggled(component.ToggleAction, component.IsConnected);
// Couldn't toggle! // Couldn't toggle!
if (!component.IsConnected) return; if (!component.IsConnected)
return;
component.ConnectStream?.Stop(); component.ConnectStream?.Stop();

View File

@@ -9,7 +9,6 @@ using Robust.Shared.Containers;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Server.Popups; using Content.Server.Popups;
using Robust.Shared.Player;
using Content.Server.DoAfter; using Content.Server.DoAfter;
using System.Threading; using System.Threading;
@@ -86,12 +85,15 @@ public sealed class InternalsSystem : EntitySystem
return; return;
} }
// Is the target not you? If yes, use a do-after to give them time to respond. if (!force)
if (!force && uid != user)
{ {
// 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?.Cancel();
internals.CancelToken = new CancellationTokenSource(); 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, BreakOnUserMove = true,
BreakOnDamage = true, BreakOnDamage = true,

View File

@@ -26,7 +26,7 @@
sprite: Interface/Alerts/internals.rsi sprite: Interface/Alerts/internals.rsi
state: internal1 state: internal1
event: !type:ToggleActionEvent event: !type:ToggleActionEvent
useDelay: 1.0 useDelay: 1
- type: Explosive - type: Explosive
explosionType: Default explosionType: Default
maxIntensity: 20 maxIntensity: 20