From 76e4766d65c05fb47b78bc20ff4003d6b723d218 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 4 Jul 2022 23:09:10 +1000 Subject: [PATCH] Make shuttle launch use ID card entity name (#9405) --- .../Systems/ShuttleSystem.EmergencyConsole.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs index a08c899c9f..ef5060bed5 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs @@ -1,4 +1,5 @@ using System.Threading; +using Content.Server.Access.Systems; using Content.Server.Popups; using Content.Server.RoundEnd; using Content.Server.Shuttles.Components; @@ -25,6 +26,7 @@ public sealed partial class ShuttleSystem */ [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IdCardSystem _idSystem = default!; [Dependency] private readonly AccessReaderSystem _reader = default!; [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly RoundEndSystem _roundEnd = default!; @@ -154,6 +156,7 @@ public sealed partial class ShuttleSystem if (component.AuthorizedEntities.Count == 0) return; _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL ALL by {args.Session:user}"); + _chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", component.AuthorizationsRequired))); component.AuthorizedEntities.Clear(); UpdateAllEmergencyConsoles(); } @@ -163,14 +166,14 @@ public sealed partial class ShuttleSystem var player = args.Session.AttachedEntity; if (player == null) return; - if (!_reader.IsAllowed(player.Value, uid)) + if (!_idSystem.TryFindIdCard(player.Value, out var idCard) || !_reader.IsAllowed(idCard.Owner, uid)) { - _popup.PopupCursor("Access denied", Filter.Entities(player.Value)); + _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), Filter.Entities(player.Value)); return; } // TODO: This is fucking bad - if (!component.AuthorizedEntities.Remove(MetaData(player.Value).EntityName)) return; + if (!component.AuthorizedEntities.Remove(MetaData(idCard.Owner).EntityName)) return; _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL by {args.Session:user}"); var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count; @@ -184,14 +187,14 @@ public sealed partial class ShuttleSystem var player = args.Session.AttachedEntity; if (player == null) return; - if (!_reader.IsAllowed(player.Value, uid)) + if (!_idSystem.TryFindIdCard(player.Value, out var idCard) || !_reader.IsAllowed(idCard.Owner, uid)) { _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), Filter.Entities(player.Value)); return; } // TODO: This is fucking bad - if (!component.AuthorizedEntities.Add(MetaData(player.Value).EntityName)) return; + if (!component.AuthorizedEntities.Add(MetaData(idCard.Owner).EntityName)) return; _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch AUTH by {args.Session:user}"); var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;