From 0e8bb178f750f1a147492ba40c985fc15b0a408f Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 23 May 2020 15:33:01 +0200 Subject: [PATCH] Fixes click-facing giving you NaN rotation if you interact with something at the exact same position as you. --- .../EntitySystems/Click/InteractionSystem.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index f4530fbf1a..a123560120 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -478,8 +478,14 @@ namespace Content.Server.GameObjects.EntitySystems var item = hands.GetActiveHand?.Owner; - if(ActionBlockerSystem.CanChangeDirection(player)) - playerTransform.LocalRotation = new Angle(coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position); + if (ActionBlockerSystem.CanChangeDirection(player)) + { + var diff = coordinates.ToMapPos(_mapManager) - playerTransform.MapPosition.Position; + if (diff.LengthSquared > 0.01f) + { + playerTransform.LocalRotation = new Angle(diff); + } + } if (!ActionBlockerSystem.CanInteract(player)) {