getPathLen
Definition
-- @/lua/ge/map.lua:2625
local function getPathLen(path)
-- returns the path length
local mapNodes = map.nodes
if not (mapNodes and path) then return 0 end
local pathLen = 0
for i = 2, #path do pathLen = pathLen + mapNodes[path[i]].pos:distance(mapNodes[path[i-1]].pos) end
return pathLen
end
Callers
@/lua/vehicle/ai.lua
local function getPathLen(path, startIdx, stopIdx)
if not path then return end
local v = positions[path[stopIdx]] + p; v:setScaled(0.5)
local r = getPathLen(path, startIdx, stopIdx) * 0.5
local pathLen = getPathLen(currentRoute.path, playerNodeInPath or math.huge) -- curPlan[2].pathidx
local playerMinPlanLen = getMinPlanLen(0, playerSpeed)
local path = currentRoute.path
if (internalState.road ~= 'offroad' and plan.planLen + getPathLen(path, plan[plan.planCount].pathidx) < getMinPlanLen()) or not path[plan[plan.planCount].pathidx+2] then
local pathCount = #path
local route
if not currentRoute or currentRoute.plan.reRoute or currentRoute.plan.planLen + getPathLen(currentRoute.path, currentRoute.plan[currentRoute.plan.planCount].pathidx) < getMinPlanLen() then
local wp1, wp2 = mapmgr.findClosestRoad(ego.pos)