[10272] Add option for search distance to getHeight() functions and make Creature::FallGround() use VMaps properly.

This finally prevents flying creatures from falling to infinity (basically instantly diappearing) in several instances,
aswell as prevent creatures from falling inside larger solid object around the world.

Default height search is untouched, needs more research on how creature AI etc. will be affected.
This commit is contained in:
Lynx3d 2010-07-26 08:08:36 +02:00
parent 747d1ebdcf
commit 730b4deaaf
10 changed files with 18 additions and 26 deletions

View file

@ -1375,8 +1375,8 @@ bool Creature::FallGround()
if (getDeathState() == DEAD_FALLING)
return false;
// Let's do with no vmap because no way to get far distance with vmap high call
float tz = GetMap()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), false);
// use larger distance for vmap height search than in most other cases
float tz = GetMap()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true, MAX_FALL_DISTANCE);
// Abort too if the ground is very near
if (fabs(GetPositionZ() - tz) < 0.1f)
@ -1815,7 +1815,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
}
SpellAuraHolder *holder = GetSpellAuraHolder(cAura->spell_id, GetGUID());
bool addedToExisting = true;
if (!holder)
{
@ -1834,7 +1834,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
}
else
AddSpellAuraHolder(holder);
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell: %u - Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[EFFECT_INDEX_0],GetGUIDLow(),GetEntry());
}
}
@ -2213,4 +2213,4 @@ void Creature::RelocationNotify()
MaNGOS::CreatureRelocationNotifier relocationNotifier(*this);
float radius = MAX_CREATURE_ATTACK_RADIUS * sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_AGGRO);
Cell::VisitAllObjects(this, relocationNotifier, radius);
}
}