This commit is contained in:
Rane
2022-04-23 21:05:02 -04:00
committed by GitHub
parent 18220b6488
commit 98cd4fdb58
44 changed files with 1160 additions and 15 deletions

View File

@@ -1,8 +1,7 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Buckle.Components;
using Content.Shared.Vehicle.Components;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Buckle
{
@@ -42,6 +41,11 @@ namespace Content.Client.Buckle
return;
}
if (!_entMan.TryGetComponent(Owner, out RiderComponent? rider))
{
return;
}
if (_buckled && buckle.DrawDepth.HasValue)
{
_originalDrawDepth ??= ownerSprite.DrawDepth;

View File

@@ -0,0 +1,32 @@
using Robust.Client.GameObjects;
using Content.Shared.Vehicle;
namespace Content.Client.Vehicle
{
/// <summary>
/// Controls client-side visuals for
/// vehicles
/// </summary>
public sealed class VehicleSystem : VisualizerSystem<VehicleVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, VehicleVisualsComponent component, ref AppearanceChangeEvent args)
{
/// First check is for the sprite itself
if (TryComp(uid, out SpriteComponent? sprite)
&& args.Component.TryGetData(VehicleVisuals.DrawDepth, out int drawDepth) && sprite != null)
{
sprite.DrawDepth = drawDepth;
}
/// Set vehicle layer to animated or not (i.e. are the wheels turning or not)
if (args.Component.TryGetData(VehicleVisuals.AutoAnimate, out bool autoAnimate))
{
sprite?.LayerSetAutoAnimated(VehicleVisualLayers.AutoAnimate, autoAnimate);
}
}
}
}
public enum VehicleVisualLayers : byte
{
/// Layer for the vehicle's wheels
AutoAnimate,
}

View File

@@ -0,0 +1,10 @@
namespace Content.Client.Vehicle;
/// <summary>
/// Controls visuals for vehicles
/// </summary>
[RegisterComponent]
public sealed class VehicleVisualsComponent : Component
{
public int DrawDepth = 0;
}