Station alert levels (#8226)

This commit is contained in:
Flipp Syder
2022-05-17 21:05:31 -07:00
committed by GitHub
parent 2697bbf8c7
commit dcdda39048
21 changed files with 566 additions and 2 deletions

View File

@@ -1,7 +1,9 @@
using Content.Server.AlertLevel;
using Content.Server.Chat.Managers;
using Content.Server.Coordinates.Helpers;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Popups;
using Content.Server.Station.Systems;
using Content.Server.UserInterface;
using Content.Shared.Audio;
using Content.Shared.Construction.Components;
@@ -20,6 +22,8 @@ namespace Content.Server.Nuke
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
[Dependency] private readonly PopupSystem _popups = default!;
[Dependency] private readonly ExplosionSystem _explosions = default!;
[Dependency] private readonly AlertLevelSystem _alertLevel = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly IChatManager _chat = default!;
public override void Initialize()
@@ -323,6 +327,15 @@ namespace Content.Server.Nuke
if (component.Status == NukeStatus.ARMED)
return;
var stationUid = _stationSystem.GetOwningStation(uid);
// The nuke may not be on a station, so it's more important to just
// let people know that a nuclear bomb was armed in their vicinity instead.
// Otherwise, you could set every station to whatever AlertLevelOnActivate is.
if (stationUid != null)
{
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true);
}
// warn a crew
var announcement = Loc.GetString("nuke-component-announcement-armed",
("time", (int) component.RemainingTime));
@@ -347,6 +360,12 @@ namespace Content.Server.Nuke
if (component.Status != NukeStatus.ARMED)
return;
var stationUid = _stationSystem.GetOwningStation(uid);
if (stationUid != null)
{
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnDeactivate, true, true, true);
}
// warn a crew
var announcement = Loc.GetString("nuke-component-announcement-unarmed");
var sender = Loc.GetString("nuke-component-announcement-sender");