Add cooldown to shuttle calling (#3225)

This commit is contained in:
DrSmugleaf
2021-02-16 09:31:57 +01:00
committed by GitHub
parent cf7ac025b4
commit 04aa195c91
5 changed files with 75 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Content.Client.Command;
using Content.Shared.GameObjects.Components.Command;
using Robust.Client.GameObjects;
@@ -13,7 +14,9 @@ namespace Content.Client.GameObjects.Components.Command
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[ViewVariables] private CommunicationsConsoleMenu _menu;
[ViewVariables] private CommunicationsConsoleMenu? _menu;
public bool CanCall { get; private set; }
public bool CountdownStarted { get; private set; }
@@ -30,15 +33,13 @@ namespace Content.Client.GameObjects.Components.Command
base.Open();
_menu = new CommunicationsConsoleMenu(this);
_menu.OnClose += Close;
_menu.OpenCentered();
}
public void EmergencyShuttleButtonPressed()
{
if(CountdownStarted)
if (CountdownStarted)
RecallShuttle();
else
CallShuttle();
@@ -61,10 +62,15 @@ namespace Content.Client.GameObjects.Components.Command
if (state is not CommunicationsConsoleInterfaceState commsState)
return;
CanCall = commsState.CanCall;
_expectedCountdownTime = commsState.ExpectedCountdownEnd;
CountdownStarted = commsState.CountdownStarted;
_menu?.UpdateCountdown();
if (_menu != null)
{
_menu.UpdateCountdown();
_menu.EmergencyShuttleButton.Disabled = !CanCall;
}
}
protected override void Dispose(bool disposing)