Add under-pressure lockout to air vents (#9824)
* Add under-pressure lockout to vent pumps * Add examine text showing UPLO
This commit is contained in:
@@ -33,6 +33,17 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
[DataField("pressureChecks")]
|
||||
public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("underPressureLockout")]
|
||||
public bool UnderPressureLockout { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// In releasing mode, do not pump when environment pressure is below this limit.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("underPressureLockoutThreshold")]
|
||||
public float UnderPressureLockoutThreshold = 1;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("externalPressureBound")]
|
||||
public float ExternalPressureBound
|
||||
|
||||
@@ -16,6 +16,7 @@ using Content.Shared.Atmos.Monitor;
|
||||
using Content.Shared.Atmos.Piping.Unary.Components;
|
||||
using Content.Shared.Atmos.Visuals;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Examine;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -41,6 +42,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
SubscribeLocalEvent<GasVentPumpComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<GasVentPumpComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
||||
SubscribeLocalEvent<GasVentPumpComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<GasVentPumpComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<GasVentPumpComponent, SignalReceivedEvent>(OnSignalReceived);
|
||||
}
|
||||
|
||||
@@ -83,6 +85,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
if (environment.Pressure > vent.MaxPressure)
|
||||
return;
|
||||
|
||||
if (environment.Pressure < vent.UnderPressureLockoutThreshold)
|
||||
{
|
||||
vent.UnderPressureLockout = true;
|
||||
return;
|
||||
}
|
||||
vent.UnderPressureLockout = false;
|
||||
|
||||
if ((vent.PressureChecks & VentPressureBound.ExternalBound) != 0)
|
||||
pressureDelta = MathF.Min(pressureDelta, vent.ExternalPressureBound - environment.Pressure);
|
||||
|
||||
@@ -255,5 +264,18 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
appearance.SetData(VentPumpVisuals.State, VentPumpState.Welded);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, GasVentPumpComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!TryComp<GasVentPumpComponent>(uid, out var pumpComponent))
|
||||
return;
|
||||
if (args.IsInDetailsRange)
|
||||
{
|
||||
if (pumpComponent.UnderPressureLockout)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("gas-vent-pump-uvlo"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
Resources/Locale/en-US/atmos/gas-vent-pump.ftl
Normal file
1
Resources/Locale/en-US/atmos/gas-vent-pump.ftl
Normal file
@@ -0,0 +1 @@
|
||||
gas-vent-pump-uvlo = It is in [color=red]under-pressure lock out[/color].
|
||||
Reference in New Issue
Block a user