Content changes for engine RotateEvent removal PR (#11448)

This commit is contained in:
Leon Friedrich
2022-09-23 15:57:30 +12:00
committed by GitHub
parent caa5efcd6f
commit e5f968a7fb
10 changed files with 30 additions and 26 deletions

View File

@@ -17,7 +17,7 @@ namespace Content.Shared.Buckle
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedStrapComponent, RotateEvent>(OnStrapRotate);
SubscribeLocalEvent<SharedStrapComponent, MoveEvent>(OnStrapRotate);
SubscribeLocalEvent<SharedBuckleComponent, PreventCollideEvent>(PreventCollision);
SubscribeLocalEvent<SharedBuckleComponent, DownAttemptEvent>(HandleDown);
@@ -27,12 +27,13 @@ namespace Content.Shared.Buckle
SubscribeLocalEvent<SharedBuckleComponent, ChangeDirectionAttemptEvent>(OnBuckleChangeDirectionAttempt);
}
private void OnStrapRotate(EntityUid uid, SharedStrapComponent component, ref RotateEvent args)
private void OnStrapRotate(EntityUid uid, SharedStrapComponent component, ref MoveEvent args)
{
// TODO: This looks dirty af.
// On rotation of a strap, reattach all buckled entities.
// This fixes buckle offsets and draw depths.
// This is mega cursed. Please somebody save me from Mr Buckle's wild ride.
// Oh god I'm back here again. Send help.
// Consider a chair that has a player strapped to it. Then the client receives a new server state, showing
// that the player entity has moved elsewhere, and the chair has rotated. If the client applies the player
@@ -43,7 +44,7 @@ namespace Content.Shared.Buckle
// One option is to just never trigger re-buckles during state application.
// another is to.. just not do this? Like wtf is this code. But I CBF with buckle atm.
if (GameTiming.ApplyingState)
if (GameTiming.ApplyingState || args.NewRotation == args.OldRotation)
return;
foreach (var buckledEntity in component.BuckledEntities)

View File

@@ -28,7 +28,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem
SubscribeLocalEvent<RiderComponent, PullAttemptEvent>(OnRiderPull);
SubscribeLocalEvent<VehicleComponent, RefreshMovementSpeedModifiersEvent>(OnVehicleModifier);
SubscribeLocalEvent<VehicleComponent, ComponentStartup>(OnVehicleStartup);
SubscribeLocalEvent<VehicleComponent, RotateEvent>(OnVehicleRotate);
SubscribeLocalEvent<VehicleComponent, MoveEvent>(OnVehicleRotate);
}
@@ -47,8 +47,11 @@ public abstract partial class SharedVehicleSystem : EntitySystem
}
// TODO: Shitcode, needs to use sprites instead of actual offsets.
private void OnVehicleRotate(EntityUid uid, VehicleComponent component, ref RotateEvent args)
private void OnVehicleRotate(EntityUid uid, VehicleComponent component, ref MoveEvent args)
{
if (args.NewRotation == args.OldRotation)
return;
// This first check is just for safety
if (!HasComp<InputMoverComponent>(uid))
{