Pump enabled animation (#1973)
* Pump enabled animation * naming fixes Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@ using Robust.Shared.Utility;
|
|||||||
using System;
|
using System;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Disposal
|
namespace Content.Client.GameObjects.Components.Atmos
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PumpVisualizer : AppearanceVisualizer
|
public class PumpVisualizer : AppearanceVisualizer
|
||||||
@@ -60,11 +60,26 @@ namespace Content.Client.GameObjects.Components.Disposal
|
|||||||
sprite.LayerSetRSI(basePumpLayer, _pumpRSI);
|
sprite.LayerSetRSI(basePumpLayer, _pumpRSI);
|
||||||
sprite.LayerSetState(basePumpLayer, pumpBaseState);
|
sprite.LayerSetState(basePumpLayer, pumpBaseState);
|
||||||
sprite.LayerSetVisible(basePumpLayer, true);
|
sprite.LayerSetVisible(basePumpLayer, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var pumpEnabledAnimationState = "pumpEnabled";
|
||||||
|
pumpEnabledAnimationState += pumpVisualState.InletDirection.ToString();
|
||||||
|
pumpEnabledAnimationState += ((int) pumpVisualState.InletConduitLayer).ToString();
|
||||||
|
pumpEnabledAnimationState += pumpVisualState.OutletDirection.ToString();
|
||||||
|
pumpEnabledAnimationState += ((int) pumpVisualState.OutletConduitLayer).ToString();
|
||||||
|
|
||||||
|
sprite.LayerMapReserveBlank(Layer.PumpEnabled);
|
||||||
|
var pumpEnabledAnimationLayer = sprite.LayerMapGet(Layer.PumpEnabled);
|
||||||
|
sprite.LayerSetRSI(pumpEnabledAnimationLayer, _pumpRSI);
|
||||||
|
sprite.LayerSetState(pumpEnabledAnimationLayer, pumpEnabledAnimationState);
|
||||||
|
sprite.LayerSetVisible(pumpEnabledAnimationLayer, pumpVisualState.PumpEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum Layer
|
private enum Layer
|
||||||
{
|
{
|
||||||
PumpBase
|
PumpBase,
|
||||||
|
PumpEnabled,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,21 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BasePumpComponent : PipeNetDeviceComponent
|
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>
|
/// <summary>
|
||||||
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="Pipe"/> on this entity.
|
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="Pipe"/> on this entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -67,6 +82,9 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
|
if (!PumpEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
PumpGas(_inletPipe.Air, _outletPipe.Air);
|
PumpGas(_inletPipe.Air, _outletPipe.Air);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +92,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
|
|
||||||
private void UpdateAppearance()
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,15 @@ namespace Content.Shared.GameObjects.Atmos
|
|||||||
public readonly PipeDirection OutletDirection;
|
public readonly PipeDirection OutletDirection;
|
||||||
public readonly ConduitLayer InletConduitLayer;
|
public readonly ConduitLayer InletConduitLayer;
|
||||||
public readonly ConduitLayer OutletConduitLayer;
|
public readonly ConduitLayer OutletConduitLayer;
|
||||||
|
public readonly bool PumpEnabled;
|
||||||
|
|
||||||
public PumpVisualState(PipeDirection inletDirection, PipeDirection outletDirection, ConduitLayer inletConduitLayer, ConduitLayer outletConduitLayer)
|
public PumpVisualState(PipeDirection inletDirection, PipeDirection outletDirection, ConduitLayer inletConduitLayer, ConduitLayer outletConduitLayer, bool pumpEnabled)
|
||||||
{
|
{
|
||||||
InletDirection = inletDirection;
|
InletDirection = inletDirection;
|
||||||
OutletDirection = outletDirection;
|
OutletDirection = outletDirection;
|
||||||
InletConduitLayer = inletConduitLayer;
|
InletConduitLayer = inletConduitLayer;
|
||||||
OutletConduitLayer = outletConduitLayer;
|
OutletConduitLayer = outletConduitLayer;
|
||||||
|
PumpEnabled = pumpEnabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,26 @@
|
|||||||
"name":"pumpWest2East2",
|
"name":"pumpWest2East2",
|
||||||
"directions":1,
|
"directions":1,
|
||||||
"delays":[ [ 1.0 ] ]
|
"delays":[ [ 1.0 ] ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pumpEnabledEast2West2",
|
||||||
|
"directions":1,
|
||||||
|
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pumpEnabledNorth2South2",
|
||||||
|
"directions":1,
|
||||||
|
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pumpEnabledSouth2North2",
|
||||||
|
"directions":1,
|
||||||
|
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pumpEnabledWest2East2",
|
||||||
|
"directions":1,
|
||||||
|
"delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 386 B |
Binary file not shown.
|
After Width: | Height: | Size: 896 B |
Binary file not shown.
|
After Width: | Height: | Size: 823 B |
Binary file not shown.
|
After Width: | Height: | Size: 408 B |
Reference in New Issue
Block a user