Here is part from nextbot code from RunBehaviour coroutine:
path:Compute( self, pos, function( area, fromArea, ladder, elevator, length )
if ( !IsValid( fromArea ) ) then
// first area in path, no cost
return 0
else
if ( !self.loco:IsAreaTraversable( area ) ) then
// our locomotor says we can't move here
return -1
end
// compute distance traveled along path so far
local dist = 0
if ( IsValid( ladder ) ) then
dist = ladder:GetLength()
elseif ( length > 0 ) then
// optimization to avoid recomputing length
dist = length
else
dist = ( area:GetCenter() - fromArea:GetCenter() ):GetLength()
end
local cost = dist + fromArea:GetCostSoFar()
// check height change
local deltaZ = fromArea:ComputeAdjacentConnectionHeightChange( area )
if ( deltaZ >= 18 ) then
// Involves jumping, skip it
return -1
elseif ( deltaZ < -self.loco:GetDeathDropHeight() ) then
// too far to drop
return -1
end
return cost
end
end )
Basically, I want path generator NOT to create path where jumping is needed and use alternative path that don’t need jumping. But for some reasons, it still creates path with jumps. What am I doing wrong?