GE Lua Documentation

Press F to search!

scatterParkedCars

Definition


-- @/lua/ge/extensions/gameplay/parking.lua:324

local function scatterParkedCars(vehIds, minDist, maxDist) -- randomly teleports all parked vehicles to parking spots
  vehIds = vehIds or parkedVehIds
  local randomPsList, psList = getRandomParkingSpots(focus and focus.pos, minDist, maxDist, #vehIds)
  if not psList then return end

  randomPsList = arrayConcat(psList, randomPsList)

  for _, id in ipairs(vehIds) do
    forceTeleport(id, randomPsList)
  end
end

Callers

@/lua/ge/extensions/editor/trafficDebug.lua
  if im.Button("Scatter Parked Vehicles") then
    gameplay_parking.scatterParkedCars()
  end
@/lua/ge/extensions/gameplay/parking.lua
  if worldLoaded and not ignoreScatter then
    scatterParkedCars(vehIds)
  end
  if not worldLoaded and parkedVehIds[1] and focus.pos.z ~= 0 then -- is this needed?
    --scatterParkedCars()
    worldLoaded = true
@/lua/ge/extensions/career/modules/linearTutorial.lua
M.setTrafficForTutorial = function()
  gameplay_parking.scatterParkedCars()
  gameplay_parking.setActiveAmount(0)
M.setTrafficAfterTutorial = function()
  gameplay_parking.scatterParkedCars()
  gameplay_traffic.scatterTraffic()