Fixes click-facing giving you NaN rotation if you interact with something at the exact same position as you.

This commit is contained in:
Pieter-Jan Briers
2020-05-23 15:33:01 +02:00
parent ae344888d8
commit 0e8bb178f7

View File

@@ -478,8 +478,14 @@ namespace Content.Server.GameObjects.EntitySystems
var item = hands.GetActiveHand?.Owner; var item = hands.GetActiveHand?.Owner;
if(ActionBlockerSystem.CanChangeDirection(player)) if (ActionBlockerSystem.CanChangeDirection(player))
playerTransform.LocalRotation = new Angle(coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position); {
var diff = coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position;
if (diff.LengthSquared > 0.01f)
{
playerTransform.LocalRotation = new Angle(diff);
}
}
if (!ActionBlockerSystem.CanInteract(player)) if (!ActionBlockerSystem.CanInteract(player))
{ {