aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Creature
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-11-23 18:12:44 +0100
committerShauren <shauren.trinity@gmail.com>2018-03-08 23:13:51 +0100
commit2baa81065ba27f0a6d278a8dd8a79b7c831e0a2b (patch)
treee8d4960ec63da14aeee2afaed037a64bd5835859 /src/server/game/Entities/Creature
parent2840e096fc42faa80b839f16edaedc977b12bfee (diff)
Core/Movement: Fixed creature hover
Closes #15177
Diffstat (limited to 'src/server/game/Entities/Creature')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 3a061c816bc..9cdef4266d4 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -404,6 +404,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
transport->CalculatePassengerPosition(x, y, z, &o);
}
+ UpdateAllowedPositionZ(x, y, z);
SetHomePosition(x, y, z, o);
GetMap()->CreatureRelocation(this, x, y, z, o);
}
@@ -1096,11 +1097,7 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
}
//! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there
- if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
- {
- //! Relocate again with updated Z coord
- m_positionZ += GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
- }
+ m_positionZ += GetHoverOffset();
LastUsedScriptID = GetScriptId();
@@ -1631,7 +1628,7 @@ bool Creature::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap,
return false;
//We should set first home position, because then AI calls home movement
- SetHomePosition(data->spawnPoint);
+ SetHomePosition(*this);
m_deathState = ALIVE;
@@ -2975,7 +2972,7 @@ void Creature::UpdateMovementFlags()
// Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc)
float ground = GetFloorZ();
- bool isInAir = (G3D::fuzzyGt(GetPositionZMinusOffset(), ground + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZMinusOffset(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
+ bool isInAir = (G3D::fuzzyGt(GetPositionZ(), ground + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
if (GetCreatureTemplate()->InhabitType & INHABIT_AIR && isInAir && !IsFalling())
{