Skip to content

Commit

Permalink
Adding the clamp back in
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Apr 29, 2024
1 parent 3374757 commit 3dc71fb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,17 @@ public void ExperiencePressureDifference(
AddMovedByPressure(uid, component, physics);
// Grid-rotation adjusted direction
var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec();
var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass;

// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
if (throwTarget != EntityCoordinates.Invalid)
{
var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized();
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
_physics.ApplyLinearImpulse(uid, pos * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics);
}
else
{
_physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics);
_physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics);
}

component.LastHighPressureMovementAirCycle = cycle;
Expand Down

0 comments on commit 3dc71fb

Please sign in to comment.