Skip to content

Commit

Permalink
Implement Air Vent pressure lockout override, allowing atmos to overr…
Browse files Browse the repository at this point in the history
…ide lockout via air alarm fill preset.
  • Loading branch information
MjrLandWhale committed Jun 12, 2024
1 parent b091a55 commit 30a626b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ public float InternalPressureBound
[ViewVariables(VVAccess.ReadWrite)]
[DataField("depressurizePressure")]
public float DepressurizePressure = 0;

[ViewVariables(VVAccess.ReadWrite)]
[DataField("pressureLockoutOverride")]
public bool PressureLockoutOverride = false;
#endregion

public GasVentPumpData ToAirAlarmData()
Expand All @@ -146,7 +150,8 @@ public GasVentPumpData ToAirAlarmData()
PumpDirection = PumpDirection,
PressureChecks = PressureChecks,
ExternalPressureBound = ExternalPressureBound,
InternalPressureBound = InternalPressureBound
InternalPressureBound = InternalPressureBound,
PressureLockoutOverride = PressureLockoutOverride
};
}

Expand All @@ -158,6 +163,7 @@ public void FromAirAlarmData(GasVentPumpData data)
PressureChecks = data.PressureChecks;
ExternalPressureBound = data.ExternalPressureBound;
InternalPressureBound = data.InternalPressureBound;
PressureLockoutOverride = data.PressureLockoutOverride;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref
// (ignoring temperature differences because I am lazy)
var transferMoles = pressureDelta * environment.Volume / (pipe.Air.Temperature * Atmospherics.R);

if (vent.UnderPressureLockout)
// Only run if the device is under lockout and not being overriden
if (vent.UnderPressureLockout & !vent.PressureLockoutOverride)
{
// Leak only a small amount of gas as a proportion of supply pipe pressure.
var pipeDelta = pipe.Air.Pressure - environment.Pressure;
Expand Down Expand Up @@ -280,7 +281,7 @@ private void OnExamine(EntityUid uid, GasVentPumpComponent component, ExaminedEv
return;
if (args.IsInDetailsRange)
{
if (pumpComponent.UnderPressureLockout)
if (pumpComponent.UnderPressureLockout & !pumpComponent.PressureLockoutOverride)
{
args.PushMarkup(Loc.GetString("gas-vent-pump-uvlo"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public sealed class GasVentPumpData : IAtmosDeviceData
public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound;
public float ExternalPressureBound { get; set; } = Atmospherics.OneAtmosphere;
public float InternalPressureBound { get; set; } = 0f;
public bool PressureLockoutOverride { get; set; } = false;

// Presets for 'dumb' air alarm modes

Expand All @@ -22,7 +23,8 @@ public sealed class GasVentPumpData : IAtmosDeviceData
PumpDirection = VentPumpDirection.Releasing,
PressureChecks = VentPressureBound.ExternalBound,
ExternalPressureBound = Atmospherics.OneAtmosphere,
InternalPressureBound = 0f
InternalPressureBound = 0f,
PressureLockoutOverride = false
};

public static GasVentPumpData FillModePreset = new GasVentPumpData
Expand All @@ -32,7 +34,8 @@ public sealed class GasVentPumpData : IAtmosDeviceData
PumpDirection = VentPumpDirection.Releasing,
PressureChecks = VentPressureBound.ExternalBound,
ExternalPressureBound = Atmospherics.OneAtmosphere * 50,
InternalPressureBound = 0f
InternalPressureBound = 0f,
PressureLockoutOverride = true
};

public static GasVentPumpData PanicModePreset = new GasVentPumpData
Expand All @@ -42,7 +45,8 @@ public sealed class GasVentPumpData : IAtmosDeviceData
PumpDirection = VentPumpDirection.Releasing,
PressureChecks = VentPressureBound.ExternalBound,
ExternalPressureBound = Atmospherics.OneAtmosphere,
InternalPressureBound = 0f
InternalPressureBound = 0f,
PressureLockoutOverride = false
};

public static GasVentPumpData ReplaceModePreset = new GasVentPumpData
Expand All @@ -53,7 +57,8 @@ public sealed class GasVentPumpData : IAtmosDeviceData
PumpDirection = VentPumpDirection.Releasing,
PressureChecks = VentPressureBound.ExternalBound,
ExternalPressureBound = Atmospherics.OneAtmosphere,
InternalPressureBound = 0f
InternalPressureBound = 0f,
PressureLockoutOverride = false
};
}

Expand Down

0 comments on commit 30a626b

Please sign in to comment.