GE Lua Documentation

Press F to search!

getPath

Definition


-- @/lua/ge/extensions/core/paths.lua:220

local function getPath_Deprecated(pathName)
  -- find any path (chooses first)
  if not pathName then
    local objNames = scenetree.findClassObjects('SimPath')
    if not objNames or #objNames == 0 then
      -- if not SimPath on level return
      --log('E', 'core_paths.getPath', 'unable to find any path')
      return
    end
    pathName = objNames[1]
  end
  local pathObj = scenetree.findObject(pathName)
  if not pathObj then
    log('E', 'core_paths.getPath', 'unable to find path: ' .. tostring(pathName))
    return
  end

  local res = { markers = {}}

  res.looped = false
  if pathObj.looped then
    res.looped = pathObj.looped == '1'
  end

  -- extract all its markers
  --pathObj:sortMarkers()
  res.nodeCount = pathObj:size()
  for i = 0, res.nodeCount do
    local markerId = pathObj:idAt(i)
    if markerId >= 0 then
      local marker = scenetree.findObjectById(markerId)
      if marker then
        local d = {
          pos = vec3(marker:getPosition()),
          rot = quat(marker:getRotation()),
          time = marker.timeToNext or marker.seconds,
          positionSmooth = marker.positionSmooth
        }
        res.markers[marker.seqNum + 1] = d
      end
    end
  end
  -- fix up the rotations
  for i = 2, res.nodeCount - 1 do
    if res.markers[i].rot:dot(res.markers[i - 1].rot) < 0 then
      res.markers[i].rot = -res.markers[i].rot
    end
  end

  return res
end

Callers

@/lua/ge/extensions/editor/api/valueInspector.lua
            if absPath ~= "" then
              absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
            end
@/lua/ge/extensions/gameplay/route/route.lua
  for i = 1, #wpList-1 do
    local path = map.getPath(wpList[i], wpList[i + 1], self.cutOffDrivability, self.dirMult, self.penaltyAboveCutoff, self.penaltyBelowCutoff)
    local pathLen = #self.path
@/lua/ge/extensions/career/modules/testDrive.lua
    markerInfo = {
      parkingMarker = {path = testDriveInfo.endParkingSpot:getPath(), pos = eps.pos, rot = eps.rot, scl = eps.scl },
      bigmapMarker = {pos = eps.pos, name = "ui.career.testDrive.endTestDrive", description = "ui.career.testDrive.endTestDriveDesc", thumbnail = testDriveInfo.dealershipPreview, previews = {testDriveInfo.dealershipPreview}}
@/lua/ge/extensions/gameplay/race/race.lua

  local path = map.getPath(self.aiDetailedPath[inNextAiPathIdx].wp, self.aiDetailedPath[outPrevAiPathIdx].wp)
  local distanceAlongPath = 0
@/lua/ge/extensions/career/modules/delivery/general.lua
        local ps = ap.ps
        local id = string.format("delivery-parking-%s-%s", fac.id, ps:getPath())
        local loc = {type = "facilityParkingspot", facId = fac.id, psPath = ps:getPath()}
        local id = string.format("delivery-parking-%s-%s", fac.id, ps:getPath())
        local loc = {type = "facilityParkingspot", facId = fac.id, psPath = ps:getPath()}
        local cargoCount = #dParcelManager.getAllCargoForLocationUnexpiredUndelivered(loc)
        local icon = "poi_pickup_round"
        if interactiveParkingSpots[ps:getPath()] then
          icon = "poi_dropoff_round"

        local focus = interactiveParkingSpots[ps:getPath()] ~= nil
        local elem = {
          id = id,
          data = {type = "logisticsParking", facId = fac.id, psPath = ps:getPath(), canInspectCargo = ap.isInspectSpot, hasPlayerCargo = interactiveParkingSpots[ps:getPath()] and true or false },
          markerInfo = {
          id = id,
          data = {type = "logisticsParking", facId = fac.id, psPath = ps:getPath(), canInspectCargo = ap.isInspectSpot, hasPlayerCargo = interactiveParkingSpots[ps:getPath()] and true or false },
          markerInfo = {
            -- only include parking marker if there is an action
            parkingMarker = cargoCount and {path = ps:getPath(), pos = ps.pos, rot = ps.rot, scl = ps.scl, icon = icon, focus = focus} or nil,
          }
        --  fac.id, ps.id,
        --  dParcelManager.getLocationLabelShort({type="facilityParkingspot", facId = fac.id, psPath = ps:getPath()}),
        --  dumps(dProgress.isFacilityVisible(fac.id)),
        else
          if interactiveParkingSpots[ps:getPath()] then
            local tasks = {}
            if next(interactiveParkingSpots[ps:getPath()].dropOffs) then
              table.insert(tasks, string.format("Deliver %d cargo items here.", #interactiveParkingSpots[ps:getPath()].dropOffs))
            if next(interactiveParkingSpots[ps:getPath()].dropOffs) then
              table.insert(tasks, string.format("Deliver %d cargo items here.", #interactiveParkingSpots[ps:getPath()].dropOffs))
            end
            end
            if next(interactiveParkingSpots[ps:getPath()].pickUps) then
              table.insert(tasks, string.format("Pick up %d cargo items here.", #interactiveParkingSpots[ps:getPath()].pickUps))
            if next(interactiveParkingSpots[ps:getPath()].pickUps) then
              table.insert(tasks, string.format("Pick up %d cargo items here.", #interactiveParkingSpots[ps:getPath()].pickUps))
            end
            end
            if next(interactiveParkingSpots[ps:getPath()].vehicles) then
              table.insert(tasks, string.format("Deliver %d vehicles here.", #interactiveParkingSpots[ps:getPath()].vehicles))
            if next(interactiveParkingSpots[ps:getPath()].vehicles) then
              table.insert(tasks, string.format("Deliver %d vehicles here.", #interactiveParkingSpots[ps:getPath()].vehicles))
            end
        end
        if interactiveParkingSpots[ps:getPath()] or ap.isInspectSpot or dCargoScreen.isCargoScreenOpen() then
          --dump(string.format("%s -> %s", fac.name, name))

          local id = string.format("delivery-parking-%s-%s", fac.id, ps:getPath())
          local loc = {type = "facilityParkingspot", facId = fac.id, psPath = ps:getPath()}
          local id = string.format("delivery-parking-%s-%s", fac.id, ps:getPath())
          local loc = {type = "facilityParkingspot", facId = fac.id, psPath = ps:getPath()}
          local icon = "poi_pickup_round"
          if interactiveParkingSpots[ps:getPath()] then
            icon = "poi_dropoff_round"
            id = id,
            data = {type = "logisticsParking", facId = fac.id, psPath = ps:getPath(), hasPlayerCargo = interactiveParkingSpots[ps:getPath()] and true or false },
            markerInfo = {
            id = id,
            data = {type = "logisticsParking", facId = fac.id, psPath = ps:getPath(), hasPlayerCargo = interactiveParkingSpots[ps:getPath()] and true or false },
            markerInfo = {
@/lua/ge/extensions/career/modules/delivery/cargoScreen.lua
        name = fac.name,
        distance = dGenerator.getDistanceBetweenFacilities(facPsLocation, {type="facilityParkingspot", facId = fac.id, psPath = fac.dropOffSpots[1]:getPath()}),
        storage = fac.materialStorages[materialType],

      local distanceKey = string.format("%d-%s-%s", con.vehId, fac.facId, fac.dropOffSpots[1]:getPath())
      if vehToLocationDistanceCache[distanceKey] == nil then
        vehToLocationDistanceCache[distanceKey] = false
        local a, b = dGenerator.getLocationCoordinates({type="vehicle", vehId=con.vehId}), dGenerator.getLocationCoordinates({type="facilityParkingspot", facId=fac.facId, psPath=fac.dropOffSpots[1]:getPath()})
        if a and b then
  local fac = dGenerator.getFacilityById(locationId)
  local toPos = dGenerator.getLocationCoordinates({type="facilityParkingspot", facId = fac.id, psPath=(asProvider and fac.pickUpSpots[1] or fac.dropOffSpots[1]):getPath()})
  if fromPos and toPos then
@/lua/ge/extensions/editor/inspector.lua
        if texturePath ~= ""then
          texturePath = (string.find(texturePath, "/") ~= nil and texturePath or (groundCoverMaterial:getPath() .. texturePath))
          texture = editor.getTempTextureObj(texturePath)
@/lua/ge/main.lua
  local nid = newVehicle and newVehicle:getId() or -1
  -- local oldinfo = oldVehicle and ("id "..dumps(oid).." ("..oldVehicle:getPath()..")") or dumps(oldVehicle)
  -- local newinfo = newVehicle and ("id "..dumps(nid).." ("..newVehicle:getPath()..")") or dumps(newVehicle)
  -- local oldinfo = oldVehicle and ("id "..dumps(oid).." ("..oldVehicle:getPath()..")") or dumps(oldVehicle)
  -- local newinfo = newVehicle and ("id "..dumps(nid).." ("..newVehicle:getPath()..")") or dumps(newVehicle)
  --log('I', 'main', "Player #"..dumps(player).." vehicle switched from: "..oldinfo.." to: "..newinfo)
@/lua/ge/extensions/scenario/raceDebug.lua
        --print("path from '" .. lastwp .. "' to '".. wp .. "':")
        local path = map.getPath(lastwp, wp)
        local lastWpp = nil
@/lua/common/graphpath.lua

print( table.concat( gp:getPath("a","e"), "->") )
]]

function Graphpath:getPath(start, goal, dirMult)
  local graph = self.graph

  local path = self:getPath(wpAhead, twpAhead, dirMult)
@/lua/ge/extensions/editor/roadArchitect.lua
            if absPath ~= "" then                                                                   -- Check if path is absolute or relative.
              absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
            end
@/inspector/Models/RecordingState.js
        if (WI.ImageUtilities.supportsCanvasPathDebugging())
            data.setPath = [context.getPath()];
@/ui/lib/int/utilities.js
    restrict: 'E',
    template: ``,
    scope: {
@/lua/ge/extensions/gameplay/delivery/delivery.lua
    if name_a and name_b then
      local path = map.getPath(name_a, name_b)
      local d = 0
@/lua/ge/extensions/editor/toolUtilities/geom.lua
  for i = 1, #nodes - 1 do
    local section = map.getPath(nodes[i], nodes[i + 1])
    for j = startIdx, #section do
@/lua/ge/extensions/career/modules/delivery/generator.lua
  if not name_a or not name_b then return 1 end
  local path = map.getPath(name_a, name_b)
  local d = 0
                    if ap.logisticTypesReceivedLookup[template.logisticType] then
                      table.insert(destination.destinations, {type = "facilityParkingspot", facId = f.id, psPath = s:getPath()})
                    end
  fac.closestMaterialProviders = {}
  local facLocation = {type = "facilityParkingspot", facId = fac.id, psPath = fac.dropOffSpots[1]:getPath()}
  for materialType, storage in pairs(fac.materialStorages) do
          if otherFac.logisticTypesProvidedLookup[materialType] then
            local otherLocation = {type = "facilityParkingspot", facId = otherFac.id, psPath = otherFac.pick UpSpots[1]:getPath()}
            local otherApName = otherFac.materialStorages[materialType] and otherFac.materialStorages[materialType].pickUpSpotName
            if otherApName then
              otherLocation.psPath = otherFac.accessPointsByName[otherApName].ps:getPath()
            end
  if fac.pickUpSpots[1] then
    local facLocation = {type = "facilityParkingspot", facId = fac.id, psPath = fac.pickUpS pots[1]:getPath()}
    for materialType, storage in pairs(fac.materialStorages) do
                    facId = otherFac.id,
                    psPath = otherFac.dropOffSpots[1]:getPath(),
                  })
        if ap.logisticTypesReceivedLookup[materialType] then
          table.insert(destination.destinations, {type = "facilityParkingspot", facId = f.id, psPath = ap.ps:getPath()})
        end

          parkingSpotsByPath[ps:getPath()] = ps
          psFound = true

                parkingSpotsByPath[ps:getPath()] = ps
                psFound = true

            parkingSpotsByPath[ps:getPath()] = ps
            psFound = true
        ap.facId = fac.id
        ap.psPath = ap.ps:getPath()
        ap.logisticTypesReceivedLookup = ap.logisticTypesReceivedLookup or {}
@/lua/ge/extensions/editor/decalSpline.lua
        if absPath ~= "" then
          absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
        end
        if absPath ~= "" then
          absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
        end
        if absPath ~= "" then
          absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
        end
        if absPath ~= "" then
          absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
        end
@/lua/ge/extensions/flowgraph/modules/cameraModule.lua

function C:getPath(id)
  return self.storedPaths[id]
@/lua/vehicle/ai.lua
      local wp2 = wpList[i+1]
      local route = mapData:getPath(wp1, wp2, opt.driveInLaneFlag and 1e4 or 1)
      local routeLen = #route
@/lua/ge/extensions/gameplay/rally/geometry.lua
  local endNode1, _ = map.findClosestRoad(targetPos)
  local path = map.getGraphpath():getPath(startNode1, endNode1)
@/lua/ge/map.lua

local function getPath(start, target, cutOffDrivability, dirMult, penaltyAboveCutoff, penaltyBelowCutoff)
  -- arguments:
@/lua/ge/extensions/gameplay/sites/parkingSpot.lua

function C:getPath()
  return self.sites.dir .. self.sites.filename .. '#'..self.name
@/lua/ge/extensions/gameplay/race/segment.lua
  table.clear(self.capsulePoints)
  local path = map.getPath(self:getFrom().navgraphName, self:getTo().navgraphName)
  if path and #path > 2 then
@/lua/ge/extensions/gameplay/route/raceRoute.lua
  for i = 1, #wpList-1 do
    local path = map.getPath(wpList[i], wpList[i + 1], self.cutOffDrivability, self.dirMult, self.penaltyAboveCutoff, self.penaltyBelowCutoff)
    local pathLen = #self.path
@/lua/ge/extensions/editor/materialEditor.lua
  if not string.find(p, "/", 1, true) then
    return p, (mat:getPath() .. p)
  else
  if absPath ~= "" and not isTaggedTexture and not isLevelRelativeTexture then
    absPath = (string.find(absPath, "/") ~= nil and absPath or (currentMaterial:getPath() .. absPath))
    if absPath ~= imgPath then
@/lua/vehicle/controller/tech/roadsSensor.lua
  local pFKey, pRKey, pH = getPointAhead(frontAxleMidpointProjGround, fwd, lookAheadDistance)
  local path = mapmgr.mapData:getPath(pRKey, pFKey, nil)
  coeffsCL = { uA = 0, uB = 0, uC = 0, uD = 0, vA = 0, vB = 0, vC = 0, vD = 0 }
@/lua/ge/extensions/flowgraph/nodes/util/routePointToPoint.lua
  if legalRoute == nil then legalRoute = true end
  local route = map.getPath(tempNodes.posA, tempNodes.posB, nil, legalRoute and 1000 or 1)
  self.pinOut.navgraphRoute.value = route
@/lua/ge/extensions/editor/toolUtilities/materialSelectionMgr.lua
          local imgPath = mat:getField("diffuseMap", 0)
          local absPath = imgPath ~= emptyStr and (string.find(imgPath, "/") and imgPath or (mat:getPath() .. imgPath)) or emptyStr
          local texture = getTexObj(absPath)
@/lua/ge/extensions/editor/roadSpline.lua
                    if absPath ~= "" then
                      absPath = (string.find(absPath, "/") ~= nil and absPath or (mat:getPath() .. absPath))
                    end
@/lua/ge/extensions/core/cameraModes/path.lua
  else
    path = core_paths.getPath(self.pathName)
  end
@/lua/ge/extensions/util/export.lua
  for i = 1, 100 do
    fn = playerVehicle:getPath() .. 'export_' .. string.format('%03d', i)
    if M.gltfBinaryFormat then
@/lua/ge/extensions/ui/uiNavi.lua

  local route = map.getPath(findClosestRoad(newPos), destination)
  if oldPos:distance(newPos) > 0.1 then

  local route = map.getPath(startPoint, endPoint)
  guihooks.trigger('RoutePlanned', route)