Make shuttle launch use ID card entity name (#9405)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Content.Server.Access.Systems;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.RoundEnd;
|
using Content.Server.RoundEnd;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
@@ -25,6 +26,7 @@ public sealed partial class ShuttleSystem
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
|
[Dependency] private readonly IdCardSystem _idSystem = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _reader = default!;
|
[Dependency] private readonly AccessReaderSystem _reader = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||||
@@ -154,6 +156,7 @@ public sealed partial class ShuttleSystem
|
|||||||
if (component.AuthorizedEntities.Count == 0) return;
|
if (component.AuthorizedEntities.Count == 0) return;
|
||||||
|
|
||||||
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL ALL by {args.Session:user}");
|
_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();
|
component.AuthorizedEntities.Clear();
|
||||||
UpdateAllEmergencyConsoles();
|
UpdateAllEmergencyConsoles();
|
||||||
}
|
}
|
||||||
@@ -163,14 +166,14 @@ public sealed partial class ShuttleSystem
|
|||||||
var player = args.Session.AttachedEntity;
|
var player = args.Session.AttachedEntity;
|
||||||
if (player == null) return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is fucking bad
|
// 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}");
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL by {args.Session:user}");
|
||||||
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
|
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
|
||||||
@@ -184,14 +187,14 @@ public sealed partial class ShuttleSystem
|
|||||||
var player = args.Session.AttachedEntity;
|
var player = args.Session.AttachedEntity;
|
||||||
if (player == null) return;
|
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));
|
_popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), Filter.Entities(player.Value));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is fucking bad
|
// 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}");
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch AUTH by {args.Session:user}");
|
||||||
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
|
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
|
||||||
|
|||||||
Reference in New Issue
Block a user