Remove vehicles (#24681)
* Remove wheelchairs Vehicle code is dogwater and wheelchairs just keeps exposing edgecases. If someone wants it brought it back they can do vehicle refactor. * Also this one * Remove vehicles * goodbye vehicles * Remove this check * sasd * Cronch * Add sprites back * jani
This commit is contained in:
@@ -2,7 +2,6 @@ using Content.Client.Rotation;
|
||||
using Content.Shared.Buckle;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Rotation;
|
||||
using Content.Shared.Vehicle.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Buckle;
|
||||
@@ -26,9 +25,6 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
||||
if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
|
||||
return;
|
||||
|
||||
if (HasComp<VehicleComponent>(component.LastEntityBuckledTo))
|
||||
return;
|
||||
|
||||
// Adjust draw depth when the chair faces north so that the seat back is drawn over the player.
|
||||
// Reset the draw depth when rotated in any other direction.
|
||||
// TODO when ECSing, make this a visualizer
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
using Content.Shared.Vehicle;
|
||||
using Content.Shared.Vehicle.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Vehicle;
|
||||
|
||||
public sealed class VehicleSystem : SharedVehicleSystem
|
||||
{
|
||||
[Dependency] private EyeSystem _eye = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RiderComponent, ComponentStartup>(OnRiderStartup);
|
||||
SubscribeLocalEvent<RiderComponent, ComponentShutdown>(OnRiderShutdown);
|
||||
SubscribeLocalEvent<RiderComponent, ComponentHandleState>(OnRiderHandleState);
|
||||
SubscribeLocalEvent<VehicleComponent, AppearanceChangeEvent>(OnVehicleAppearanceChange);
|
||||
}
|
||||
|
||||
private void OnRiderStartup(EntityUid uid, RiderComponent component, ComponentStartup args)
|
||||
{
|
||||
// Center the player's eye on the vehicle
|
||||
if (TryComp(uid, out EyeComponent? eyeComp))
|
||||
{
|
||||
_eye.SetTarget(uid, eyeComp.Target ?? component.Vehicle, eyeComp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRiderShutdown(EntityUid uid, RiderComponent component, ComponentShutdown args)
|
||||
{
|
||||
// reset the riders eye centering.
|
||||
if (TryComp(uid, out EyeComponent? eyeComp))
|
||||
{
|
||||
_eye.SetTarget(uid, null, eyeComp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRiderHandleState(EntityUid uid, RiderComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not RiderComponentState state)
|
||||
return;
|
||||
|
||||
var entity = EnsureEntity<RiderComponent>(state.Entity, uid);
|
||||
|
||||
if (TryComp(uid, out EyeComponent? eyeComp) && eyeComp.Target == component.Vehicle)
|
||||
{
|
||||
_eye.SetTarget(uid, entity, eyeComp);
|
||||
}
|
||||
|
||||
component.Vehicle = entity;
|
||||
}
|
||||
|
||||
private void OnVehicleAppearanceChange(EntityUid uid, VehicleComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
if (component.HideRider
|
||||
&& Appearance.TryGetData<bool>(uid, VehicleVisuals.HideRider, out var hide, args.Component)
|
||||
&& TryComp<SpriteComponent>(component.LastRider, out var riderSprite))
|
||||
riderSprite.Visible = !hide;
|
||||
|
||||
// First check is for the sprite itself
|
||||
if (Appearance.TryGetData<int>(uid, VehicleVisuals.DrawDepth, out var drawDepth, args.Component))
|
||||
args.Sprite.DrawDepth = drawDepth;
|
||||
|
||||
// Set vehicle layer to animated or not (i.e. are the wheels turning or not)
|
||||
if (component.AutoAnimate
|
||||
&& Appearance.TryGetData<bool>(uid, VehicleVisuals.AutoAnimate, out var autoAnimate, args.Component))
|
||||
args.Sprite.LayerSetAutoAnimated(VehicleVisualLayers.AutoAnimate, autoAnimate);
|
||||
}
|
||||
}
|
||||
|
||||
public enum VehicleVisualLayers : byte
|
||||
{
|
||||
/// Layer for the vehicle's wheels
|
||||
AutoAnimate,
|
||||
}
|
||||
Reference in New Issue
Block a user