Core/Entities: Account for creatures that are spawned below ground level when adding flying flags. (Triggers, mostly)
This commit is contained in:
@@ -437,7 +437,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
|
||||
float ground = GetPositionZ();
|
||||
GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground);
|
||||
|
||||
bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground);
|
||||
bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZ(), ground - 0.05f); // Can be underground too, prevent the falling
|
||||
|
||||
if (cInfo->InhabitType & INHABIT_AIR && cInfo->InhabitType & INHABIT_GROUND && isInAir)
|
||||
SetCanFly(true);
|
||||
@@ -482,7 +482,7 @@ void Creature::Update(uint32 diff)
|
||||
float ground = GetPositionZ();
|
||||
GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground);
|
||||
|
||||
bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f);
|
||||
bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZ(), ground - 0.05f); // Can be underground too, prevent the falling
|
||||
CreatureTemplate const* cinfo = GetCreatureTemplate();
|
||||
|
||||
if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND && isInAir)
|
||||
@@ -1574,7 +1574,7 @@ void Creature::setDeathState(DeathState s)
|
||||
float ground = GetPositionZ();
|
||||
GetMap()->GetWaterOrGroundLevel(GetPositionX(), GetPositionY(), GetPositionZ(), &ground);
|
||||
|
||||
bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground);
|
||||
bool isInAir = G3D::fuzzyGt(GetPositionZ(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZ(), ground - 0.05f); // Can be underground too, prevent the falling
|
||||
|
||||
if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND && isInAir)
|
||||
SetCanFly(true);
|
||||
|
||||
Reference in New Issue
Block a user