Core/SmartScripts: Fixes repeating events to soon when using waypoints

This commit is contained in:
hondacrx
2018-01-11 14:20:05 -05:00
parent 79980e3dd2
commit 3d60861d29
2 changed files with 9 additions and 5 deletions
+8 -4
View File
@@ -340,15 +340,19 @@ namespace Game.AI
if (mWPReached)//reached WP if (mWPReached)//reached WP
{ {
mWPReached = false; mWPReached = false;
SmartPath wp = GetNextWayPoint();
if (mCurrentWPID == GetWPCount()) if (mCurrentWPID == GetWPCount())
{ {
EndPath(); EndPath();
} }
else if (wp != null) else
{ {
SetRun(mRun); SmartPath wp = GetNextWayPoint();
me.GetMotionMaster().MovePoint(wp.id, wp.x, wp.y, wp.z); if (wp != null)
{
SetRun(mRun);
me.GetMotionMaster().MovePoint(wp.id, wp.x, wp.y, wp.z);
}
} }
} }
} }
+1 -1
View File
@@ -1473,7 +1473,7 @@ namespace Game.AI
break; break;
List<WorldObject> targets = GetTargets(e, unit); List<WorldObject> targets = GetTargets(e, unit);
if (e.GetTargetType() == SmartTargets.Self) if (e.GetTargetType() == SmartTargets.Self)
me.SetFacingTo(me.GetHomePosition().GetOrientation()); me.SetFacingTo((me.GetTransport() ? me.GetTransportHomePosition() : me.GetHomePosition()).GetOrientation());
else if (e.GetTargetType() == SmartTargets.Position) else if (e.GetTargetType() == SmartTargets.Position)
me.SetFacingTo(e.Target.o); me.SetFacingTo(e.Target.o);
else if (!targets.Empty()) else if (!targets.Empty())