Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix air devices ignoring settings after power cycle #34887

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Partmedia marked this conversation as resolved.
Show resolved Hide resolved

[ViewVariables]
public bool IsDirty { get; set; } = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Partmedia marked this conversation as resolved.
Show resolved Hide resolved

[DataField]
public bool IsDirty { get; set; } = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrub

var timeDelta = args.dt;

if (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
return;

if (!scrubber.Enabled || !_nodeContainer.TryGetNode(uid, scrubber.OutletName, out PipeNode? outlet))
return;

Expand Down Expand Up @@ -141,7 +144,6 @@ private void OnAtmosAlarm(EntityUid uid, GasVentScrubberComponent component, Atm

private void OnPowerChanged(EntityUid uid, GasVentScrubberComponent component, ref PowerChangedEvent args)
{
component.Enabled = args.Powered;
UpdateState(uid, component);
}

Expand Down Expand Up @@ -225,7 +227,7 @@ private void UpdateState(EntityUid uid, GasVentScrubberComponent scrubber,
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Welded, appearance);
}
else if (!scrubber.Enabled)
else if (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered || !scrubber.Enabled)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Off, appearance);
Expand Down
Loading