Core/Entities: Phasing rewrite
This commit is contained in:
@@ -117,7 +117,7 @@ namespace Game.Movement
|
||||
// Limit height change
|
||||
float distanceZ = (float)(RandomHelper.NextDouble() * travelDistZ / 2.0f);
|
||||
destZ = respZ + distanceZ;
|
||||
float levelZ = map.GetWaterOrGroundLevel(creature.GetPhases(), destX, destY, destZ - 2.5f);
|
||||
float levelZ = map.GetWaterOrGroundLevel(creature.GetPhaseShift(), destX, destY, destZ - 2.5f);
|
||||
|
||||
// Problem here, we must fly above the ground and water, not under. Let's try on next tick
|
||||
if (levelZ >= destZ)
|
||||
@@ -130,17 +130,17 @@ namespace Game.Movement
|
||||
|
||||
// The fastest way to get an accurate result 90% of the time.
|
||||
// Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long.
|
||||
destZ = map.GetHeight(creature.GetPhases(), destX, destY, respZ + travelDistZ - 2.0f, false);
|
||||
destZ = map.GetHeight(creature.GetPhaseShift(), destX, destY, respZ + travelDistZ - 2.0f, false);
|
||||
|
||||
if (Math.Abs(destZ - respZ) > travelDistZ) // Map check
|
||||
{
|
||||
// Vmap Horizontal or above
|
||||
destZ = map.GetHeight(creature.GetPhases(), destX, destY, respZ - 2.0f, true);
|
||||
destZ = map.GetHeight(creature.GetPhaseShift(), destX, destY, respZ - 2.0f, true);
|
||||
|
||||
if (Math.Abs(destZ - respZ) > travelDistZ)
|
||||
{
|
||||
// Vmap Higher
|
||||
destZ = map.GetHeight(creature.GetPhases(), destX, destY, respZ + travelDistZ - 2.0f, true);
|
||||
destZ = map.GetHeight(creature.GetPhaseShift(), destX, destY, respZ + travelDistZ - 2.0f, true);
|
||||
|
||||
// let's forget this bad coords where a z cannot be find and retry at next tick
|
||||
if (Math.Abs(destZ - respZ) > travelDistZ)
|
||||
|
||||
Reference in New Issue
Block a user