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

View File

@ -1,5 +1,12 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 7/1/2017 ==
Akkadius: Resolve issues with NPC's hopping to the ceiling in small corridors
Akkadius: Improved grounding issues with NPC's during combat
Akkadius: 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
== 6/28/2017 ==
Akkadius: Fixed issues with Z correctness when NPCs are pathing on normal grids
Akkadius: Fixed issues with Z correctness when NPCs are engaged with players following

View File

@ -492,6 +492,7 @@ public:
inline const float GetTarVZ() const { return m_TargetV.z; }
inline const float GetTarVector() const { return tar_vector; }
inline const uint8 GetTarNDX() const { return tar_ndx; }
inline const int8 GetFlyMode() const { return flymode; }
bool IsBoat() const;
//Group

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);

View File

@ -879,8 +879,8 @@ void Mob::FixZ() {
if (!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
{
float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 10);
/* Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors */
float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 5);
auto duration = timer.elapsed();