1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-23 13:17:45 +00:00

fixed LookAt and IsFacing (<3 u devi)

This commit is contained in:
Tahir Akhlaq 2017-06-06 02:04:33 +01:00
parent d72a2af641
commit 4ad37f1011

View file

@ -151,6 +151,10 @@ namespace FFXIVClassic_Map_Server.Actors
positionX = pos.X; positionX = pos.X;
positionY = pos.Y; positionY = pos.Y;
positionZ = pos.Z; positionZ = pos.Z;
if (target != null)
LookAt(target);
//Program.Server.GetInstance().mLuaEngine.OnPath(actor, position, positionUpdates) //Program.Server.GetInstance().mLuaEngine.OnPath(actor, position, positionUpdates)
} }
lastMoveUpdate = DateTime.Now; lastMoveUpdate = DateTime.Now;
@ -400,10 +404,9 @@ namespace FFXIVClassic_Map_Server.Actors
hasMoved = true; hasMoved = true;
} }
else if (target != null)
if (target != null)
{ {
// todo: actually make IsFacing work
if(!IsFacing(target.positionX, target.positionY))
LookAt(target); LookAt(target);
} }
} }
@ -605,8 +608,7 @@ namespace FFXIVClassic_Map_Server.Actors
var dRot = Math.PI - rot2 + Math.PI / 2; var dRot = Math.PI - rot2 + Math.PI / 2;
Program.Log.Error("IsFacing Rotation {0} Rotation2 {1}", rot1, rot2); return rot1 == (float)dRot;
return rot1 == rot2;
} }
public void LookAt(Actor actor) public void LookAt(Actor actor)
@ -632,10 +634,11 @@ namespace FFXIVClassic_Map_Server.Actors
var dRot = Math.PI - rot2 + Math.PI / 2; var dRot = Math.PI - rot2 + Math.PI / 2;
Program.Log.Error("LookAt Rotation {0} Rotation2 {1}", rot1, rot2); // pending move, dont need to unset it
if (!hasMoved)
hasMoved = rot1 != (float)dRot;
this.hasMoved = rot2 != rot1; rotation = (float)dRot;
this.rotation = (float)dRot;
} }
public void PathTo(float x, float y, float z, float stepSize = 0.70f, int maxPath = 40) public void PathTo(float x, float y, float z, float stepSize = 0.70f, int maxPath = 40)