Core/Movement: MovementGenerator fixes.

- vmap height search in FleeingMovementGenerator and ConfusedMovementGenerator (until we can search for a nearby position properly) Should solve #7704, needs testing
- Removed some unused code in CalculatePath and TargetedMovementGenerator. Ty faramir118
- Allow players to charge through slime and lava liquids. Closes #7967
This commit is contained in:
kaelima committed 2012-11-07 16:42:22 +01:00
1 parent 3c13454ad7
commit 677ee02b8e
6 files changed
+79 -99

No files matched your search

+4 -21
View File
@@ -58,7 +58,6 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
return false;
Vector3 oldDest = GetEndPosition();
Vector3 dest(destX, destY, destZ);
SetEndPosition(dest);
@@ -81,24 +80,8 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo
UpdateFilter();
// check if destination moved - if not we can optimize something here
// we are following old, precalculated path?
float dist = _sourceUnit->GetObjectSize();
if (oldDest != Vector3::zero() && InRange(oldDest, dest, dist, dist) && _pathPoints.size() > 2)
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
sLog->outDebug(LOG_FILTER_MAPS, "++ PathGenerator::CalculatePath:: precalculated path\n");
_pathPoints.erase(_pathPoints.begin());
return false;
}
else
{
// target moved, so we need to update the poly path
BuildPolyPath(start, dest);
return true;
}
BuildPolyPath(start, dest);
return true;
}
dtPolyRef PathGenerator::GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* point, float* distance) const
@@ -534,10 +517,10 @@ void PathGenerator::CreateFilter()
if (creature->canSwim())
includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); // swim
}
else if (_sourceUnit->GetTypeId() == TYPEID_PLAYER)
else // assume Player
{
// perfect support not possible, just stay 'safe'
includeFlags |= (NAV_GROUND | NAV_WATER);
includeFlags |= (NAV_GROUND | NAV_WATER | NAV_MAGMA | NAV_SLIME);
}
_filter.setIncludeFlags(includeFlags);