GE Lua Documentation

Press F to search!

getAllVehicles

Definition


-- @/lua/ge/ge_utils.lua:500

-- returns a list of all BeamNGVehicle objects currently spawned in the level
function getAllVehicles()
  if not allVehiclesCache then
    allVehiclesCache = {}
    allVehiclesIdCache = {}
    for i = 0, be:getObjectCount()-1 do
      local veh = be:getObject(i)
      table.insert(allVehiclesCache, veh)
      table.insert(allVehiclesIdCache, veh:getId())
    end
  end
  return allVehiclesCache
end

Callers

@/lua/ge/extensions/gameplay/missions/missionManager.lua
  if mission.setupModules.environment._windVec then -- resets wind; what if previous wind existed?
    for _, veh in ipairs(getAllVehicles()) do
      veh:queueLuaCommand("obj:setWind(0, 0, 0)")
@/lua/ge/extensions/core/multiSpawn.lua
  -- the traffic UI app uses this function
  local vehicles = getAllVehicles()
  local count = 0
@/lua/ge/extensions/tech/techCore.lua

  for k, veh in pairs(getAllVehicles()) do
    if not veh:getActive() then goto continue end

  for _, v in ipairs(getAllVehicles()) do
    if v:getName() == request.leaderID then

  for _, v in ipairs(getAllVehicles()) do
    if v:getName() == request.leaderID then

  for _, v in ipairs(getAllVehicles()) do
    if v:getName() == request.leaderID then

  for _, v in ipairs(getAllVehicles()) do
    if v:getName() == request.leaderID then

  for _, v in ipairs(getAllVehicles()) do
    if v:getName() == request.leaderID then
@/lua/console/bananabench-csv.lua

local res = bench.physics(bench.getAllVehicles())
exportCSV(res)
@/lua/console/bananabench.lua

local function getAllVehicles()
  local vehicles = {}
@/lua/ge/extensions/core/multiseat.lua
  local maxPlayers = getMaxPlayersAmount(multiseat)
  local nVehicles = tableSize(getAllVehicles())
  local nControllers = tableSize(devices) - 1 -- assume mouse goes together with keyboard
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
            if true then return end
--        local aveh = getAllVehicles()
        local aveh = {}
@/lua/console/bananabench-xml.lua
--local res = bench.physics({'pigeon'}, 1,1)
--local vehicles = bench.getAllVehicles()
local vehicles = {
@/lua/ge/extensions/c2/panelPlugins/vehicleManager.lua
  if needAll then
    local vehicles = getAllVehicles()
    for _, veh in pairs(vehicles) do
@/gameplay/missions/west_coast_usa/chase/001-Goliath/script.lua
    local trailer, trailerId
    for _, v in ipairs(getAllVehicles()) do
      if v:getActive() and v:getInternalName() == "trailer" then
@/gameplay/missions/gridmap_v2/collection/002-blenderbowl/script.lua

      for _, v in ipairs(getAllVehicles()) do
        if v.jbeam == "ball" then
@/lua/ge/extensions/flowgraph/nodes/environment/setWind.lua
function C:onNodeReset()
  for _, veh in ipairs(getAllVehicles()) do
    veh:queueLuaCommand('obj:setWind(0, 0, 0)')
  windVec:setScaled(windSpeed)
  for _, veh in ipairs(getAllVehicles()) do
    if not self.pinIn.vehId.value or self.pinIn.vehId.value == veh:getId() then
@/lua/ge/extensions/core/multiseatCamera.lua
  else
    for k, v in ipairs(getAllVehicles()) do
      local vid = v:getId()
@/lua/ge/extensions/flowgraph/nodes/gameplay/removeOtherVehicles.lua
  else
    for _, v in ipairs(getAllVehicles()) do
      table.insert(vehIds, v:getId())
@/lua/ge/extensions/core/input/bindings.lua
  local activeActions = core_input_actions.getActiveActions()
  for _,veh in ipairs(getAllVehicles()) do
    local vd = extensions.core_vehicle_manager.getVehicleData(veh:getId())
local function notifyFFB(reason)
  for _,veh in ipairs(getAllVehicles()) do
    veh:queueLuaCommand("hydros.onFFBConfigChanged("..serialize(getFFBConfig(veh))..")")
@/lua/ge/extensions/editor/vehicleEditor/veToolbar.lua
        if im.BeginMenu("Remove") then
          local currVehs = getAllVehicles()
        if im.MenuItem1("Remove All") then
          local currVehs = getAllVehicles()
          for k, veh in ipairs(currVehs) do
@/lua/console/resave-pcs.lua

local function getAllVehicles()
    local vehicles = {}
    io.write("Retreiving vehicles list\n")
    local vehicles = getAllVehicles()
    local configCount = 0
@/lua/ge/extensions/gameplay/parking.lua
      if parkedVehData[vehId]._teleport then -- force teleport if flag exists
        for _, otherVeh in ipairs(getAllVehicles()) do
          local otherId = otherVeh:getId()

        for _, veh in ipairs(getAllVehicles()) do
          if not veh.isTraffic and not veh.isParked and map.objects[veh:getId()] then
@/lua/ge/extensions/editor/perfProfiler.lua
    im.BulletText("Remove FPS Limiter")
    im.BulletText(string.format("There are %d vehicle spawned", #getAllVehicles()))
    if im.Button("Delete All Vehicles", im.ImVec2(im.GetContentRegionAvailWidth(), 0)) then
    if im.Button("Delete All Vehicles", im.ImVec2(im.GetContentRegionAvailWidth(), 0)) then
      local vehs = deepcopy(getAllVehicles())
      for _, obj in ipairs(vehs) do
@/lua/ge/extensions/gameplay/traffic/trafficUtils.lua
  local traffic = gameplay_traffic.getTrafficData()
  for _, veh in ipairs(getAllVehicles()) do
    if veh:getActive() then
@/lua/ge/extensions/gameplay/sites/parkingSpot.lua

  for _, veh in ipairs(getAllVehicles()) do
    local vehId = veh:getID()
@/lua/ge/ge_utils.lua

  for _, veh in ipairs(getAllVehicles()) do
    local model = core_vehicles.getModel(veh.jbeam).model
  if not allVehiclesCache then
    getAllVehicles()
  end
  if not allVehiclesCache then
    getAllVehicles()
  end
@/lua/ge/extensions/gameplay/walk.lua
  if not unicycle then
    for _, veh in ipairs(getAllVehicles()) do
      if veh:getJBeamFilename() == "unicycle" and not veh:getActive() then
    local closestHit = 2
    for _, veh in ipairs(getAllVehicles()) do
      local vehId = veh:getID()
@/lua/ge/extensions/gameplay/missions/missionTypes/flowMission.lua

    for _, veh in ipairs(getAllVehicles()) do
      if veh:isReady() then
@/lua/console/bananabench-async.lua

local function getAllVehicles()
    local vehicles = {}