Files
tbd-station-14/Content.Server/Atmos/Monitor/WireActions/AirAlarmPanicWire.cs
metalgearsloth 63dfd21b14 Predict dumping (#32394)
* Predict dumping

- This got soaped really fucking hard.
- Dumping is predicted, this required disposals to be predicte.d
- Disposals required mailing (because it's tightly coupled), and a smidge of other content systems.
- I also had to fix a compnetworkgenerator issue at the same time so it wouldn't mispredict.

* Fix a bunch of stuff

* nasty merge

* Some reviews

* Some more reviews while I stash

* Fix merge

* Fix merge

* Half of review

* Review

* re(h)f

* lizards

* feexes

* feex
2025-04-19 16:20:40 +10:00

60 lines
2.0 KiB
C#

using Content.Server.Atmos.Monitor.Components;
using Content.Server.Atmos.Monitor.Systems;
using Content.Server.Wires;
using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Wires;
using Content.Shared.DeviceNetwork.Components;
namespace Content.Server.Atmos.Monitor;
public sealed partial class AirAlarmPanicWire : ComponentWireAction<AirAlarmComponent>
{
public override string Name { get; set; } = "wire-name-air-alarm-panic";
public override Color Color { get; set; } = Color.Red;
private AirAlarmSystem _airAlarmSystem = default!;
public override object StatusKey { get; } = AirAlarmWireStatus.Panic;
public override StatusLightState? GetLightState(Wire wire, AirAlarmComponent comp)
=> comp.CurrentMode == AirAlarmMode.Panic
? StatusLightState.On
: StatusLightState.Off;
public override void Initialize()
{
base.Initialize();
_airAlarmSystem = EntityManager.System<AirAlarmSystem>();
}
public override bool Cut(EntityUid user, Wire wire, AirAlarmComponent comp)
{
if (EntityManager.TryGetComponent<DeviceNetworkComponent>(wire.Owner, out var devNet))
{
_airAlarmSystem.SetMode(wire.Owner, devNet.Address, AirAlarmMode.Panic, false);
}
return true;
}
public override bool Mend(EntityUid user, Wire wire, AirAlarmComponent alarm)
{
if (EntityManager.TryGetComponent<DeviceNetworkComponent>(wire.Owner, out var devNet)
&& alarm.CurrentMode == AirAlarmMode.Panic)
{
_airAlarmSystem.SetMode(wire.Owner, devNet.Address, AirAlarmMode.Filtering, false, alarm);
}
return true;
}
public override void Pulse(EntityUid user, Wire wire, AirAlarmComponent comp)
{
if (EntityManager.TryGetComponent<DeviceNetworkComponent>(wire.Owner, out var devNet))
{
_airAlarmSystem.SetMode(wire.Owner, devNet.Address, AirAlarmMode.Panic, false);
}
}
}