getAllVehiclesByType
Definition
-- @/lua/ge/ge_utils.lua:515
function getAllVehiclesByType(typeList)
local res = {}
typeList = typeList or defaultTypes
for _, veh in ipairs(getAllVehicles()) do
local model = core_vehicles.getModel(veh.jbeam).model
if arrayFindValueIndex(typeList, model.Type) then
table.insert(res, veh)
end
end
return res
end
Callers
@/lua/ge/extensions/core/vehicleActivePooling.lua
local filterParked = not vehTypes or arrayFindValueIndex(vehTypes, "PropParked")
for _, veh in ipairs(getAllVehiclesByType(vehTypes)) do -- if vehTypes is nil, uses default args
if veh:getActive() and not (filterParked and veh.isParked) then
@/lua/ge/extensions/editor/aiTests.lua
if im.Selectable1("Setup All Vehicles...", true) then -- sets up all other vehicles
for _, v in ipairs(getAllVehiclesByType()) do
if not v.isParkingOnly then
@/lua/ge/extensions/core/hotlapping.lua
for _, veh in ipairs(getAllVehiclesByType()) do
if veh.isHotlapping then
for _, veh in ipairs(getAllVehiclesByType()) do
if not veh:isPlayerControlled() and not veh.isTraffic and not veh.isParked then
local function stopAi(respawn)
for _, veh in ipairs(getAllVehiclesByType()) do
if veh.isHotlapping then
@/lua/ge/extensions/freeroam/specialTriggers.lua
local data = {}
for _, veh in ipairs(getAllVehiclesByType()) do
local vehId = veh:getID()
@/lua/ge/extensions/flowgraph/nodes/gameplay/removeOtherVehicles.lua
if self.onlyDrivableVehs then
for _, v in ipairs(getAllVehiclesByType()) do
table.insert(vehIds, v:getId())
@/lua/ge/extensions/career/modules/playerDriving.lua
end
if not getAllVehiclesByType()[1] then -- if player vehicle does not exist yet
amount = amount - 1
@/lua/ge/extensions/gameplay/traffic.lua
if not ignoreAdjust then
for _, veh in ipairs(getAllVehiclesByType()) do
if veh.isParked ~= 'true' and veh:getActive() then
local function deleteVehicles() -- deletes all traffic vehicles
for _, veh in ipairs(getAllVehiclesByType()) do
local id = veh:getId()
-- NOTE: If vehList is empty, all vehicles get activated, even unintended ones; this may need to be reconsidered in the future
for _, veh in ipairs(getAllVehiclesByType()) do
if not veh.isParked then
local function spawnTraffic(amount, groupData, options) -- spawns and processes a group array of vehicles to use as traffic
amount = amount or max(1, getAmountFromSettings() - #getAllVehiclesByType()) -- if amount nil, automatically sets a limited amount to save performance
groupData = groupData or core_multiSpawn.createGroup(amount)
end
for _, veh in ipairs(getAllVehiclesByType()) do -- check for player vehicles to insert into traffic
checkPlayer(veh:getId())
@/lua/ge/extensions/core/multiSpawn.lua
for _, v in ipairs(getAllVehiclesByType()) do
if not (ignorePlayer and v:getID() == be:getPlayerVehicleID(0)) then
@/gameplay/missionTypes/aiRace/customNodes/aiScatterNode.lua
function C:workOnce()
for _, v in ipairs(getAllVehiclesByType()) do
local id = v:getID()
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
local valid = true
for _, veh in ipairs(getAllVehiclesByType()) do
if not veh.isTraffic and not veh.isParked and map.objects[veh:getId()] then
@/lua/ge/extensions/editor/trafficManager.lua
if im.BeginCombo("Target Vehicle##trafficManagerAiMode", aiData.targetName) then
for _, veh in ipairs(getAllVehiclesByType()) do
local vehName = veh:getName()
if im.Selectable1("Include All Vehicles From Scene##trafficManagerAllVehicles") then -- adds the player vehicle and all other vehicles to the session data
for _, veh in ipairs(getAllVehiclesByType()) do
if not scenetree.objectExists(simGroupName) then
@/lua/ge/extensions/editor/raceEditor/testing.lua
if im.Button("Move All Vehicles to Starting Positions") then
for i, veh in ipairs(getAllVehiclesByType()) do
local sp = self.path.startPositions.sorted[i]
for _, veh in ipairs(getAllVehiclesByType()) do
if self.path.defaultStartPosition and not self.path.startPositions.objects[self.path.defaultStartPosition].missing then