2022-07-15 08:46:30 -04:00
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
using Content.Shared.Atmos.Visuals;
|
|
|
|
|
using Content.Client.Power;
|
|
|
|
|
|
2025-05-16 23:29:03 -04:00
|
|
|
namespace Content.Client.Atmos.Visualizers;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Controls client-side visuals for portable scrubbers.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class PortableScrubberSystem : VisualizerSystem<PortableScrubberVisualsComponent>
|
2022-07-15 08:46:30 -04:00
|
|
|
{
|
2025-05-16 23:29:03 -04:00
|
|
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
|
|
|
|
|
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, PortableScrubberVisualsComponent component, ref AppearanceChangeEvent args)
|
2022-07-15 08:46:30 -04:00
|
|
|
{
|
2025-05-16 23:29:03 -04:00
|
|
|
if (args.Sprite == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component)
|
|
|
|
|
&& AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component))
|
|
|
|
|
{
|
|
|
|
|
var runningState = isRunning ? component.RunningState : component.IdleState;
|
|
|
|
|
_sprite.LayerSetRsiState((uid, args.Sprite), PortableScrubberVisualLayers.IsRunning, runningState);
|
|
|
|
|
|
|
|
|
|
var fullState = isFull ? component.FullState : component.ReadyState;
|
|
|
|
|
_sprite.LayerSetRsiState((uid, args.Sprite), PowerDeviceVisualLayers.Powered, fullState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component))
|
2022-07-15 08:46:30 -04:00
|
|
|
{
|
2025-05-16 23:29:03 -04:00
|
|
|
_sprite.LayerSetVisible((uid, args.Sprite), PortableScrubberVisualLayers.IsDraining, isDraining);
|
2022-07-15 08:46:30 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-16 23:29:03 -04:00
|
|
|
|
2022-07-15 08:46:30 -04:00
|
|
|
public enum PortableScrubberVisualLayers : byte
|
|
|
|
|
{
|
|
|
|
|
IsRunning,
|
|
|
|
|
|
|
|
|
|
IsDraining
|
|
|
|
|
}
|