From 49089f75374f552bf6c860b567810b96ee403a91 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 8 Mar 2018 12:57:40 -0500 Subject: [PATCH] Revert changes to melee push until the generic push processing is better --- zone/attack.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 26121134e..90a774550 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3622,10 +3622,24 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const a->force = 0.0f; // 2013 change that disabled NPC vs NPC push else a->force *= 0.10f; // force against NPCs is divided by 10 I guess? ex bash is 0.3, parsed 0.03 against an NPC - if (ForcedMovement == 0 && a->force != 0.0f && position_update_melee_push_timer.Check()) { - m_Delta.x += a->force * g_Math.FastSin(a->hit_heading); - m_Delta.y += a->force * g_Math.FastCos(a->hit_heading); - ForcedMovement = 3; + } + // update NPC stuff + if (a->force != 0.0f) { + auto new_pos = glm::vec3( + m_Position.x + (a->force * g_Math.FastSin(a->hit_heading) + m_Delta.x), + m_Position.y + (a->force * g_Math.FastCos(a->hit_heading) + m_Delta.y), m_Position.z); + if ((!IsNPC() || 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); + SendPositionUpdate(); + } + } else { + a->force = 0.0f; // we couldn't move there, so lets not } } }