* The all-in-one hacking solution The thinking man's lockpick The iconic EMAG * emagged medbay's stasis bed * left med, emagged sec' apc * went back to chem, emagged the dispenser * emagged the fax while i was there * had a donut while waiting for emag to charge * i broke into the bridge then announced 'mandatory johnson inspection in medical' * get system instead of dependency * feedback * net suggestion Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * use EnsureComp and import NetworkedComponent --------- Co-authored-by: deltanedas <user@zenith> Co-authored-by: deltanedas <deltanedas@laptop> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Access;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Server.Access;
|
||||
@@ -14,26 +15,28 @@ public sealed class AccessWireAction : ComponentWireAction<AccessReaderComponent
|
||||
private int _pulseTimeout = 30;
|
||||
|
||||
public override StatusLightState? GetLightState(Wire wire, AccessReaderComponent comp)
|
||||
=> comp.Enabled ? StatusLightState.On : StatusLightState.Off;
|
||||
{
|
||||
return EntityManager.HasComponent<EmaggedComponent>(comp.Owner) ? StatusLightState.On : StatusLightState.Off;
|
||||
}
|
||||
|
||||
public override object StatusKey { get; } = AccessWireActionKey.Status;
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire, AccessReaderComponent comp)
|
||||
{
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key);
|
||||
comp.Enabled = false;
|
||||
EntityManager.RemoveComponent<EmaggedComponent>(comp.Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire, AccessReaderComponent comp)
|
||||
{
|
||||
comp.Enabled = true;
|
||||
EntityManager.AddComponent<EmaggedComponent>(comp.Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Pulse(EntityUid user, Wire wire, AccessReaderComponent comp)
|
||||
{
|
||||
comp.Enabled = false;
|
||||
EntityManager.RemoveComponent<EmaggedComponent>(comp.Owner);
|
||||
WiresSystem.StartWireAction(wire.Owner, _pulseTimeout, PulseTimeoutKey.Key, new TimedWireEvent(AwaitPulseCancel, wire));
|
||||
}
|
||||
|
||||
@@ -49,9 +52,10 @@ public sealed class AccessWireAction : ComponentWireAction<AccessReaderComponent
|
||||
{
|
||||
if (!wire.IsCut)
|
||||
{
|
||||
// check is still here incase you somehow TOCTOU it into unemagging something it shouldn't
|
||||
if (EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var access))
|
||||
{
|
||||
access.Enabled = true;
|
||||
EntityManager.RemoveComponent<EmaggedComponent>(wire.Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user