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()

View File

@@ -235,6 +235,9 @@ public sealed partial class ShuttleSystem
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}")), playDefaultSound: false);
// TODO: Need filter extensions or something don't blame me.
SoundSystem.Play("/Audio/Announcements/shuttle_dock.ogg", Filter.Broadcast());
// Bolt all the airlocks so they don't stuff around with them.
SetDockBolts(stationData.EmergencyShuttle.Value, true);
}
else
{

View File

@@ -1,5 +1,6 @@
using Content.Server.Buckle.Components;
using Content.Server.Doors.Components;
using Content.Server.Doors.Systems;
using Content.Server.Shuttles.Components;
using Content.Server.Stunnable;
using Content.Shared.Sound;
@@ -18,6 +19,7 @@ public sealed partial class ShuttleSystem
* This is a way to move a shuttle from one location to another, via an intermediate map for fanciness.
*/
[Dependency] private readonly DoorSystem _doors = default!;
[Dependency] private readonly StunSystem _stuns = default!;
private MapId? _hyperSpaceMap;
@@ -141,9 +143,9 @@ public sealed partial class ShuttleSystem
{
foreach (var (dock, door, xform) in EntityQuery<DockingComponent, AirlockComponent, TransformComponent>(true))
{
if (xform.ParentUid != uid ||
dock.Enabled == enabled) continue;
if (xform.ParentUid != uid) continue;
_doors.TryClose(dock.Owner);
door.SetBoltsWithAudio(enabled);
}
}

View File

@@ -42,19 +42,19 @@ namespace Content.Server.StationEvents.Events
_random.Shuffle(deadList);
var toInfect = _random.Next(1, 3);
var zombifysys = _entityManager.EntitySysManager.GetEntitySystem<ZombifyOnDeathSystem>();
// Now we give it to people in the list of dead entities earlier.
var entSysMgr = IoCManager.Resolve<IEntitySystemManager>();
var stationSystem = entSysMgr.GetEntitySystem<StationSystem>();
var chatSystem = entSysMgr.GetEntitySystem<ChatSystem>();
foreach (var target in deadList)
{
if (toInfect-- == 0)
break;
zombifysys.ZombifyEntity(target.Owner);
var station = stationSystem.GetOwningStation(target.Owner);
@@ -66,7 +66,7 @@ namespace Content.Server.StationEvents.Events
return;
foreach (var station in stationsToNotify)
{
chatSystem.DispatchStationAnnouncement((EntityUid) station, Loc.GetString("station-event-zombie-outbreak-announcement"),
chatSystem.DispatchStationAnnouncement(station, Loc.GetString("station-event-zombie-outbreak-announcement"),
playDefaultSound: false, colorOverride: Color.DarkMagenta);
}
}