Limit atmos device rates (#6533)

This commit is contained in:
Leon Friedrich
2022-03-01 03:39:30 +13:00
committed by GitHub
parent ffed5eec81
commit ee7d0440f3
20 changed files with 220 additions and 116 deletions

View File

@@ -1,9 +1,5 @@
using System;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Unary.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.Piping.Unary.Components
{
@@ -24,17 +20,57 @@ namespace Content.Server.Atmos.Piping.Unary.Components
public string InletName { get; set; } = "pipe";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("pumpDirection")]
public VentPumpDirection PumpDirection { get; set; } = VentPumpDirection.Releasing;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("pressureChecks")]
public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("externalPressureBound")]
public float ExternalPressureBound { get; set; } = Atmospherics.OneAtmosphere;
public float ExternalPressureBound
{
get => _externalPressureBound;
set
{
_externalPressureBound = Math.Clamp(value, 0, MaxPressure);
}
}
private float _externalPressureBound = Atmospherics.OneAtmosphere;
[ViewVariables(VVAccess.ReadWrite)]
public float InternalPressureBound { get; set; } = 0f;
[DataField("internalPressureBound")]
public float InternalPressureBound
{
get => _internalPressureBound;
set
{
_internalPressureBound = Math.Clamp(value, 0, MaxPressure);
}
}
private float _internalPressureBound = 0;
/// <summary>
/// Max pressure of the target gas (NOT relative to source).
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxPressure")]
public float MaxPressure = Atmospherics.MaxOutputPressure;
/// <summary>
/// Pressure pump speed in kPa/s. Determines how much gas is moved.
/// </summary>
/// <remarks>
/// The pump will attempt to modify the destination's final pressure by this quantity every second. If this
/// is too high, and the vent is connected to a large pipe-net, then someone can nearly instantly flood a
/// room with gas.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("targetPressureChange")]
public float TargetPressureChange = Atmospherics.OneAtmosphere;
public GasVentPumpData ToAirAlarmData()
{