fixed player position updates i think

This commit is contained in:
Tahir Akhlaq 2017-06-07 02:59:27 +01:00
parent dd552ba69d
commit b640c87c69
3 changed files with 64 additions and 36 deletions

View file

@ -540,7 +540,7 @@ namespace FFXIVClassic_Map_Server.Actors
return zoneId;
}
public bool IsFacing(float x, float y, byte checkAngle = 45)
public bool IsFacing(float x, float y)
{
var rot1 = this.rotation;
@ -554,6 +554,26 @@ namespace FFXIVClassic_Map_Server.Actors
return rot1 == (float)dRot;
}
public bool IsFacing(Actor target)
{
if (target == null)
{
Program.Log.Error("[{0}][{1}] IsFacing no target!", actorId, actorName);
return false;
}
var rot1 = this.rotation;
var dX = this.positionX - target.positionX;
var dY = this.positionY - target.positionY;
var rot2 = Math.Atan2(dY, dX);
var dRot = Math.PI - rot2 + Math.PI / 2;
return rot1 == (float)dRot;
}
public void LookAt(Actor actor)
{
if (actor != null)