Use the melee push pos update timer for rate limiting the pushes

Also lowered the timer since it's limiting actual movement now
This commit is contained in:
Michael Cook (mackal) 2018-03-01 13:41:02 -05:00
parent 8e4aff391e
commit 7edc891605
2 changed files with 3 additions and 5 deletions

View File

@ -3620,16 +3620,14 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
// update NPC stuff
auto new_pos = glm::vec3(m_Position.x + (a->force * std::cos(a->hit_heading) + m_Delta.x),
m_Position.y + (a->force * std::sin(a->hit_heading) + m_Delta.y), m_Position.z);
if (zone->zonemap && zone->zonemap->CheckLoS(glm::vec3(m_Position), new_pos)) { // If we have LoS on the new loc it should be reachable.
if (position_update_melee_push_timer.Check() && zone->zonemap && zone->zonemap->CheckLoS(glm::vec3(m_Position), new_pos)) { // If we have LoS on the new loc it should be reachable.
if (IsNPC()) {
// Is this adequate?
Teleport(new_pos);
if (position_update_melee_push_timer.Check()) {
SendPositionUpdate();
}
}
}
else {
a->force = 0.0f; // we couldn't move there, so lets not
}

View File

@ -115,7 +115,7 @@ Mob::Mob(const char* in_name,
fix_z_timer(300),
fix_z_timer_engaged(100),
attack_anim_timer(1000),
position_update_melee_push_timer(1000),
position_update_melee_push_timer(500),
mHateListCleanup(6000)
{
targeted = 0;