mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* First impl. of appearance TryGetData cleanup * Handful of fixes * DamageVisuals: fix HandleDamage call, inheritdoc * bunch of unused AppearanceSystem instances * Handful more unused appearance systems, inheritdoc * JetpackSystem: Ent<T> * cleanup roundup, more Ent<T> * a few lingering AppearanceSystem.TryGetData calls * more lingering AppearanceData access * Remove unnecessary inheritdoc * once again, with feeling
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using Content.Shared.Shuttles.Components;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Shuttles;
|
|
|
|
/// <summary>
|
|
/// Handles making a thruster visibly turn on/emit an exhaust plume according to its state.
|
|
/// </summary>
|
|
public sealed partial class ThrusterSystem : VisualizerSystem<ThrusterComponent>
|
|
{
|
|
/// <summary>
|
|
/// Updates whether or not the thruster is visibly active/thrusting.
|
|
/// </summary>
|
|
protected override void OnAppearanceChange(EntityUid uid, ThrusterComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null
|
|
|| !args.TryGetData<bool>(ThrusterVisualState.State, out var state))
|
|
return;
|
|
|
|
SpriteSystem.LayerSetVisible((uid, args.Sprite), ThrusterVisualLayers.ThrustOn, state);
|
|
SetThrusting(
|
|
uid,
|
|
state && args.TryGetData<bool>(ThrusterVisualState.Thrusting, out var thrusting) && thrusting,
|
|
args.Sprite
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets whether or not the exhaust plume of the thruster is visible or not.
|
|
/// </summary>
|
|
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,
|
|
}
|