VE Lua Documentation

Press F to search!

driveInLane

Definition


-- @/lua/vehicle/ai.lua:6534

local function driveInLane(v)
  if v == 'on' then
    M.driveInLaneFlag = 'on'
    opt.driveInLaneFlag = true
  else
    M.driveInLaneFlag = 'off'
    opt.driveInLaneFlag = false
  end
  stateChanged()
end

Callers

@/lua/ge/extensions/gameplay/traffic/vehicle.lua
    obj:queueLuaCommand('ai.setSpeedMode("legal")')
    obj:queueLuaCommand('ai.driveInLane("on")')
  elseif mode == 'random' or mode == 'flee' or mode == 'chase' then
    obj:queueLuaCommand('ai.setSpeedMode("off")')
    obj:queueLuaCommand('ai.driveInLane("off")')
  end
@/lua/vehicle/extensions/tech/platooning.lua
    ai.setMode('follow')
    ai.driveInLane('on')
    ai.setMode('follow')
    ai.driveInLane('on')
  ai.setMode('follow')
  ai.driveInLane('on')
  ai.setMode(mode)
  ai.driveInLane('on')
  ui_message("Platoon Launched successfully", 5, "Tech", "forward")
  ai.setMode('span')
  ai.driveInLane('on')
  ui_message("Platoon Leader assigned successfully", 5, "Tech", "forward")
  ai.setMode('span')
  ai.driveInLane('on')
  ui_message("Platoon Leader assigned successfully", 5, "Tech", "forward")
  ai.setMode('span')
  ai.driveInLane('on')
@/lua/ge/extensions/editor/trafficManager.lua
  if aiData.driveInLane ~= nil then
    veh:queueLuaCommand('ai.driveInLane("'..(aiData.driveInLane and 'on' or 'off')..'")')
  end
@/lua/vehicle/extensions/tech/techCore.lua
M.handleSetDriveInLane = function(request)
  ai.driveInLane(request['lane'])
  ai.stateChanged()
@/lua/ge/extensions/gameplay/traffic/roles/suspect.lua
        getObjectByID(self.veh.id):queueLuaCommand('ai.setAggressionMode("off")')
        getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
        getObjectByID(self.veh.id):queueLuaCommand('ai.setSpeedMode("off")')
@/lua/ge/extensions/gameplay/traffic/roles/standard.lua
        local obj = getObjectByID(self.veh.id)
        obj:queueLuaCommand('ai.driveInLane("off")')
        obj:queueLuaCommand('ai.setAggressionMode("off")')
        local obj = getObjectByID(self.veh.id)
        obj:queueLuaCommand('ai.driveInLane("off")')
        obj:queueLuaCommand('ai.setAggressionMode("off")')
@/lua/ge/extensions/scenario/scenariohelper.lua
    defines whether the routeSpeed argument above will act as a limiter (AI will not exceed difined speed) or will be forced on the AI vehicle
  -- driveInLane (type: string)
    Options -> 'on' / 'off'
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/aiParams.lua
  if self.pinIn.inLane.value ~= nil then
    veh:queueLuaCommand('ai.driveInLane("'..(self.pinIn.inLane.value and 'on' or 'off')..'")')
  end
@/lua/vehicle/extensions/gameplayInterfaceModules/interactAI.lua
    BeamEngine:queueAllObjectLuaExcept('ai.setSpeedMode("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "random", extAggression = 1, targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setSpeedMode("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "flee", targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setSpeedMode("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "chase", targetObjectID = ' .. tostring(objectId) .. "})", objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setSpeedMode("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.driveInLane("off")', objectId)
    BeamEngine:queueAllObjectLuaExcept('ai.setState({mode = "follow", targetObjectID = ' .. tostring(objectId) .. "})", objectId)
@/ui/modules/apps/AIControl/app.js
      vm.changeLaneDriving = function () {
        var cmd = `ai.driveInLane("${vm.driveInLaneFlag.value}")`
        bngApi.activeObjectLua(cmd)
@/lua/ge/extensions/gameplay/traffic/roles/police.lua
        obj:queueLuaCommand('ai.setSpeedMode("off")')
        obj:queueLuaCommand('ai.driveInLane("on")')
      self.veh:setAiMode('chase')
      getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
      self.driveInLane = false
      self.veh:setAiMode('flee')
      getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("on")')
      self.driveInLane = true
        -- TODO: this is a hack; we should enable the vehicle AI to naturally overtake traffic in lane mode
        getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
        self.driveInLane = false
@/lua/vehicle/ai.lua
        setSpeedMode('legal')
        driveInLane('on')
        setTractionModel(1)

    driveInLane(arg.driveInLane)