65 lines
2.2 KiB
C#
65 lines
2.2 KiB
C#
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
|
|
{
|
|
[RegisterComponent]
|
|
public class GasVentPumpComponent : Component
|
|
{
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public bool Enabled { get; set; } = true;
|
|
|
|
[ViewVariables]
|
|
public bool IsDirty { get; set; } = false;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public bool Welded { get; set; } = false;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
[DataField("inlet")]
|
|
public string InletName { get; set; } = "pipe";
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public VentPumpDirection PumpDirection { get; set; } = VentPumpDirection.Releasing;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
[DataField("externalPressureBound")]
|
|
public float ExternalPressureBound { get; set; } = Atmospherics.OneAtmosphere;
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
public float InternalPressureBound { get; set; } = 0f;
|
|
|
|
public GasVentPumpData ToAirAlarmData()
|
|
{
|
|
if (!IsDirty) return new GasVentPumpData { Dirty = IsDirty };
|
|
|
|
return new GasVentPumpData
|
|
{
|
|
Enabled = Enabled,
|
|
Dirty = IsDirty,
|
|
PumpDirection = PumpDirection,
|
|
PressureChecks = PressureChecks,
|
|
ExternalPressureBound = ExternalPressureBound,
|
|
InternalPressureBound = InternalPressureBound
|
|
};
|
|
}
|
|
|
|
public void FromAirAlarmData(GasVentPumpData data)
|
|
{
|
|
Enabled = data.Enabled;
|
|
IsDirty = data.Dirty;
|
|
PumpDirection = (VentPumpDirection) data.PumpDirection!;
|
|
PressureChecks = (VentPressureBound) data.PressureChecks!;
|
|
ExternalPressureBound = (float) data.ExternalPressureBound!;
|
|
InternalPressureBound = (float) data.InternalPressureBound!;
|
|
}
|
|
}
|
|
}
|