diff options
| author | Ovahlord <dreadkiller@gmx.de> | 2024-02-29 14:43:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-29 14:43:37 +0100 |
| commit | c541eda54d7e0dddeec329a6beac2948e0b0a40b (patch) | |
| tree | 90bead53d03937a1c55f4c12cd7f370a8ca13d8d /src/server/game/Entities/Object | |
| parent | 792a4d6c8bab4a8e874c6f0e583f915d05b8d8b3 (diff) | |
Core/Creatures: implemented most movement related static flags and migrated existing movement data into static flags (#29541)
* implemented CREATURE_STATIC_FLAG_AQUATIC - creatures cannot leave liquids
* implemented CREATURE_STATIC_FLAG_AMPHIBIOUS - creatures can enter and leave liquids but remain on the ocean floor when swimming is not enabled until engaged
* implemented CREATURE_STATIC_FLAG_FLOATING - creatures have their gravity on spawn / reset disabled
* implemented CREATURE_STATIC_FLAG_SESSILE - creatures are rooted in place
* implemented CREATURE_STATIC_FLAG_CAN_SWIM - creature can swim in liquids
* implemented CREATURE_STATIC_FLAG_3_CANNOT_SWIM - Amphibious creatures cannot toggle on swimming
* implemented CREATURE_STATIC_FLAG_3_CANNOT_TURN - Creatures cannot turn at all
* implemented CREATURE_STATIC_FLAG_4_PREVENT_SWIM - Amphibious creatures won't toggle on swimming until their victim starts leaving the ocean floor
* partially implemented CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER
* deprecated CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE as this flag was a hackfix to a wrong implementation that is now gone
Diffstat (limited to 'src/server/game/Entities/Object')
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index fa9ed374883..4cd114f170d 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -3741,9 +3741,17 @@ float WorldObject::GetFloorZ() const float WorldObject::GetMapWaterOrGroundLevel(float x, float y, float z, float* ground/* = nullptr*/) const { - return GetMap()->GetWaterOrGroundLevel(GetPhaseShift(), x, y, z, ground, - isType(TYPEMASK_UNIT) ? !static_cast<Unit const*>(this)->HasAuraType(SPELL_AURA_WATER_WALK) : false, - GetCollisionHeight()); + bool swimming = [&]() + { + if (Creature const* creature = ToCreature()) + return (!creature->CannotPenetrateWater() && !creature->HasAuraType(SPELL_AURA_WATER_WALK)); + else if (Unit const* unit = ToUnit()) + return !unit->HasAuraType(SPELL_AURA_WATER_WALK); + + return true; + }(); + + return GetMap()->GetWaterOrGroundLevel(GetPhaseShift(), x, y, z, ground, swimming, GetCollisionHeight()); } float WorldObject::GetMapHeight(float x, float y, float z, bool vmap/* = true*/, float distanceToSearch/* = DEFAULT_HEIGHT_SEARCH*/) const |
