Files
tbd-station-14/Content.Server/Doors/WireActions/DoorBoltWireAction.cs
Fildrance 4bcf3c3c0e Station AI ability to electricute doors (#32012)
* Boom! Emergency access!

* Emergency access sound

* locale

* Updated sounds

* bleh

* Door electrify base

* feat: popups on attempt to activate AI action when wires cut

* refactor: use SharedApcPowerReceiverComponent to check if AI can interact with door

* refactor: added icon and sound for door overcharge

* meta.json should use tabs not spaces

* refactor: extracted sounds for airlock overcharge to static field in system

* refactor: cleanup, ScarKy0 mentions for resources

* refactor: removed unused textures

* feat: now notification is displayed when AI attempting to interact with door which have wire cut

* StationAiWhitelistComponent is properly gating  BUI OnMessageAttempt, SharedPowerReceiverSystem.IsPowered is now used to check if device powered

* refactor: use PlayLocal to play electrify sound only for AI player

* refactor: SetBoltsDown now uses TrySetBoltDown, checks for power.

* bolts now check for power using SharedPowerReceiverSystem

* electrify localization and louder electrify sounds

* extracted ShowDeviceNotRespondingPopup, reverted airlocks not opening/closing when ai wire was cut

* refactor: cleanup

* New sprites and fixes

* Copyright

* even more sprite changes

* refactore: cleanup, rename overcharge => electrify

---------

Co-authored-by: ScarKy0 <scarky0@onet.eu>
Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2024-09-27 17:22:17 +10:00

42 lines
1.5 KiB
C#

using Content.Server.Doors.Systems;
using Content.Server.Wires;
using Content.Shared.Doors;
using Content.Shared.Doors.Components;
using Content.Shared.Wires;
namespace Content.Server.Doors;
public sealed partial class DoorBoltWireAction : ComponentWireAction<DoorBoltComponent>
{
public override Color Color { get; set; } = Color.Red;
public override string Name { get; set; } = "wire-name-door-bolt";
public override StatusLightState? GetLightState(Wire wire, DoorBoltComponent comp)
=> comp.BoltsDown ? StatusLightState.On : StatusLightState.Off;
public override object StatusKey { get; } = AirlockWireStatus.BoltIndicator;
public override bool Cut(EntityUid user, Wire wire, DoorBoltComponent airlock)
{
EntityManager.System<DoorSystem>().SetBoltWireCut((wire.Owner, airlock), true);
if (!airlock.BoltsDown && IsPowered(wire.Owner))
EntityManager.System<DoorSystem>().SetBoltsDown((wire.Owner, airlock), true, user);
return true;
}
public override bool Mend(EntityUid user, Wire wire, DoorBoltComponent door)
{
EntityManager.System<DoorSystem>().SetBoltWireCut((wire.Owner, door), false);
return true;
}
public override void Pulse(EntityUid user, Wire wire, DoorBoltComponent door)
{
if (IsPowered(wire.Owner))
EntityManager.System<DoorSystem>().SetBoltsDown((wire.Owner, door), !door.BoltsDown);
else if (!door.BoltsDown)
EntityManager.System<DoorSystem>().SetBoltsDown((wire.Owner, door), true);
}
}