2023-01-18 05:44:32 +11:00
|
|
|
using Content.Server.Doors.Systems;
|
2022-05-05 19:35:06 -07:00
|
|
|
using Content.Server.Wires;
|
|
|
|
|
using Content.Shared.Doors;
|
2023-01-18 05:44:32 +11:00
|
|
|
using Content.Shared.Doors.Components;
|
|
|
|
|
using Content.Shared.Doors.Systems;
|
2022-05-05 19:35:06 -07:00
|
|
|
using Content.Shared.Wires;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Doors;
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class DoorBoltWireAction : ComponentWireAction<DoorBoltComponent>
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-01-21 12:51:02 +13:00
|
|
|
public override Color Color { get; set; } = Color.Red;
|
|
|
|
|
public override string Name { get; set; } = "wire-name-door-bolt";
|
2023-06-01 02:23:35 +12:00
|
|
|
|
|
|
|
|
public override StatusLightState? GetLightState(Wire wire, DoorBoltComponent comp)
|
2023-01-21 12:51:02 +13:00
|
|
|
=> comp.BoltsDown ? StatusLightState.On : StatusLightState.Off;
|
2022-05-05 19:35:06 -07:00
|
|
|
|
|
|
|
|
public override object StatusKey { get; } = AirlockWireStatus.BoltIndicator;
|
|
|
|
|
|
2023-06-01 02:23:35 +12:00
|
|
|
public override bool Cut(EntityUid user, Wire wire, DoorBoltComponent airlock)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2024-02-22 18:01:31 -05:00
|
|
|
EntityManager.System<DoorSystem>().SetBoltWireCut((wire.Owner, airlock), true);
|
2023-01-21 12:51:02 +13:00
|
|
|
if (!airlock.BoltsDown && IsPowered(wire.Owner))
|
2024-02-22 18:01:31 -05:00
|
|
|
EntityManager.System<DoorSystem>().SetBoltsDown((wire.Owner, airlock), true, user);
|
2022-05-05 19:35:06 -07:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 02:23:35 +12:00
|
|
|
public override bool Mend(EntityUid user, Wire wire, DoorBoltComponent door)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2024-02-22 18:01:31 -05:00
|
|
|
EntityManager.System<DoorSystem>().SetBoltWireCut((wire.Owner, door), false);
|
2022-05-05 19:35:06 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 02:23:35 +12:00
|
|
|
public override void Pulse(EntityUid user, Wire wire, DoorBoltComponent door)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-01-21 12:51:02 +13:00
|
|
|
if (IsPowered(wire.Owner))
|
2024-02-22 18:01:31 -05:00
|
|
|
EntityManager.System<DoorSystem>().SetBoltsDown((wire.Owner, door), !door.BoltsDown);
|
2023-01-21 12:51:02 +13:00
|
|
|
else if (!door.BoltsDown)
|
2024-02-22 18:01:31 -05:00
|
|
|
EntityManager.System<DoorSystem>().SetBoltsDown((wire.Owner, door), true);
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
}
|