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,4 @@
using System;
using Content.Server.Atmos.Piping.Trinary.EntitySystems;
using Content.Shared.Atmos;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.Piping.Trinary.Components
{
@@ -26,8 +21,13 @@ namespace Content.Server.Atmos.Piping.Trinary.Components
public string OutletName { get; set; } = "outlet";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transferRate")]
public float TransferRate { get; set; } = Atmospherics.MaxTransferRate;
[DataField("maxTransferRate")]
public float MaxTransferRate { get; set; } = Atmospherics.MaxTransferRate;
[ViewVariables(VVAccess.ReadWrite)]
public Gas? FilteredGas { get; set; }
}

View File

@@ -23,8 +23,13 @@ namespace Content.Server.Atmos.Piping.Trinary.Components
public string OutletName = "outlet";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("targetPressure")]
public float TargetPressure = Atmospherics.OneAtmosphere;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxTargetPressure")]
public float MaxTargetPressure = Atmospherics.MaxOutputPressure;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inletOneConcentration")]
public float InletOneConcentration = 0.5f;

View File

@@ -138,7 +138,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
private void OnTransferRateChangeMessage(EntityUid uid, GasFilterComponent filter, GasFilterChangeRateMessage args)
{
filter.TransferRate = Math.Clamp(args.Rate, 0f, Atmospherics.MaxTransferRate);
filter.TransferRate = Math.Clamp(args.Rate, 0f, filter.MaxTransferRate);
_adminLogSystem.Add(LogType.AtmosVolumeChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.Rate}");
DirtyUI(uid, filter);

View File

@@ -173,7 +173,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
private void OnOutputPressureChangeMessage(EntityUid uid, GasMixerComponent mixer, GasMixerChangeOutputPressureMessage args)
{
mixer.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure);
mixer.TargetPressure = Math.Clamp(args.Pressure, 0f, mixer.MaxTargetPressure);
_adminLogSystem.Add(LogType.AtmosPressureChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa");
DirtyUI(uid, mixer);