Fix jetpack assert (#14752)
This commit is contained in:
@@ -75,8 +75,9 @@ namespace Content.Client.Physics.Controllers
|
||||
return;
|
||||
}
|
||||
|
||||
var physicsUid = player;
|
||||
PhysicsComponent? body;
|
||||
TransformComponent? xformMover = xform;
|
||||
var xformMover = xform;
|
||||
|
||||
if (mover.ToParent && HasComp<RelayInputMoverComponent>(xform.ParentUid))
|
||||
{
|
||||
@@ -85,6 +86,8 @@ namespace Content.Client.Physics.Controllers
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
physicsUid = xform.ParentUid;
|
||||
}
|
||||
else if (!TryComp(player, out body))
|
||||
{
|
||||
@@ -128,7 +131,7 @@ namespace Content.Client.Physics.Controllers
|
||||
}
|
||||
|
||||
// Server-side should just be handled on its own so we'll just do this shizznit
|
||||
HandleMobMovement(player, mover, body, xformMover, frameTime, xformQuery, moverQuery, relayTargetQuery);
|
||||
HandleMobMovement(player, mover, physicsUid, body, xformMover, frameTime, xformQuery, moverQuery, relayTargetQuery);
|
||||
}
|
||||
|
||||
protected override bool CanSound()
|
||||
|
||||
@@ -69,6 +69,8 @@ namespace Content.Server.Physics.Controllers
|
||||
foreach (var mover in EntityQuery<InputMoverComponent>(true))
|
||||
{
|
||||
var uid = mover.Owner;
|
||||
EntityUid physicsUid = uid;
|
||||
|
||||
if (relayQuery.HasComponent(uid))
|
||||
continue;
|
||||
|
||||
@@ -87,13 +89,15 @@ namespace Content.Server.Physics.Controllers
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
physicsUid = xform.ParentUid;
|
||||
}
|
||||
else if (!bodyQuery.TryGetComponent(uid, out body))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HandleMobMovement(uid, mover, body, xformMover, frameTime, xformQuery, moverQuery, relayTargetQuery);
|
||||
HandleMobMovement(uid, mover, physicsUid, body, xformMover, frameTime, xformQuery, moverQuery, relayTargetQuery);
|
||||
}
|
||||
|
||||
HandleShuttleMovement(frameTime);
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace Content.Shared.Movement.Systems
|
||||
protected void HandleMobMovement(
|
||||
EntityUid uid,
|
||||
InputMoverComponent mover,
|
||||
EntityUid physicsUid,
|
||||
PhysicsComponent physicsComponent,
|
||||
TransformComponent xform,
|
||||
float frameTime,
|
||||
@@ -230,7 +231,7 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
UsedMobMovement[uid] = true;
|
||||
// Specifically don't use mover.Owner because that may be different to the actual physics body being moved.
|
||||
var weightless = _gravity.IsWeightless(uid, physicsComponent, xform);
|
||||
var weightless = _gravity.IsWeightless(physicsUid, physicsComponent, xform);
|
||||
var (walkDir, sprintDir) = GetVelocityInput(mover);
|
||||
var touching = false;
|
||||
|
||||
@@ -336,10 +337,10 @@ namespace Content.Shared.Movement.Systems
|
||||
if (!weightless || touching)
|
||||
Accelerate(ref velocity, in worldTotal, accel, frameTime);
|
||||
|
||||
PhysicsSystem.SetLinearVelocity(uid, velocity, body: physicsComponent);
|
||||
PhysicsSystem.SetLinearVelocity(physicsUid, velocity, body: physicsComponent);
|
||||
|
||||
// Ensures that players do not spiiiiiiin
|
||||
PhysicsSystem.SetAngularVelocity(uid, 0, body: physicsComponent);
|
||||
PhysicsSystem.SetAngularVelocity(physicsUid, 0, body: physicsComponent);
|
||||
}
|
||||
|
||||
private void Friction(float minimumFrictionSpeed, float frameTime, float friction, ref Vector2 velocity)
|
||||
|
||||
Reference in New Issue
Block a user