diff --git a/zone/mob.cpp b/zone/mob.cpp index 938a9704b..0b46c8b12 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1395,19 +1395,23 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) { MakeSpawnUpdate(spu); if (iSendToSelf == 2) { - if (this->IsClient()) - this->CastToClient()->FastQueuePacket(&app,false); + if (IsClient()) { + CastToClient()->FastQueuePacket(&app,false); + } } else { if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount)) { - entity_list.QueueClients(this, app, (iSendToSelf==0), false); + entity_list.QueueClients(this, app, (iSendToSelf == 0), false); move_tic_count = 0; } - else + else if(move_tic_count % 2 == 0) { - entity_list.QueueCloseClients(this, app, (iSendToSelf==0), 800, nullptr, false); + entity_list.QueueCloseClients(this, app, (iSendToSelf == 0), 700, nullptr, false); + move_tic_count++; + } + else { move_tic_count++; } } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 5bf506184..65da797de 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -443,31 +443,10 @@ void NPC::NextGuardPosition() { } } -/* -// we need this for charmed NPCs -void Mob::SaveSpawnSpot() { - spawn_x = x_pos; - spawn_y = y_pos; - spawn_z = z_pos; - spawn_heading = heading; -}*/ - - - - -/*float Mob::CalculateDistanceToNextWaypoint() { - return CalculateDistance(cur_wp_x, cur_wp_y, cur_wp_z); -}*/ - float Mob::CalculateDistance(float x, float y, float z) { return (float)sqrtf( ((m_Position.x-x)*(m_Position.x-x)) + ((m_Position.y-y)*(m_Position.y-y)) + ((m_Position.z-z)*(m_Position.z-z)) ); } -/* -uint8 NPC::CalculateHeadingToNextWaypoint() { - return CalculateHeadingToTarget(cur_wp_x, cur_wp_y); -} -*/ float Mob::CalculateHeadingToTarget(float in_x, float in_y) { float angle; @@ -656,6 +635,11 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo else { tar_vector/=16.0f; + float dur = Timer::SetCurrentTime() - pLastChange; + if(dur < 1.0f) { + dur = 1.0f; + } + tar_vector = (tar_vector * AImovement_duration) / 100.0f; float new_x = m_Position.x + m_TargetV.x*tar_vector; float new_y = m_Position.y + m_TargetV.y*tar_vector; @@ -717,8 +701,6 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo } else { - // force an update now - move_tic_count = RuleI(Zone, NPCPositonUpdateTicCount); SendPosUpdate(); SetAppearance(eaStanding, false); }