mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
Removed all unused variables i could find, built and tested on a simple upstart and clicking trough most systems. Change Loc references to localization. <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p> "using Robust.Shared.Prototypes;" to "" "[dependency] private readonly ISpriteComponent" to "" </p> </details> --- No CL this isn't player facing. --------- Co-authored-by: ilmenwe <no@mail.com>
62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
using Content.Shared._White.Move;
|
|
using Content.Shared.Vehicles;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Graphics;
|
|
|
|
namespace Content.Client.Vehicles;
|
|
|
|
public sealed class VehicleSystem : SharedVehicleSystem
|
|
{
|
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
|
[Dependency] private readonly IEyeManager _eye = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<VehicleComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
|
SubscribeLocalEvent<VehicleComponent, MoveEventProxy>(OnMove); // WD EDIT
|
|
}
|
|
|
|
private void OnAppearanceChange(EntityUid uid, VehicleComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null || !_appearance.TryGetData<bool>(uid, VehicleState.Animated, out bool animated) || !TryComp<SpriteComponent>(uid, out var spriteComp))
|
|
return;
|
|
|
|
SpritePos(uid, comp);
|
|
spriteComp.LayerSetAutoAnimated(0, animated);
|
|
}
|
|
|
|
private void OnMove(EntityUid uid, VehicleComponent component, ref MoveEventProxy args) // WD EDIT
|
|
{
|
|
SpritePos(uid, component);
|
|
}
|
|
|
|
private void SpritePos(EntityUid uid, VehicleComponent comp)
|
|
{
|
|
if (!TryComp<SpriteComponent>(uid, out var spriteComp))
|
|
return;
|
|
|
|
if (!_appearance.TryGetData<bool>(uid, VehicleState.DrawOver, out bool depth))
|
|
return;
|
|
|
|
spriteComp.DrawDepth = (int) Shared.DrawDepth.DrawDepth.Objects;
|
|
|
|
if (comp.RenderOver == VehicleRenderOver.None)
|
|
return;
|
|
|
|
var eye = _eye.CurrentEye;
|
|
Direction vehicleDir = (Transform(uid).LocalRotation + eye.Rotation).GetCardinalDir();
|
|
|
|
VehicleRenderOver renderOver = (VehicleRenderOver) (1 << (int) vehicleDir);
|
|
|
|
if ((comp.RenderOver & renderOver) == renderOver)
|
|
{
|
|
spriteComp.DrawDepth = (int) Shared.DrawDepth.DrawDepth.OverMobs;
|
|
}
|
|
else
|
|
{
|
|
spriteComp.DrawDepth = (int) Shared.DrawDepth.DrawDepth.Objects;
|
|
}
|
|
}
|
|
}
|