using Content.Shared.Shuttles.Components; using Robust.Client.GameObjects; namespace Content.Client.Shuttles; /// /// Handles making a thruster visibly turn on/emit an exhaust plume according to its state. /// public sealed partial class ThrusterSystem : VisualizerSystem { /// /// Updates whether or not the thruster is visibly active/thrusting. /// protected override void OnAppearanceChange(EntityUid uid, ThrusterComponent comp, ref AppearanceChangeEvent args) { if (args.Sprite == null || !args.TryGetData(ThrusterVisualState.State, out var state)) return; SpriteSystem.LayerSetVisible((uid, args.Sprite), ThrusterVisualLayers.ThrustOn, state); SetThrusting( uid, state && args.TryGetData(ThrusterVisualState.Thrusting, out var thrusting) && thrusting, args.Sprite ); } /// /// Sets whether or not the exhaust plume of the thruster is visible or not. /// private void SetThrusting(EntityUid uid, bool value, SpriteComponent sprite) { if (SpriteSystem.LayerMapTryGet((uid, sprite), ThrusterVisualLayers.Thrusting, out var thrustingLayer, false)) SpriteSystem.LayerSetVisible((uid, sprite), thrustingLayer, value); if (SpriteSystem.LayerMapTryGet((uid, sprite), ThrusterVisualLayers.ThrustingUnshaded, out var unshadedLayer, false)) SpriteSystem.LayerSetVisible((uid, sprite), unshadedLayer, value); } } public enum ThrusterVisualLayers : byte { Base, ThrustOn, Thrusting, ThrustingUnshaded, }