Limit atmos device rates (#6533)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Content.Server.Atmos.Piping.Unary.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
|
||||
namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[Friend(typeof(GasOutletInjectorSystem))]
|
||||
public sealed class GasOutletInjectorComponent : Component
|
||||
{
|
||||
|
||||
@@ -14,12 +14,26 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Injecting { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Target volume to transfer. If <see cref="WideNet"/> is enabled, actual transfer rate will be much higher.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float VolumeRate { get; set; } = 50f;
|
||||
public float TransferRate
|
||||
{
|
||||
get => _transferRate;
|
||||
set => _transferRate = Math.Clamp(value, 0f, MaxTransferRate);
|
||||
}
|
||||
|
||||
private float _transferRate = 50;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("maxTransferRate")]
|
||||
public float MaxTransferRate = Atmospherics.MaxTransferRate;
|
||||
|
||||
[DataField("maxPressure")]
|
||||
public float MaxPressure { get; set; } = 2 * Atmospherics.MaxOutputPressure;
|
||||
|
||||
[DataField("inlet")]
|
||||
public string InletName { get; set; } = "pipe";
|
||||
|
||||
// TODO ATMOS: Inject method.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos.Piping.Unary.EntitySystems;
|
||||
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
|
||||
{
|
||||
[RegisterComponent]
|
||||
[Friend(typeof(GasVentScrubberSystem))]
|
||||
public sealed class GasVentScrubberComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -30,8 +28,28 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ScrubberPumpDirection PumpDirection { get; set; } = ScrubberPumpDirection.Scrubbing;
|
||||
|
||||
/// <summary>
|
||||
/// Target volume to transfer. If <see cref="WideNet"/> is enabled, actual transfer rate will be much higher.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float VolumeRate { get; set; } = 200f;
|
||||
public float TransferRate
|
||||
{
|
||||
get => _transferRate;
|
||||
set => _transferRate = Math.Clamp(value, 0f, MaxTransferRate);
|
||||
}
|
||||
|
||||
private float _transferRate = Atmospherics.MaxTransferRate;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("maxTransferRate")]
|
||||
public float MaxTransferRate = Atmospherics.MaxTransferRate;
|
||||
|
||||
/// <summary>
|
||||
/// As pressure difference approaches this number, the effective volume rate may be smaller than <see
|
||||
/// cref="TransferRate"/>
|
||||
/// </summary>
|
||||
[DataField("maxPressure")]
|
||||
public float MaxPressure = Atmospherics.MaxOutputPressure;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool WideNet { get; set; } = false;
|
||||
@@ -46,7 +64,7 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
Dirty = IsDirty,
|
||||
FilterGases = FilterGases,
|
||||
PumpDirection = PumpDirection,
|
||||
VolumeRate = VolumeRate,
|
||||
VolumeRate = TransferRate,
|
||||
WideNet = WideNet
|
||||
};
|
||||
}
|
||||
@@ -56,7 +74,7 @@ namespace Content.Server.Atmos.Piping.Unary.Components
|
||||
Enabled = data.Enabled;
|
||||
IsDirty = data.Dirty;
|
||||
PumpDirection = (ScrubberPumpDirection) data.PumpDirection!;
|
||||
VolumeRate = (float) data.VolumeRate!;
|
||||
TransferRate = (float) data.VolumeRate!;
|
||||
WideNet = data.WideNet;
|
||||
|
||||
if (!data.FilterGases!.SequenceEqual(FilterGases))
|
||||
|
||||
Reference in New Issue
Block a user