Attacks now re-orients players like interactions so.

This commit is contained in:
Pieter-Jan Briers
2021-01-23 17:50:48 +01:00
parent 85fcf7290c
commit 6635054cac

View File

@@ -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);
}
}
}
/// <summary>
/// We didn't click on any entity, try doing an AfterInteract on the click location
/// </summary>
@@ -850,6 +855,8 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return;
}
ClickFace(player, coordinates);
if (!ActionBlockerSystem.CanAttack(player) ||
(!wideAttack && !player.InRangeUnobstructed(coordinates, ignoreInsideBlocker: true)))
{