Partial: Core/Entities: Reduce the probability of units dropping under the map
Port From (https://github.com/TrinityCore/TrinityCore/commit/69edf282fa777912385dbb4d921b9f3a8f92a00e)
This commit is contained in:
@@ -2115,7 +2115,7 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
float ground_z = GetMapHeight(x, y, z);
|
||||
if (z < ground_z)
|
||||
if (MathF.Abs(z - ground_z) < GetCollisionHeight())
|
||||
z = ground_z;
|
||||
}
|
||||
break;
|
||||
@@ -2138,7 +2138,7 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
float ground_z = GetMapHeight(x, y, z);
|
||||
if (z < ground_z)
|
||||
if (MathF.Abs(z - ground_z) < GetCollisionHeight())
|
||||
z = ground_z;
|
||||
}
|
||||
break;
|
||||
@@ -2464,8 +2464,6 @@ namespace Game.Entities
|
||||
jump.Reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public struct TransportInfo
|
||||
{
|
||||
public void Reset()
|
||||
|
||||
@@ -977,6 +977,7 @@ namespace Game.Movement
|
||||
Detour.dtNavMesh _navMesh;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum PathType
|
||||
{
|
||||
Blank = 0x00, // path not built yet
|
||||
|
||||
@@ -882,6 +882,32 @@ namespace Game.Spells
|
||||
dest = new SpellDestination(x, y, liquidLevel, m_caster.GetOrientation());
|
||||
break;
|
||||
}
|
||||
case Targets.DestCasterFrontLeap:
|
||||
{
|
||||
float dist = m_spellInfo.GetEffect(effIndex).CalcRadius(m_caster);
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
|
||||
Position pos = new(dest.Position);
|
||||
|
||||
m_caster.MovePositionToFirstCollision(pos, dist, angle);
|
||||
// Generate path to that point.
|
||||
if (m_preGeneratedPath == null)
|
||||
m_preGeneratedPath = new(m_caster);
|
||||
|
||||
m_preGeneratedPath.SetPathLengthLimit(dist);
|
||||
|
||||
// Should we use straightline here ? What do we do when we don't have a full path ?
|
||||
bool pathResult = m_preGeneratedPath.CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false, true);
|
||||
if (pathResult && m_preGeneratedPath.GetPathType().HasFlag(PathType.Normal | PathType.Shortcut))
|
||||
{
|
||||
pos.posX = m_preGeneratedPath.GetActualEndPosition().X;
|
||||
pos.posY = m_preGeneratedPath.GetActualEndPosition().Y;
|
||||
pos.posZ = m_preGeneratedPath.GetActualEndPosition().Z;
|
||||
}
|
||||
|
||||
dest.Relocate(pos);
|
||||
break;
|
||||
}
|
||||
case Targets.DestCasterGround:
|
||||
m_caster.UpdateAllowedPositionZ(dest.Position.GetPositionX(), dest.Position.GetPositionY(), ref dest.Position.posZ);
|
||||
break;
|
||||
@@ -6113,7 +6139,8 @@ namespace Game.Spells
|
||||
totems -= 1;
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
totems -= 1;
|
||||
}
|
||||
if (totems != 0)
|
||||
|
||||
@@ -3722,7 +3722,6 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Position pos = destTarget.GetPosition();
|
||||
pos = unitTarget.GetFirstCollisionPosition(unitTarget.GetDistance(pos.posX, pos.posY, pos.posZ + 2.0f), 0.0f);
|
||||
unitTarget.NearTeleportTo(pos.posX, pos.posY, pos.posZ, pos.Orientation, unitTarget == m_caster);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user