using Content.Shared.Vehicle; using Content.Shared.Vehicle.Components; using Robust.Client.GameObjects; namespace Content.Client.Vehicle; public sealed partial class VehicleSystem : SharedVehicleSystem { [Dependency] private SpriteSystem _sprite = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnVehicleAppearanceChange); } private void OnVehicleAppearanceChange(EntityUid uid, VehicleComponent component, ref AppearanceChangeEvent args) { if (args.Sprite == null) return; if (component.HideRider && Appearance.TryGetData(uid, VehicleVisuals.HideRider, out var hide, args.Component) && HasComp(component.LastRider)) _sprite.SetVisible(component.LastRider.Value, !hide); // First check is for the sprite itself if (Appearance.TryGetData(uid, VehicleVisuals.DrawDepth, out var drawDepth, args.Component)) _sprite.SetDrawDepth(uid, drawDepth); // Set vehicle layer to animated or not (i.e. are the wheels turning or not) if (component.AutoAnimate && Appearance.TryGetData(uid, VehicleVisuals.AutoAnimate, out var autoAnimate, args.Component)) _sprite.LayerSetAutoAnimated(uid, VehicleVisualLayers.AutoAnimate, autoAnimate); } } public enum VehicleVisualLayers : byte { /// Layer for the vehicle's wheels AutoAnimate, }