GE Lua Documentation

Press F to search!

getMaxVehicleAmount

Definition


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

 -- gets estimated maximum amount of vehicles to run based on CPU
function getMaxVehicleAmount(cap)
  return Engine.Platform.getCPUInfo() and clamp(Engine.Platform.getCPUInfo().coresPhysical or 1, 1, cap or math.huge) or 4
end

Callers

@/lua/ge/extensions/gameplay/traffic.lua
  if amount == 0 then -- use CPU-based value
    amount = getMaxVehicleAmount(10)
  end
@/lua/ge/extensions/gameplay/discover/discover_037.lua
      if trafficAmountFromSettings == 0 then
        trafficAmountFromSettings = getMaxVehicleAmount(10)
      end
@/lua/ge/extensions/scenario/busdriver.lua
    local amount = core_settings_settings.getValue('trafficAmount')
    if amount == 0 then amount = getMaxVehicleAmount(12) end
    gameplay_traffic.setupTraffic(amount)