Core/Movement: ported most movement updates from master branch and corrected behavior of CREATURE_STATIC_FLAG_4_PREVENT_SWIM
This commit is contained in:
1 parent
83958342d9
commit
2953efb7a3
22 files changed
+306
-314
No files matched your search
@@ -2940,10 +2940,23 @@ bool Unit::isInBackInMap(Unit const* target, float distance, float arc) const
|
||||
|
||||
bool Unit::isInAccessiblePlaceFor(Creature const* c) const
|
||||
{
|
||||
if (IsInWater())
|
||||
return c->CanEnterWater();
|
||||
else
|
||||
return c->CanWalk() || c->CanFly();
|
||||
// Aquatic creatures are not allowed to leave liquids
|
||||
if (!IsInWater() && c->IsAquatic())
|
||||
return false;
|
||||
|
||||
// Underwater special case. Some creatures may not go below liquid surfaces
|
||||
if (IsUnderWater() && c->CannotPenetrateWater())
|
||||
return false;
|
||||
|
||||
// Water checks
|
||||
if (IsInWater() && !c->CanEnterWater())
|
||||
return false;
|
||||
|
||||
// Some creatures are tied to the ocean floor and cannot chase swimming targets.
|
||||
if (!IsOnOceanFloor() && c->IsUnderWater() && c->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CANT_SWIM))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Unit::IsInWater() const
|
||||
@@ -2956,6 +2969,11 @@ bool Unit::IsUnderWater() const
|
||||
return GetLiquidStatus() & LIQUID_MAP_UNDER_WATER;
|
||||
}
|
||||
|
||||
bool Unit::IsOnOceanFloor() const
|
||||
{
|
||||
return GetLiquidStatus() & LIQUID_MAP_OCEAN_FLOOR;
|
||||
}
|
||||
|
||||
void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data)
|
||||
{
|
||||
ZLiquidStatus oldLiquidStatus = GetLiquidStatus();
|
||||
@@ -8673,6 +8691,10 @@ void Unit::UpdatePetCombatState()
|
||||
{
|
||||
ASSERT(!IsPet()); // player pets do not use UNIT_FLAG_PET_IN_COMBAT for this purpose - but player pets should also never have minions of their own to call this
|
||||
|
||||
// UNIT_FLAG_PET_IN_COMBAT is set by default when the summoner is in combat by himself
|
||||
if (IsInCombat())
|
||||
return;
|
||||
|
||||
bool state = false;
|
||||
for (Unit* minion : m_Controlled)
|
||||
if (minion->IsInCombat())
|
||||
@@ -11325,7 +11347,7 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
SetStunned(false);
|
||||
break;
|
||||
case UNIT_STATE_ROOT:
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle() || (ToCreature() && ToCreature()->GetMovementTemplate().IsRooted()))
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle() || (IsCreature() && ToCreature()->IsSessile()))
|
||||
return;
|
||||
|
||||
ClearUnitState(state);
|
||||
@@ -12972,15 +12994,15 @@ bool Unit::IsFalling() const
|
||||
bool Unit::CanSwim() const
|
||||
{
|
||||
// Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CANNOT_SWIM))
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CANT_SWIM))
|
||||
return false;
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) // is player
|
||||
return true;
|
||||
if (HasFlag(UNIT_FIELD_FLAGS_2, 0x1000000))
|
||||
if (HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_AI_WILL_ONLY_SWIM_IF_TARGET_SWIMS))
|
||||
return false;
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT))
|
||||
return true;
|
||||
return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME | UNIT_FLAG_SWIMMING);
|
||||
return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME | UNIT_FLAG_CAN_SWIM);
|
||||
}
|
||||
|
||||
void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
|
||||
|
||||
Reference in new issue
Block a user