Pump enabled animation (#1973)

* Pump enabled animation

* naming fixes

Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
py01
2020-08-31 16:29:53 -06:00
committed by GitHub
parent f41e39410d
commit 4d43a15cba
8 changed files with 59 additions and 4 deletions

View File

@@ -16,6 +16,21 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
/// </summary>
public abstract class BasePumpComponent : PipeNetDeviceComponent
{
/// <summary>
/// If the pump is currently pumping.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool PumpEnabled
{
get => _pumpEnabled;
set
{
_pumpEnabled = value;
UpdateAppearance();
}
}
private bool _pumpEnabled = true;
/// <summary>
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="Pipe"/> on this entity.
/// </summary>
@@ -67,6 +82,9 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
public override void Update()
{
if (!PumpEnabled)
return;
PumpGas(_inletPipe.Air, _outletPipe.Air);
}
@@ -74,7 +92,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
private void UpdateAppearance()
{
_appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_inletDirection, _outletDirection, _inletPipe.ConduitLayer, _outletPipe.ConduitLayer));
_appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_inletDirection, _outletDirection, _inletPipe.ConduitLayer, _outletPipe.ConduitLayer, PumpEnabled));
}
}
}