Resolve issues with NPC's hopping to the ceiling in small corridors

Improved grounding issues with NPC's during combat
Improved scenarios where NPC's need to be dragged out of the ground - they should correct themselves far more consistently
	- Scenarios where an NPC is coming up from the bottom floor, or from the top floor, they will correct much better
	- A video of these tests can be found here: https://www.youtube.com/watch?v=HtC7bVNM7ZQ&feature=youtu.be
This commit is contained in:
Akkadius
2017-07-01 15:57:41 -05:00
parent 1f39a0cb3e
commit c3c60b331a
4 changed files with 19 additions and 4 deletions
+9 -2
View File
@@ -998,9 +998,16 @@ void Mob::AI_Process() {
/* Fix Z when following during pull, not when engaged and stationary */
if (moving && fix_z_timer_engaged.Check())
if(this->GetTarget())
if(DistanceNoZ(this->GetPosition(), this->GetTarget()->GetPosition()) > 50)
if (this->GetTarget()) {
/* If we are engaged, moving and following client, let's look for best Z more often */
if (DistanceNoZ(this->GetPosition(), this->GetTarget()->GetPosition()) > 50) {
this->FixZ();
}
/* If we are close to client and our Z differences aren't big, match the client */
else if (std::abs(this->GetZ() - this->GetTarget()->GetZ()) < 20){
this->m_Position.z = this->GetTarget()->GetZ();
}
}
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
SendAddPlayerState(PlayerState::Aggressive);