2022-05-04 14:21:39 -04:00
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
using Content.Shared.Vehicle;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Vehicle
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Controls client-side visuals for
|
|
|
|
|
/// vehicles
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class VehicleVisualsSystem : VisualizerSystem<VehicleVisualsComponent>
|
|
|
|
|
{
|
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, VehicleVisualsComponent component, ref AppearanceChangeEvent args)
|
|
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
if (args.Sprite == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-07-16 13:51:52 +10:00
|
|
|
// First check is for the sprite itself
|
2022-05-16 14:41:23 +10:00
|
|
|
if (args.Component.TryGetData(VehicleVisuals.DrawDepth, out int drawDepth))
|
2022-05-04 14:21:39 -04:00
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
args.Sprite.DrawDepth = drawDepth;
|
2022-05-04 14:21:39 -04:00
|
|
|
}
|
2022-07-16 13:51:52 +10:00
|
|
|
|
|
|
|
|
// Set vehicle layer to animated or not (i.e. are the wheels turning or not)
|
2022-05-04 14:21:39 -04:00
|
|
|
if (args.Component.TryGetData(VehicleVisuals.AutoAnimate, out bool autoAnimate))
|
|
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
args.Sprite.LayerSetAutoAnimated(VehicleVisualLayers.AutoAnimate, autoAnimate);
|
2022-05-04 14:21:39 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public enum VehicleVisualLayers : byte
|
|
|
|
|
{
|
|
|
|
|
/// Layer for the vehicle's wheels
|
|
|
|
|
AutoAnimate,
|
|
|
|
|
}
|