From 6635054cacdf3399c1198161c21debeb80e314f9 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 23 Jan 2021 17:50:48 +0100 Subject: [PATCH] Attacks now re-orients players like interactions so. --- .../EntitySystems/Click/InteractionSystem.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index dde99dbddd..552d3c43c5 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -315,14 +315,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click var item = hands.GetActiveHand?.Owner; - if (ActionBlockerSystem.CanChangeDirection(player)) - { - var diff = coordinates.ToMapPos(EntityManager) - playerTransform.MapPosition.Position; - if (diff.LengthSquared > 0.01f) - { - playerTransform.LocalRotation = new Angle(diff); - } - } + ClickFace(player, coordinates); if (!ActionBlockerSystem.CanInteract(player)) { @@ -399,6 +392,18 @@ namespace Content.Server.GameObjects.EntitySystems.Click } } + private void ClickFace(IEntity player, EntityCoordinates coordinates) + { + if (ActionBlockerSystem.CanChangeDirection(player)) + { + var diff = coordinates.ToMapPos(EntityManager) - player.Transform.MapPosition.Position; + if (diff.LengthSquared > 0.01f) + { + player.Transform.LocalRotation = new Angle(diff); + } + } + } + /// /// We didn't click on any entity, try doing an AfterInteract on the click location /// @@ -850,6 +855,8 @@ namespace Content.Server.GameObjects.EntitySystems.Click return; } + ClickFace(player, coordinates); + if (!ActionBlockerSystem.CanAttack(player) || (!wideAttack && !player.InRangeUnobstructed(coordinates, ignoreInsideBlocker: true))) {