mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
smoother NPC pathing. (credit to Haynar from EQMacEmu)
This commit is contained in:
+14
-3
@@ -394,6 +394,7 @@ void NPC::SetWaypointPause()
|
||||
|
||||
if (cur_wp_pause == 0) {
|
||||
AIwalking_timer->Start(100);
|
||||
AIwalking_timer->Trigger();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -514,7 +515,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
return true;
|
||||
}
|
||||
|
||||
bool send_update = false;
|
||||
int compare_steps = IsBoat() ? 1 : 20;
|
||||
|
||||
if(tar_ndx < compare_steps && m_TargetLocation.x==x && m_TargetLocation.y==y) {
|
||||
|
||||
float new_x = m_Position.x + m_TargetV.x*tar_vector;
|
||||
@@ -637,13 +640,14 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
m_Position.y = y;
|
||||
m_Position.z = z;
|
||||
|
||||
tar_ndx = 20;
|
||||
Log.Out(Logs::Detail, Logs::AI, "Only a single step to get there... jumping.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
tar_vector/=20;
|
||||
tar_vector/=20.0f;
|
||||
|
||||
float new_x = m_Position.x + m_TargetV.x*tar_vector;
|
||||
float new_y = m_Position.y + m_TargetV.y*tar_vector;
|
||||
@@ -699,12 +703,19 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
m_Delta = glm::vec4(m_Position.x - nx, m_Position.y - ny, m_Position.z - nz, 0.0f);
|
||||
|
||||
if (IsClient())
|
||||
{
|
||||
SendPosUpdate(1);
|
||||
CastToClient()->ResetPositionTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
// force an update now
|
||||
move_tic_count = RuleI(Zone, NPCPositonUpdateTicCount);
|
||||
SendPosUpdate();
|
||||
|
||||
SetAppearance(eaStanding, false);
|
||||
SetAppearance(eaStanding, false);
|
||||
}
|
||||
pLastChange = Timer::GetCurrentTime();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user