Seperate EMAG into EMAG and Authentication Disruptor (#34337)
This commit is contained in:
@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.DeviceLinking.Events;
|
||||
using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
@@ -24,6 +23,7 @@ public sealed class AccessReaderSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly EmagSystem _emag = default!;
|
||||
[Dependency] private readonly SharedGameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
@@ -71,17 +71,28 @@ public sealed class AccessReaderSystem : EntitySystem
|
||||
{
|
||||
if (args.User == null) // AutoLink (and presumably future external linkers) have no user.
|
||||
return;
|
||||
if (!HasComp<EmaggedComponent>(uid) && !IsAllowed(args.User.Value, uid, component))
|
||||
if (!IsAllowed(args.User.Value, uid, component))
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotEmaggedEvent args)
|
||||
{
|
||||
if (!reader.BreakOnEmag)
|
||||
if (!_emag.CompareFlag(args.Type, EmagType.Access))
|
||||
return;
|
||||
|
||||
if (!reader.BreakOnAccessBreaker)
|
||||
return;
|
||||
|
||||
if (!GetMainAccessReader(uid, out var accessReader))
|
||||
return;
|
||||
|
||||
if (accessReader.Value.Comp.AccessLists.Count < 1)
|
||||
return;
|
||||
|
||||
args.Repeatable = true;
|
||||
args.Handled = true;
|
||||
reader.Enabled = false;
|
||||
reader.AccessLog.Clear();
|
||||
accessReader.Value.Comp.AccessLists.Clear();
|
||||
accessReader.Value.Comp.AccessLog.Clear();
|
||||
Dirty(uid, reader);
|
||||
}
|
||||
|
||||
@@ -135,6 +146,7 @@ public sealed class AccessReaderSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user