Fix air devices ignoring settings after power cycle (#34887)
* add powered variable to vent components * add checks for powered to vent systems also corrected onpowerchanged methods to update powered arg. * removed powered from components * Use ApcPowerReceieverComponent for power state. * removed unneeded code from OnPowerChanged * document what enabled is used for in components * only you can prevent oopsie daisies. * add check for powered in OnGasVentPumpUpdated * apcPowerReceiverComponent BEGONE * CODE RED EVERYTHINGS ON FIRE wait we're fine now.
This commit is contained in:
@@ -11,8 +11,12 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
[RegisterComponent]
|
||||
public sealed partial class GasVentPumpComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies if the device is enabled by an air alarm. Does not indicate if the device is powered.
|
||||
/// By default, all air vents start enabled, whether linked to an alarm or not.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Enabled { get; set; } = false;
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
[ViewVariables]
|
||||
public bool IsDirty { get; set; } = false;
|
||||
|
||||
@@ -9,8 +9,12 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
[Access(typeof(GasVentScrubberSystem))]
|
||||
public sealed partial class GasVentScrubberComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies if the device is enabled by an air alarm. Does not indicate if the device is powered.
|
||||
/// By default, all air scrubbers start enabled, whether linked to an alarm or not.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool Enabled { get; set; } = false;
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
[DataField]
|
||||
public bool IsDirty { get; set; } = false;
|
||||
|
||||
@@ -9,6 +9,8 @@ using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Monitor;
|
||||
@@ -43,6 +45,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
[Dependency] private readonly SharedToolSystem _toolSystem = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _powerReceiverSystem = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -66,9 +69,10 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
{
|
||||
//Bingo waz here
|
||||
if (_weldable.IsWelded(uid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_powerReceiverSystem.IsPowered(uid))
|
||||
return;
|
||||
|
||||
var nodeName = vent.PumpDirection switch
|
||||
{
|
||||
@@ -210,7 +214,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, GasVentPumpComponent component, ref PowerChangedEvent args)
|
||||
{
|
||||
component.Enabled = args.Powered;
|
||||
UpdateState(uid, component);
|
||||
}
|
||||
|
||||
@@ -318,7 +321,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
_appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Welded, appearance);
|
||||
}
|
||||
else if (!vent.Enabled)
|
||||
else if (!_powerReceiverSystem.IsPowered(uid) || !vent.Enabled)
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
_appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Off, appearance);
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Server.NodeContainer;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Piping.Unary.Visuals;
|
||||
@@ -37,6 +38,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly WeldableSystem _weldable = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _powerReceiverSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -58,6 +60,9 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
|
||||
var timeDelta = args.dt;
|
||||
|
||||
if (!_powerReceiverSystem.IsPowered(uid))
|
||||
return;
|
||||
|
||||
if (!scrubber.Enabled || !_nodeContainer.TryGetNode(uid, scrubber.OutletName, out PipeNode? outlet))
|
||||
return;
|
||||
|
||||
@@ -141,7 +146,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, GasVentScrubberComponent component, ref PowerChangedEvent args)
|
||||
{
|
||||
component.Enabled = args.Powered;
|
||||
UpdateState(uid, component);
|
||||
}
|
||||
|
||||
@@ -225,7 +229,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Welded, appearance);
|
||||
}
|
||||
else if (!scrubber.Enabled)
|
||||
else if (!_powerReceiverSystem.IsPowered(uid) || !scrubber.Enabled)
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Off, appearance);
|
||||
|
||||
Reference in New Issue
Block a user