Core/Creatures: implemented most movement related static flags and migrated existing movement data into static flags
* 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 Port From (https://github.com/TrinityCore/TrinityCore/commit/c541eda54d7e0dddeec329a6beac2948e0b0a40b)
This commit is contained in:
@@ -750,7 +750,7 @@ namespace Game.Entities
|
||||
SendMessageToSet(packet, true);
|
||||
}
|
||||
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().IsTemplateRooted())
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root))
|
||||
{
|
||||
if (IsGravityDisabled())
|
||||
SetAnimTier(AnimTier.Fly);
|
||||
@@ -1138,7 +1138,7 @@ namespace Game.Entities
|
||||
SendMessageToSet(packet, true);
|
||||
}
|
||||
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().IsTemplateRooted())
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root))
|
||||
{
|
||||
if (IsGravityDisabled())
|
||||
SetAnimTier(AnimTier.Fly);
|
||||
@@ -1186,12 +1186,25 @@ namespace Game.Entities
|
||||
{
|
||||
return IsWithinDistInMap(target, distance) && !HasInArc(MathFunctions.TwoPi - arc, target);
|
||||
}
|
||||
public bool IsInAccessiblePlaceFor(Creature c)
|
||||
public bool IsInAccessiblePlaceFor(Creature creature)
|
||||
{
|
||||
if (IsInWater())
|
||||
return c.CanEnterWater();
|
||||
else
|
||||
return c.CanWalk() || c.CanFly();
|
||||
// Aquatic creatures are not allowed to leave liquids
|
||||
if (!IsInWater() && creature.IsAquatic())
|
||||
return false;
|
||||
|
||||
// Underwater special case. Some creatures may not go below liquid surfaces
|
||||
if (IsUnderWater() && creature.CannotPenetrateWater())
|
||||
return false;
|
||||
|
||||
// Water checks
|
||||
if (IsInWater() && !creature.CanEnterWater())
|
||||
return false;
|
||||
|
||||
// Some creatures are tied to the ocean floor and cannot chase swimming targets.
|
||||
if (!IsOnOceanFloor() && creature.IsUnderWater() && creature.HasUnitFlag(UnitFlags.CantSwim))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false) { NearTeleportTo(new Position(x, y, z, orientation), casting); }
|
||||
@@ -1274,7 +1287,7 @@ namespace Game.Entities
|
||||
SetStunned(false);
|
||||
break;
|
||||
case UnitState.Root:
|
||||
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2) || HasAuraType(AuraType.ModRootDisableGravity) || GetVehicle() != null || (IsCreature() && ToCreature().IsTemplateRooted()))
|
||||
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2) || HasAuraType(AuraType.ModRootDisableGravity) || GetVehicle() != null || (IsCreature() && ToCreature().IsSessile()))
|
||||
return;
|
||||
|
||||
ClearUnitState(state);
|
||||
|
||||
Reference in New Issue
Block a user