VE Lua Documentation

Press F to search!

setAvoidCars

Definition


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

local function setAvoidCars(v)
  M.extAvoidCars = v
  if M.extAvoidCars == 'off' or M.extAvoidCars == 'on' then
    opt.avoidCars = M.extAvoidCars
  else
    opt.avoidCars = M.mode == 'manual' and 'off' or 'on'
  end
  stateChanged()
end

Callers

@/lua/ge/extensions/flowgraph/nodes/gameplay/race/raceAiParameters.lua
        local mode = self.pinIn.avoidCollisions.value and 'on' or 'off'
        veh:queueLuaCommand('ai.setAvoidCars("'..mode..'")')
      end
@/lua/ge/extensions/freeroam/dragRace.lua
  opponentVehicle:queueLuaCommand('ai.setSpeed(5)')
  opponentVehicle:queueLuaCommand('ai.setAvoidCars("on")')
  opponentVehicle:queueLuaCommand('controller.onGameplayEvent("freeroam_dragRace", "AI_stage")') --moded controller support
  opponentVehicle:queueLuaCommand('controller.onGameplayEvent("freeroam_dragRace", "AI_stop")') --moded controller support
  opponentVehicle:queueLuaCommand('ai.setAvoidCars("on")')
end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/aiParams.lua
  if self.pinIn.avoidCars.value ~= nil then
    veh:queueLuaCommand('ai.setAvoidCars("'..(self.pinIn.avoidCars.value and 'on' or 'off')..'")')
  end
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
  if params.aiAware then
    obj:queueLuaCommand(string.format('ai.setAvoidCars("%s")', params.aiAware))
  end
@/lua/ge/extensions/scenario/scenariohelper.lua
  -- value should be either 'off' or 'on' accordingly
  queueLuaCommandByName(vehicleName, 'ai.setAvoidCars("'..value..'")')
  if scenario_scenarios then
@/ui/modules/apps/AIControl/app.js
      vm.changeTrafficAwareness = function () {
        var cmd = `ai.setAvoidCars("${vm.extAvoidCars.value}")`
        bngApi.activeObjectLua(cmd)
@/lua/ge/extensions/editor/trafficManager.lua
  if aiData.avoidCars ~= nil then
    veh:queueLuaCommand('ai.setAvoidCars("'..(aiData.avoidCars and 'on' or 'off')..'")')
  end