Eshuttle doors and colour (#9175)

This commit is contained in:
metalgearsloth
2022-06-26 18:19:27 +10:00
committed by GitHub
parent 09cd902e8b
commit ef0aa51e41
4 changed files with 31 additions and 15 deletions

View File

@@ -59,6 +59,7 @@ public sealed partial class ShuttleSystem
private CancellationTokenSource? _roundEndCancelToken;
private const string EmergencyRepealAllAccess = "EmergencyShuttleRepealAll";
private static readonly Color DangerColor = Color.Red;
/// <summary>
/// Have the emergency shuttles been authorised to launch at Centcomm?
@@ -189,10 +190,13 @@ public sealed partial class ShuttleSystem
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
if (remaining > 0)
_chatSystem.DispatchGlobalStationAnnouncement(Loc.GetString("emergency-shuttle-console-auth-left", ("remaining", remaining)), playDefaultSound: false);
_chatSystem.DispatchGlobalStationAnnouncement(
Loc.GetString("emergency-shuttle-console-auth-left", ("remaining", remaining)),
playDefaultSound: false, colorOverride: DangerColor);
if (!CheckForLaunch(component))
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());
CheckForLaunch(component);
UpdateAllEmergencyConsoles();
}
@@ -230,27 +234,34 @@ public sealed partial class ShuttleSystem
});
}
private void CheckForLaunch(EmergencyShuttleConsoleComponent component)
private bool CheckForLaunch(EmergencyShuttleConsoleComponent component)
{
if (component.AuthorizedEntities.Count < component.AuthorizationsRequired || EarlyLaunchAuthorized)
return;
return false;
EarlyLaunch();
return true;
}
/// <summary>
/// Attempts to early launch the emergency shuttle if not already done.
/// </summary>
public void EarlyLaunch()
public bool EarlyLaunch()
{
if (EarlyLaunchAuthorized || !EmergencyShuttleArrived) return;
if (EarlyLaunchAuthorized || !EmergencyShuttleArrived) return false;
_logger.Add(LogType.EmergencyShuttle, LogImpact.Extreme, $"Emergency shuttle launch authorized");
_consoleAccumulator = MathF.Max(1f, MathF.Min(_consoleAccumulator, _authorizeTime));
EarlyLaunchAuthorized = true;
RaiseLocalEvent(new EmergencyShuttleAuthorizedEvent());
_chatSystem.DispatchGlobalStationAnnouncement(Loc.GetString("emergency-shuttle-launch-time", ("consoleAccumulator", $"{_consoleAccumulator:0}")), playDefaultSound: false);
_chatSystem.DispatchGlobalStationAnnouncement(
Loc.GetString("emergency-shuttle-launch-time", ("consoleAccumulator", $"{_consoleAccumulator:0}")),
playDefaultSound: false,
colorOverride: DangerColor);
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());
UpdateAllEmergencyConsoles();
return true;
}
public bool DelayEmergencyRoundEnd()