Fix barstool rotation (#5134)

This commit is contained in:
20kdc
2021-11-02 18:38:47 +00:00
committed by GitHub
parent b86fd5f57d
commit 7ced7b67c7
4 changed files with 83 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ using Content.Shared.Actions;
using Content.Shared.Actions.Components;
using Content.Shared.Actions.Prototypes;
using Content.Shared.Interaction.Events;
using Content.Shared.Interaction;
using Robust.Server.GameObjects;
using Robust.Server.GameStates;
using Robust.Shared.GameObjects;
@@ -186,15 +187,7 @@ namespace Content.Server.Actions
return false;
}
if (!EntitySystem.Get<ActionBlockerSystem>().CanChangeDirection(player)) return true;
// don't set facing unless they clicked far enough away
var diff = targetWorldPos - player.Transform.WorldPosition;
if (diff.LengthSquared > 0.01f)
{
player.Transform.LocalRotation = Angle.FromWorldVec(diff);
}
EntitySystem.Get<RotateToFaceSystem>().TryFaceCoordinates(player, targetWorldPos);
return true;
}
}