ipairs
Definition
-- @/=[C]:-1
function ipairs(...)
Callers
@/gameplay/missionTypes/drift/constructor.lua
local starInfo, message = {}, nil
for _, key in ipairs(starKeys) do
local info = {
@/lua/ge/extensions/flowgraph/nodes/types/getVariable.lua
if im.BeginCombo("##selectVar".. self.id, current) then
for _, name in ipairs(names) do
if im.Selectable1(name, name==current) then
self.varName = name
for _,lnk in ipairs(links) do
if self.graph:pinsCompatible(self.pinOut[self.varName], lnk.targetPin) then
self:createPin("out", newType, name)
for _,lnk in ipairs(links) do
if self.graph:pinsCompatible(self.pinOut[self.varName], lnk.targetPin) then
@/lua/vehicle/tech/techVehicleUtils.lua
local refNodes = {}
for _, k in ipairs(properties) do
local cid = refNodeIds[k]
local nodes = {}
for _, node in ipairs(requestedNodes) do
local cid = nil
@/lua/ge/extensions/editor/slotTrafficEditor.lua
table.clear(nodesToLinkTo)
for _, id in ipairs(ids) do
selectNode(id, true)
if actionData.nodeInfos then
for _, nodeInfo in ipairs(actionData.nodeInfos) do
deleteNode(nodeInfo.nid)
if actionData.nodeInfos then
for _, nodeInfo in ipairs(actionData.nodeInfos) do
addNode(nodeInfo.pos, nodeInfo.radius, nodeInfo.nid)
for _, cpId in ipairs(road.controlPoints) do
local node = mapNodes[cpId]
if not tableIsEmpty(tempNodes) then
for _, id in ipairs(tempNodes) do
deleteNode(id)
if not tableIsEmpty(tempNodes) then
for _, id in ipairs(tempNodes) do
deleteNode(id)
local nodeInfos = {}
for i, nodeId in ipairs(tempNodes) do
table.insert(nodeInfos, {nid = nodeId, pos = vec3(mapNodes[nodeId].pos), radius = mapNodes[nodeId].radius, links = deepcopy(mapNodes[nodeId].links)})
@/lua/ge/extensions/flowgraph/nodes/ui/customUiLayout.lua
table.sort(sorted)
for _, key in ipairs(sorted) do
if im.Selectable1(key) then
@/lua/ge/extensions/editor/dynamicDecals/vehicleColorPalette.lua
local palettes = editor.getPreference("dynamicDecalsTool.vehicleColorPalette.palettes")
for k, palette in ipairs(palettes) do
if im.Button(string.format("Load##VehicleColorPalette_LoadButton_%d%s", k, guiId)) then
end
for k, palette in ipairs(palettes) do
if editor.getPreference("dynamicDecalsTool.general.debug") then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/trafficSpawnGroup.lua
function C:onNodeReset()
for _, id in ipairs(self.vehicleIds) do
local obj = scenetree.findObjectById(id)
local t = {}
for _, v in ipairs(spawnModes) do
table.insert(t, {value = v})
if self.state == 1 and self.groupId == groupId then
for _, v in ipairs(vehIds) do
self.mgr.modules.vehicle:addVehicle(getObjectByID(v), {dontDelete = self.dontDelete})
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamModifierLeakVis.lua
if slots ~= nil then
for _, slot in ipairs(slots) do
local slotId = slot.name or slot.type
for k, partData in ipairs(parts) do
local jbeamFilename = partData.jbeamFilename
tableInsert(outputNodeIdxs, nodeIdx)
for _, ni in ipairs(astHierarchy[nodeIdx] or {}) do
getLineASTNodes(astHierarchy, ni, outputNodeIdxs)
-- and only save sections that have row modifiers defined
for k, partData in ipairs(partsWithASTData) do
local part = partData.data
-- Go through each line in part's current section
for lineNum, lineData in ipairs(section) do
if lineNum > 1 and tableIsDict(lineData) then
-- to get the leaking modifiers
for _, partData in ipairs(partsWithASTData) do
local part = partData.data
-- Go through each line in part's current section
for lineNum, lineData in ipairs(section) do
if lineNum > 1 then
for partIdx, partName in ipairs(partNamesSorted) do
im.TableNextRow()
if modifier.astNodeData.leakSourceASTNodeIdxs then
for k,v in ipairs(modifier.astNodeData.leakSourceASTNodeIdxs) do
vEditor.selectedASTNodeMap[v] = true
tooltipStr = tooltipStr .. "\nLeaking into parts:"
for _,v in ipairs(modifier.leakingToParts) do
tooltipStr = tooltipStr .. "\n- " .. v
if modifier.astNodeData.affectedRowsASTNodeIdxs then
for k,v in ipairs(modifier.astNodeData.affectedRowsASTNodeIdxs) do
for k2,v2 in ipairs(v) do
for k,v in ipairs(modifier.astNodeData.affectedRowsASTNodeIdxs) do
for k2,v2 in ipairs(v) do
vEditor.selectedASTNodeMap[v2] = true
@/lua/ge/extensions/freeroam/bigMapMarkers.lua
table.sort(validIds)
for _, e in ipairs(validIds) do
settingsId = settingsId .. e
--print("Begin Update")
for _, csId in ipairs(clusterSettingsIdsSorted) do
--print(csId)
local clusters = M.getAllClustersBySettings(csId)
for _, cluster in ipairs(clusters) do
local marker = M.getClusterMarker(cluster)
end
for i, cluster in ipairs(M.getAllClustersBySettings(currentClusterSettingsId)) do
local iconInfo = clusterIconRenderer:getIconByName(cluster.id .. "bigMap")
local function getIdsFromHoveredPoiId(id)
for i, cluster in ipairs(M.getAllClustersBySettings(currentClusterSettingsId)) do
if cluster.containedIdsLookup[id] then
--local validCopy = deepcopy(settings.validIdsLookup)
for _, poi in ipairs(elements) do
if settings.validIdsLookup[poi.id] and poi.markerInfo.bigmapMarker then
local count = 0
for i, poi in ipairs(filteredPois) do
qt:preLoad(i, quadtree.pointBBox(poi.markerInfo.bigmapMarker.pos.x, poi.markerInfo.bigmapMarker.pos.y, settings.radius))
-- remove all the elements in the cluster from the qt and the locations list
for _, c in ipairs(cluster) do
qt:remove(c._qtId, filteredPois[c._qtId].markerInfo.bigmapMarker.pos.x, filteredPois[c._qtId].markerInfo.bigmapMarker.pos.y)
@/gameplay/missionTypes/cannon/customNodes/cannonBallInfoNode.lua
local insideThreshold = self.pinIn.camSlowMoDist.value
for _, id in ipairs(targetIds) do
if not self.mgr.modules.vehicle:getVehicle(id).dead then
@/lua/vehicle/extensions/tech/LINBus/LINBusPeak.lua
if data then
for index, byte in ipairs(data) do
msg.Data[index - 1] = byte --start data array at [0]
@/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/flowgraph/nodes/gameplay/race/raceMarkers.lua
local wps = {}
for _, pn in ipairs(self.pinIn.raceData.value.path.pathnodes.sorted) do
table.insert(wps, {name = pn.id, pos = pn.pos, radius = pn.radius, normal = pn.hasNormal and pn.normal or nil})
-- Add next waypoint position to each waypoint
for i, wp in ipairs(wps) do
local nextIndex = (i % #wps) + 1 -- Loop back to 1 at the end
end
for _, e in ipairs(state.nextPathnodes) do
wps[e[1].id] = e[2]
end
for _, e in ipairs(state.overNextPathnodes) do
wps[e[1].id] = 'next'
if self.pinIn.alwaysShowFinal.value then
for _, id in ipairs(self.pinIn.raceData.value.path.config.finalSegments) do
wps[self.pinIn.raceData.value.path.config.graph[id].targetNode] = 'final'
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/rallySuperCountdown.lua
local timeUntilEvent = self.scheduledEventTime - currentEpochTime
for _, warningTime in ipairs(defaultWarningTimes) do
if timeUntilEvent < warningTime then
local timeUntilEvent = scheduledEventTime - currentEpochTime
for _, warningTime in ipairs(defaultWarningTimes) do
if timeUntilEvent < warningTime then
for _, warningTime in ipairs(defaultWarningTimes) do
if timeUntilEvent <= warningTime and not self.warningsTriggered[warningTime] then
local timeUntilEvent = self.scheduledEventTime - targetEpochTime
for _, warningTime in ipairs(defaultWarningTimes) do
if timeUntilEvent < warningTime then
@/lua/ge/extensions/editor/suspensionAudioDebug.lua
if editor_suspensionAudioDebug.beamSounds then
for bi, snd in ipairs(editor_suspensionAudioDebug.beamSounds) do
if not snd.beamPos then
for i, v in pairs(filter) do
for bi, val in ipairs(editor_suspensionAudioDebug.beamSounds) do
if v == val.position then
@/lua/common/testFramework/TestManager.lua
local startTime = socket.gettime()
for _, name in ipairs(testNames) do
local func = tests[name]
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veFlexbodyDebug.lua
for k, objData in ipairs(hitObjects) do
if k >= 2 then
for k, id in ipairs(ids) do
state.pickedVerticesID[k] = id
-- Get list of nodes hovered over by mouse cursor
for _, nodeID in ipairs(flexbody._group_nodes) do
local node = vEditor.vdata.nodes[nodeID]
-- Get list of vertices hovered over by mouse cursor
for _, i in ipairs(state.pickedVerticesID) do
local vertPos = flexbodyObj:getDebugVertexPos(i) + vehPos
table.clear(flexNodePositions)
for _, nodeID in ipairs(flexbody._group_nodes) do
flexNodePositions[nodeID] = vEditor.vehicle:getNodeAbsPosition(nodeID)
for _, nodeID in ipairs(vertLocNodes) do
if nodeID == state.pickedNodesID[1] then
for _, vertexID in ipairs(state.pickedVerticesID) do
if vertexID == i then
or state.mode == MODE_PICKING_VERTEX then
for _, nodeID in ipairs(flexbody._group_nodes) do
nodePos:set(flexNodePositions[nodeID])
for k, nodeID in ipairs(locNodes) do
if nodeID ~= -1 then
elseif state.mode == MODE_SHOW_VERTICES_LACKING_NODES then
for _, nodeID in ipairs(flexbody._group_nodes) do
nodePos:set(vEditor.vehicle:getNodeAbsPositionXYZ(nodeID))
for _, name in ipairs(sorted) do
table.insert(initStates[vehID].sortedFlexbodiesData, vehData.vdata.flexbodies[namesToID[name]])
-- Go through list of flexbody nodes
for _, nodeID in ipairs(flexbody._group_nodes) do
local node = vEditor.vdata.nodes[nodeID]
im.Text("Favorites")
for i, id in ipairs(state.settings.favoriteFlexmeshes) do
local flexbody = state.sortedFlexbodiesData[id]
for _, nodeID in ipairs(flexbody._group_nodes) do
local dist = (vEditor.vdata.nodes[nodeID].pos - vertexPos):length()
for k, v in ipairs(tbl) do
dists[k] = v[1]
for k, dist in ipairs(dists) do
if dist > upper then
for k, verticesData in ipairs(state.verticesOOBCoordsData.data) do
local flexID = state.verticesOOBCoordsData.idxToFlexID[k]
if im.TreeNodeEx1(flexmesh.mesh .. "##" .. tostring(k)) then
for _, vertData in ipairs(verticesData) do
local vertID = vertData.id
if im.BeginChild1("##renderVerticesLackingNodesWindowData") then
for k, verticesData in ipairs(state.verticesLackingNodesData.data) do
local flexID = state.verticesLackingNodesData.idxToFlexID[k]
@/lua/ge/extensions/editor/crawlEditor/startingPositions.lua
local allStartingPositions = editor_crawlEditor.getAllStartingPositions()
for i, sp in ipairs(allStartingPositions) do
if sp == startingPosition then
for i, startingPosition in ipairs(allStartingPositions) do
local isSelected = (i == selection.index)
@/lua/ge/extensions/gameplay/delivery/delivery.lua
local distance = 0
for _, pair in ipairs(positions) do
local name_a,_,distance_a = map.findClosestRoad(pair[1])
@/lua/vehicle/extensions/tech/ACC.lua
local total = 0
for _, speed in ipairs(speeds) do
total = total + speed
@/lua/ge/extensions/flowgraph/nodes/gameplay/sites/locationsByTag.lua
-- if we have no distance constraints, we can use tagsToLocations field
for _, loc in ipairs(self.pinIn.sitesData.value.tagsToLocations[self.pinIn.tag.value] or {}) do
table.insert(all, loc)
-- otherwise we have to query the quadtree and then check for tags ourselves.
for _, elem in ipairs(self.pinIn.sitesData.value:getRadialLocations(vec3(self.pinIn.pos.value), self.pinIn.minDist.value, self.pinIn.maxDist.value)) do
local loc = elem.loc
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/filePath.lua
local rCount = 0
for _, pn in ipairs(path.pathnodes.sorted) do
if self.pinIn.reverse.value then
@/lua/common/libs/luasocket/socket/smtp.lua
if base.type(mailt.rcpt) == "table" then
for i,v in base.ipairs(mailt.rcpt) do
self:rcpt(v)
-- send each part separated by a boundary
for i, m in base.ipairs(mesgt.body) do
coroutine.yield("\r\n--" .. bd .. "\r\n")
@/lua/ge/extensions/editor/api/dynamicDecals/textures.lua
local function removeTags(textureFilepath, tagsToRemove)
for _, tag in ipairs(tagsToRemove) do
if tagsWithRefs[tag] then
if tagsWithRefs[tag] then
for k, v in ipairs(tagsWithRefs[tag]) do
if v == textureFilepath then
tagsWithRefs[tag] = nil
for kk, t in ipairs(tags) do
if t == tag then
if data.tags then
for _, tag in ipairs(data.tags) do
if not tagsWithRefs[tag] then
for _, filepath in ipairs(textureFiles) do
local dirName, fileName, extension = path.split(filepath)
if data.tags then
for _, tag in ipairs(data.tags) do
if not tagsWithRefs[tag] then
local function textureExists(filepath)
for k, path in ipairs(textureFiles) do
if path == filepath then
@/lua/ge/simTimeAuthority.lua
M.selectionSlot = #bulletTimeSlots
for currSlot,currTimescale in ipairs(bulletTimeSlots) do
local selectionDiff = math.abs(M.simulationSpeed - bulletTimeSlots[M.selectionSlot])
@/lua/vehicle/powertrain/electricMotor.lua
local dashes = {nil, {10, 4}, {8, 3, 4, 3}, {6, 3, 2, 3}, {5, 3}}
for k, v in ipairs(curves) do
v.dash = dashes[k]
@/lua/ge/extensions/editor/dynamicDecals/layerStack.lua
if not layer.children then return false end
for _, child in ipairs(layer.children) do
if child.type == api.layerTypes.decal or child.type == api.layerTypes.path or child.type == api.layerTypes.brushStroke then
if im.Button(layer.mask and "Replace Layer Mask" or "Paste Layer Mask") then
for _, maskLayer in ipairs(layerMaskCopyData.layers) do
maskLayer.uid = api.getRandomUid()
local layerCopy = deepcopy(layer)
for _, maskLayer in ipairs(layerMaskCopyData.layers) do
maskLayer.uid = api.getRandomUid()
if im.TreeNodeEx1(string.format("Layer Mask##%s_%s", layer.uid, guiId)) then
for k, maskLayer in ipairs(layer.mask.layers) do
im.SetCursorPosX(indentedCursorPosX)
else -- BOTTOM TO TOP LAYER STRUCTURE [CHILDREN]
for k, child in ipairs(layer.children) do
for k, layer in ipairs(api.getLayerStack()) do
@/lua/ge/extensions/flowgraph/nodes/ui/genericMissionDataText.lua
self.pinInLocal.title.hardTemplates = {}
for _, k in ipairs({"time","recoveries"}) do
local key = "missions.missions.general." .. k
@/lua/ge/extensions/core/modmanager.lua
local files = FS:findFiles('/vehicles/', '*', 0, true, true)
for _, path in ipairs(files) do
if string.startswith(path, "/vehicles/") and not string.startswith(path, "/vehicles/mod_info") then
local modFiles = FS:findFiles(filename, '*', -1, true, false)
for i,e in ipairs(modFiles) do
local tmp = e:gsub(filename, "")
local oldModToDelete = {}
for _, filepath in ipairs(filelist) do
-- log('D', 'checkDuplicatedMods', "filepath = ".. dumps(filepath) )
local fileList = {}
for k, v in ipairs(unpackedList) do table.insert(fileList, v) end
for k, v in ipairs(zipfileList) do table.insert(fileList, v) end
for k, v in ipairs(unpackedList) do table.insert(fileList, v) end
for k, v in ipairs(zipfileList) do table.insert(fileList, v) end
fileList = checkDuplicatedMods(fileList)
local modScriptFiles = FS:findFiles('/scripts/', 'modScript.lua', -1, true, false)
for k,v in ipairs(modScriptFiles) do
local status, ret = pcall(dofile, v)
modScriptFiles = FS:findFiles('/mods_data/', 'modScript.lua', 1, true, false)
for k,v in ipairs(modScriptFiles) do
if not pcall(dofile, v) then
log("W", "", "Possibly broken mod detected: "..dumps(mod)..". It overwrites the following files:")
for _,file in ipairs(files) do
log("W", "", " - Overwriten file: "..dumps(file))
if mods[modname].modData and mods[modname].modData.hashes then --repo mod
for i,e in ipairs(mods[modname].modData.hashes) do
mountedFilesChange[i] = {filename = "/" .. _cleanPathFromHash(e[1]) , type = reason } --e[2] is hash
local modFiles = FS:findFiles(mods[modname].unpackedPath, '*', -1, true, false)
for i,e in ipairs(modFiles) do
local tmp = e:gsub(mods[modname].unpackedPath, "")
local filesInZIP = zip:getFileList()
for k,v in ipairs(filesInZIP) do
mountedFilesChange[#mountedFilesChange+1] = {filename = v, type = reason }
if mods[modname].modData and mods[modname].modData.hashes then --repo mod
for i,e in ipairs(mods[modname].modData.hashes) do
local fp = "/" .. _cleanPathFromHash(e[1]) --e[2] is hash
local filesInZIP = zip:getFileList()
for k,v in ipairs(filesInZIP) do
if (string.startswith(v,'/scripts/') or string.startswith(v,'/mods_data/'))
for k,v in ipairs(modScripts) do
local status, ret = pcall(dofile, v)
for k,v in ipairs(modScripts) do
local status, ret = pcall(dofile, v)
local extractionRes = true
for i,v in ipairs(files) do
--print('extractFile: ' .. tostring(v) .. ' -> ' .. tostring(targetPath) .. v)
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/vePropTransformer.lua
for k, objData in ipairs(hitObjects) do
if k >= 2 then
@/lua/ge/extensions/tech/multiscreen.lua
if destroyCameraToWindow then
for _, view in ipairs(M.views) do
destroyCameraToWindow(view.name)
local vehiclePosition = veh:getPosition()
for _, view in ipairs(M.views) do
local pos = vehiclePosition + (vehicleRotation * view.position)
@/lua/ge/extensions/gameplay/traffic/trafficUtils.lua
local filteredFiles = {}
for _, v in ipairs(files) do
local _, fn = path.splitWithoutExt(v)
local traffic = gameplay_traffic.getTrafficData()
for _, veh in ipairs(getAllVehicles()) do
if veh:getActive() then
--route:setupPathMultiWaypoints(path)
for _, wp in ipairs(path) do
table.insert(route.path, {pos = map.getMap().nodes[wp].pos, wp = wp, linkCount = map.getNodeLinkCount(wp)}) -- optimized route path creation
local bestDist = math.huge
for _, id in ipairs(gameplay_traffic.getTrafficAiVehIds()) do
local veh = gameplay_traffic.getTraffic()[id]
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamBeautifier.lua
end
for _, warning in ipairs(warnings) do
log('W', 'jsonDecode', warning)
for _, sectionToBeautifyData in ipairs(sectionsToBeautifyTblPtr) do
local sectionName, toBeautify = sectionToBeautifyData[1], sectionToBeautifyData[2][0]
for rowIdx, rowData in ipairs(section) do
if alignHeaderEnabledPtr[0] or rowIdx > 1 then
for k, astIdx in ipairs(rowASTNodeIdxs) do
if k ~= rowASTNodeIdxsSize then
for _, partASTIdx in ipairs(tableKeysSorted(astIdxToPart)) do
local partName = astIdxToPart[partASTIdx]
local astIdxToSection = {}
for _, sectionToBeautifyData in ipairs(sectionsToBeautifyTblPtr) do
local sectionName, toBeautify = sectionToBeautifyData[1], sectionToBeautifyData[2][0]
for _, sectionASTIdx in ipairs(tableKeysSorted(astIdxToSection)) do
local sectionName = astIdxToSection[sectionASTIdx]
for rowIdx, rowData in ipairs(section) do
if alignHeaderEnabledPtr[0] or rowIdx > 1 then
for _, jbeamFilePath in ipairs(jbeamFilePaths) do
local res = beautifyJBeamFile(jbeamFilePath)
im.PopFont()
for k,v in ipairs(sectionsToBeautifyTblPtr) do
local sectionName, boolPtr = v[1], v[2]
@/lua/ge/extensions/gameplay/police.lua
for _, id in ipairs(vehIds) do
local veh = getObjectByID(id)
for _, v in ipairs(temp) do
rbWidth = rbWidth - v[2]
for i, id in ipairs(vehIds) do
local veh = getObjectByID(id)
local function setPropsActive(active, reset)
for _, v in ipairs(policePropIds) do
getObjectByID(v):setActive(active and 1 or 0)
for _, id in ipairs(policeIds) do
local veh = policeVehs[id]
local offensesTranslated = {}
for _, v in ipairs(veh.pursuit.offensesList) do
table.insert(offensesTranslated, translateLanguage(string.format('ui.traffic.infractions.%s', v), v))
if policeIds then
for _, id in ipairs(policeIds) do
gameplay_traffic.insertTraffic(id, id == options.playerId, true)
if pursuit.mode >= 0 then
for i, score in ipairs(vars.scoreLevels) do
if pursuit.mode < i and pursuit.score >= score then
newPropIds = checkRoadblock(policePropIds, rbWidth, false)
for _, pid in ipairs(newPropIds) do
maxPropLength = max(maxPropLength, getObjectByID(pid).initialNodePosBB:getExtents().y)
for _, vid in ipairs(newVehIds) do
local vehData = policeVehs[vid]
@/gameplay/missionTypes/scatterPickup/customNodes/scatterPrefabSetupNode.lua
shapes.mixed = {}
for _, key in ipairs(shapeKeys) do
for _, option in ipairs(shapes[key]) do
for _, key in ipairs(shapeKeys) do
for _, option in ipairs(shapes[key]) do
table.insert(shapes.mixed, option)
-- Calculate the total frequency of all options
for _, option in ipairs(options) do
totalFrequency = totalFrequency + option.frequency
--print(n)
for _, option in ipairs(options) do
local amount = math.ceil((option.frequency / totalFrequency) * (n))
local list = generateList(#points, shapes[type])
for listIdx, point in ipairs(points) do
local object = createObject("TSStatic")
function C:onNodeReset()
for _, id in ipairs(self.objectIds) do
if id then
if iconRendererObj and self.mgr.scatterPickup then
for _, icon in ipairs(self.mgr.scatterPickup.icons) do
iconRendererObj:removeIconById(icon.iconId)
@/lua/ge/extensions/career/modules/inspectVehicle.lua
if hasVehicles then
for _, vehId in ipairs(vehicleIds) do
gameplay_traffic.forceTeleport(vehId)
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
if elem.type == "inspectVehicle" then
@/lua/ge/extensions/editor/biomeTool.lua
local layers = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerType == layerType then
local ret = nil
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerType == layerType and layer.layerID == layerID then
if isDrawingLassoArea then
for nodeIndex, node in ipairs(var.lassoPLNodes) do
local distNodeToCam = (node.pos - camPos):length()
local selectedLassoAreaID = nil
for _, selection in ipairs(var.layers.selectedLayerIDs) do
if selection.layerType == layerType_enum.area then
local lassoAreas = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == selectedLassoAreaID and layer.layerType == layerType_enum.area then
--local lassoArea = {lassoAreaID = getLassoAreaGlobalIdx(layerID, zoneType) + 1, zoneType = zoneType, nodes = deepcopy(nodes)}
for _, lassoArea in ipairs(layer.lassoAreas) do
for nodeIndex, node in ipairs(lassoArea.nodes) do
for _, lassoArea in ipairs(layer.lassoAreas) do
for nodeIndex, node in ipairs(lassoArea.nodes) do
local distNodeToCam = (node.pos - camPos):length()
local indexFound = false
for _, zoneIndexInfo in ipairs(exclusionZoneIndices) do
if zoneIndexInfo.areaID == areaID and zoneIndexInfo.layerID == layerID then
local removeIndex = -1
for index, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerType == layerType and layer.layerID == layerID then
local function insertFieldInfo(layerType, layerID, fieldData)
for _, fieldInfo in ipairs(var.layers.fieldInfoTbl) do
if fieldInfo.layerType == layerType and fieldInfo.layerID == layerID then
local layerInfo = nil
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerType == layerType and layer.layerID == layerID then
local layerType = nil
for _, area in ipairs(var.areas.areaInfoTbl) do
if area.areaID == areaID then
if area.areaID == areaID then
for _, layer in ipairs(area.layers) do
if layer.layerID == layerID then
local itemFound = false
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local itemFound = false
for _, selectedItemsInfo in ipairs(var.forestBrushTempSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
if not table then return -1 end
for i,v in ipairs(table) do
if v == value then return i end
local selected = false
for _, selectedItemsInfo in ipairs(var.forestBrushTempSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
end
for _, selectedItemsInfo in ipairs(var.forestBrushTempSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local function deselectForestTempBrush(layerType, layerID, internalName, zoneType)
for _, selectedItemsInfo in ipairs(var.forestBrushTempSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local data = {}
for _, info in ipairs(var.layers.fieldInfoTbl) do
if (info.layerType == layerType or info.layerType == layerType_enum.any) and info.layerID == layerID then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Map" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Map" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Freq" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Seed" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Amp" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Thr" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Oct" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Mask" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Mask" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_Material" then
local mtls = terrainBlock:getMaterials()
for index, mtl in ipairs(mtls) do
if materialName == mtl.internalName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "RA_LassoAreas" then
local found = false
for _, indexData in ipairs(var.layers.layerGlobalIndices) do
if indexData.layerType == layerType then
local found = false
for _, indexData in ipairs(var.layers.layerGlobalIndices) do
if indexData.layerType == layerType then
local fieldMinMaxPair = {}
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if fieldInfo.name == name then
for _, fieldInfo in ipairs(var.layers.fieldInfoTbl) do
if fieldInfo.layerType == layerType and fieldInfo.layerID == layerID then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType then
for index, node in ipairs(var.lassoPLNodes) do
local nodeColor = roadRiverGui.highlightColors.node
for _, node in ipairs(var.lassoPLNodes) do
node.isUpdated = false
local lassoAreas = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.zoneType == var.enum_lassoDrawType.inclusionZone then
local lassoAreas = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
table.insert(lassoAreas, lassoArea)
local lassoAreas = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.zoneType == var.enum_lassoDrawType.inclusionZone then
local lassoNodes = {}
for _, node in ipairs(lassoArea.nodes) do
table.insert(lassoNodes, node.pos)
local lassoAreas = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.zoneType == var.enum_lassoDrawType.inclusionZone and lassoArea.lassoAreaID == lassoAreaID then
local lassoNodes = {}
for _, node in ipairs(lassoArea.nodes) do
table.insert(lassoNodes, node.pos)
local function drawLassoAreas(layerID)
for index, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID then
if layer.layerID == layerID then
for index, lassoArea in ipairs(layer.lassoAreas) do
if highlighAnimation.isHighligthing and highlighAnimation.elapsed < highlighAnimation.duration then
local numNodes = tableSize(lassoArea.nodes)
for index, node in ipairs(lassoArea.nodes) do
local nodeColor = roadRiverGui.highlightColors.node
local layers = getLayers(areaID)
for _, layer in ipairs(layers) do
layerType = layer.layerType
local forestItemsTbl = {}
for _, layerItemsEntry in ipairs(var.layers.forestItemsTbl) do
if layerItemsEntry.layerType == layerType and layerItemsEntry.layerID == layerID then
local forestData = forest:getData()
for _, itemUID in ipairs(itemUIDs) do
local item = forestData:findItemByUid(itemUID)
local function setLayerName(layerType, layerID, name)
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerType == layerType and layer.layerID == layerID then
local selected = false
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
end
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local function deselectForestBrush(layerType, layerID, internalName, zoneType)
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local function clearForestBrushSelection(layerType, layerID, zoneType)
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local forestBrushElementIds = scenetree.findClassObjects("ForestBrushElement")
for _, id in ipairs(forestBrushElementIds) do
local fbe = scenetree.findObject(id)
local brushSelection = getForestBrushSelection(layerType, layerID, zoneType)
for _, brushName in ipairs(brushSelection) do
local elements = getElementsForBrush(brushName)
local density = nil
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "ForestDensity"then
local function setForestDensity(layerType, layerID, value)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "ForestDensity"then
local density = nil
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "BordersDensity"then
local function setBorderDensity(layerType, layerID, value)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "BordersDensity"then
local density = nil
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "BordersFalloff"then
local function setForestBorderFallOff(layerType, layerID, value)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "BordersFalloff"then
local function setFieldValue(fieldName, fieldValue, customData)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == customData.layerType and item.layerID == customData.layerID then
if item.layerType == customData.layerType and item.layerID == customData.layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == fieldName then
local function isExclusionZoneSelected(areaID, layerID, zoneID)
for _, zone in ipairs(var.areas.exclusionZones) do
if zone.areaID == areaID and zone.layerID == layerID then
if zone.areaID == areaID and zone.layerID == layerID then
for _, zoneData in ipairs(zone.zoneData) do
if zoneData.ID == zoneID then
local function isAnyZoneSelected(areaID, layerID)
for _, zone in ipairs(var.areas.exclusionZones) do
if zone.areaID == areaID and zone.layerID == layerID then
if zone.areaID == areaID and zone.layerID == layerID then
for _, zoneData in ipairs(zone.zoneData) do
if zoneData.isSelected then
local function setZoneSelected(areaID, layerID, zoneID, select)
for _, zone in ipairs(var.areas.exclusionZones) do
if zone.areaID == areaID and zone.layerID == layerID then
if zone.areaID == areaID and zone.layerID == layerID then
for _, zoneData in ipairs(zone.zoneData) do
if zoneData.ID == zoneID then
local function clearExZoneSelection(areaID, layerID)
for _, zone in ipairs(var.areas.exclusionZones) do
if zone.areaID == areaID and zone.layerID == layerID then
if zone.areaID == areaID and zone.layerID == layerID then
for _, zoneData in ipairs(zone.zoneData) do
zoneData.isSelected = false
local itemFound = false
for _, blendingData in ipairs(var.layers.layerBlendingComboIndexTbl) do
if blendingData.layerType == layerType and blendingData.layerID == layerID then
local itemFound = false
for _, blendingData in ipairs(var.layers.layerBlendingComboIndexTbl) do
if blendingData.layerType == layerType and blendingData.layerID == layerID then
local available = false
for _, field in ipairs(fieldsTbl) do
if field.name == fieldName then
local layerType, layerID, fieldName, layerType
for _, fieldInfos in ipairs(var.layers.fieldInfoTbl) do
layerType = fieldInfos.layerType
layerID = fieldInfos.layerID
for _, fieldData in ipairs(fieldInfos.fieldsData) do
for _, fieldInfo in ipairs(fieldInfoTemplate) do
for _, fieldData in ipairs(fieldInfos.fieldsData) do
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if layerType == fieldInfo.layerType then
if layerType == fieldInfo.layerType then
for _, rowPlFieldName in ipairs(rowPlacementFields) do
if fieldInfo.name == rowPlFieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "FieldPlacement" then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local slopeRange = {0, 90}
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "SlopeRange"then
local function setSlopeRange(layerType, layerID, range)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "SlopeRange"then
local minMax = {0, 0}
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local slopeRange = {-5, 5}
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "EP_RandomTilt"then
local fieldName = "EP_RandomTilt"
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local fieldName = "EP_BorderFalloff"
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local fieldName = "EP_ItemDistance"
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local fieldName = "EP_ItemDistance"
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local slopeInfluence = 0
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "SlopeInfluence"then
local function setSlopeInfluence(layerType, layerID, value)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "SlopeInfluence"then
local forestItemsTbl = nil
for _, layerItemsEntry in ipairs(var.layers.forestItemsTbl) do
if layerItemsEntry.layerType == layerType and layerItemsEntry.layerID == layerID then
for _, forestItemUid in ipairs(itemUIDs) do
table.insert(forestItemsTbl, forestItemUid)
local fieldsData = getFieldsData(layerType_enum.terrain, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "TerrainMaterial" then
local function setTerrLayerMaterial(layerID, materialIndex)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType_enum.terrain and item.layerID == layerID then
if item.layerType == layerType_enum.terrain and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "TerrainMaterial" then
local fieldsData = getFieldsData(layerType_enum.terrain, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "TerrainMask" then
local function setTerrLayerMask(layerID, maskFile)
for _, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType_enum.terrain and item.layerID == layerID then
if item.layerType == layerType_enum.terrain and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == "TerrainMask" then
local layer = nil
for _, selection in ipairs(var.layers.selectedLayerIDs) do
if selection.layerType == layerType then
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.zoneType == var.enum_lassoDrawType.exclusionZone then
local lassoNodes = {}
for _, node in ipairs(lassoArea.nodes) do
table.insert(lassoNodes, node.pos)
local itemKeys = {}
for _, key in ipairs(itemsToAdd) do
table.insert(itemKeys, key)
local field = nil
for index, item in ipairs(var.layers.fieldInfoTbl) do
if item.layerType == layerType and item.layerID == layerID then
if item.layerType == layerType and item.layerID == layerID then
for _, fieldData in ipairs(item.fieldsData) do
if fieldData.name == fieldName then
local selectionList = {}
for _, selectedItemsInfo in ipairs(var.forestBrushTempSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local itemFound = false
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local itemFound = false
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
for _, selectedItemsInfo in ipairs(var.forestBrushTempSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
local noBrushSelected = true
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
selectedItemsInfo.zoneType == enum_forestBrushItemZone.central then
for index, item in ipairs(var.forestBrushes) do
if (indexOf(selectedItemsInfo.selectedItems, item.internalName) ~= -1) then
for index, item in ipairs(var.forestBrushes) do
if not isForestBrushSelected(layerType, layerID, item.internalName, enum_forestBrushItemZone.central) then goto continue end
local noBrushSelected = true
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
selectedItemsInfo.zoneType == enum_forestBrushItemZone.falloff then
for index, item in ipairs(var.forestBrushes) do
if (indexOf(selectedItemsInfo.selectedItems, item.internalName) ~= -1) then
for index, item in ipairs(var.forestBrushes) do
if not isForestBrushSelected(layerType, layerID, item.internalName, enum_forestBrushItemZone.falloff) then goto continue end
for index, item in ipairs(var.forestBrushes) do
local isBrushSelected = isForestBrushTempSelected(layerType, layerID, item.internalName, enum_forestBrushItemZone.central)
for index, item in ipairs(var.forestBrushes) do
local isBrushSelected = isForestBrushTempSelected(layerType, layerID, item.internalName, enum_forestBrushItemZone.falloff)
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
if not itemFound then
for _, fieldInfo in ipairs(fieldInfoTemplate) do
if (fieldInfo.layerType == layerType_enum.any or layerType == fieldInfo.layerType) and fieldInfo.name == fieldName then
local fieldsData = getFieldsData(layerType, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local itemFound = false
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == fieldName then
local noBrushSelected = true
for _, selectedItemsInfo in ipairs(var.layers.forestBrushSelectedItems) do
if selectedItemsInfo.layerType == layerType and selectedItemsInfo.layerID == layerID and
selectedItemsInfo.zoneType == enum_forestBrushItemZone.edge then
for index, item in ipairs(var.forestBrushes) do
if (indexOf(selectedItemsInfo.selectedItems, item.internalName) ~= -1) then
for index, item in ipairs(var.forestBrushes) do
if not isForestBrushSelected(layerType, layerID, item.internalName, enum_forestBrushItemZone.edge) then goto continue end
for index, item in ipairs(var.forestBrushes) do
local isBrushSelected = isForestBrushTempSelected(layerType, layerID, item.internalName, enum_forestBrushItemZone.edge)
local mtls = terrainBlock:getMaterials()
for index, mtl in ipairs(mtls) do
table.insert(layerCreateMtlComboItemsTbl, mtl.internalName)
local mtls = terrainBlock:getMaterials()
for matIndex, mtl in ipairs(mtls) do
if matIndex == index then
local function setItemTransformUndo(actionData)
for index, item in ipairs(actionData.items) do
actionData.items[index] = editor.updateForestItem(var.forestData, item:getKey(), item:getPosition(), item:getData(), editor.tableToMatrix(actionData.oldTransforms[index]), item:getScale())
local function setItemTransformRedo(actionData)
for index, item in ipairs(actionData.items) do
actionData.items[index] = editor.updateForestItem(var.forestData, item:getKey(), item:getPosition(), item:getData(), editor.tableToMatrix(actionData.newTransforms[index]), item:getScale())
local found = false
for _, selection in ipairs(var.layers.selectedLayerIDs) do
if selection.layerType == layer.layerType then
local found = false
for _, selection in ipairs(var.layers.selectedLayerIDs) do
if selection.layerType == layer.layerType and selection.selectedLayerID == layer.layerID then
local selected = false
for _, selection in ipairs(var.layers.selectedLayerIDs) do
if selection.layerType == layer.layerType and selection.selectedLayerID == layer.layerID then
local delLayer = nil
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for lassoIndex, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.lassoAreaID == areaID and lassoArea.zoneType == zoneType then
local lassoNodes2D = {}
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.zoneType == var.enum_lassoDrawType.inclusionZone and lassoArea.lassoAreaID == lassoAreaID then
if lassoArea.zoneType == var.enum_lassoDrawType.inclusionZone and lassoArea.lassoAreaID == lassoAreaID then
for _, node in ipairs(lassoArea.nodes) do
table.insert(lassoNodes2D, Point2F(node.pos.x, node.pos.y))
local forestData = forest:getData()
--for _, itemUID in ipairs(itemUIDs) do
for _, item in ipairs(forestItems) do
--for _, itemUID in ipairs(itemUIDs) do
for _, item in ipairs(forestItems) do
--if item:getUid() == itemUID then
local count = 0
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
imgui.BeginChild1("LayersList", imgui.ImVec2(imgui.GetContentRegionAvail().x, imgui.GetContentRegionAvail().y - 4), imgui.WindowFlags_ChildWindow)
for _, layer in ipairs(layers) do
if imgui.CollapsingHeader1(layer.layerName..'##'..layer.layerID, setHeaderState(layer.layerName..'##'..layer.layerID, isLayerSelected(layer))) then
local function updateNodePosInArea(layerID, areaID, areaType, nodeIndex, pos)
for index, layer in ipairs(var.layers.layerInfoTbl) do
if layerID == layer.layerID then
if layerID == layer.layerID then
for index, lassoArea in ipairs(layer.lassoAreas) do
if areaID == lassoArea.lassoAreaID and areaType == lassoArea.zoneType then
if areaID == lassoArea.lassoAreaID and areaType == lassoArea.zoneType then
for index, node in ipairs(lassoArea.nodes) do
if nodeIndex == index then
local numAreas = 0
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
for _, lassoArea in ipairs(layer.lassoAreas) do
if lassoArea.zoneType == zoneType then
if zoneType == var.enum_lassoDrawType.inclusionZone then
for _, indexData in ipairs(var.layers.lassoAreaGlobalIndices) do
if indexData.layerID == layerID then
found = false
for _, indexData in ipairs(var.layers.exZoneGlobalIndices) do
if indexData.layerID == layerID then
if zoneType == var.enum_lassoDrawType.inclusionZone then
for _, indexData in ipairs(var.layers.lassoAreaGlobalIndices) do
if indexData.layerID == layerID then
elseif zoneType == var.enum_lassoDrawType.exclusionZone then
for _, indexData in ipairs(var.layers.exZoneGlobalIndices) do
if indexData.layerID == layerID then
local function addLassoArea(layerID, zoneType, nodes)
for _, layer in ipairs(var.layers.layerInfoTbl) do
if layer.layerID == layerID and layer.layerType == layerType_enum.area then
var.forestItemData = {}
for k, forestItemDataId in ipairs(forestItemDataNames) do
local cobj = scenetree.findObject(forestItemDataId)
local fieldsData = getFieldsData(areaID, layerID)
for _, fieldData in ipairs(fieldsData) do
if fieldData.name == "TerrainMaterial" then
@/lua/ge/extensions/flowgraph/nodes/vehicle/beamstate/beamstate.lua
if im.BeginCombo("##beamFunc" .. self.id, self.selected) then
for _, fun in ipairs(self.functions) do
if im.Selectable1(fun, fun == self.selected) then
@/lua/ge/extensions/career/modules/logbook.lua
local ret = { }
for _, e in ipairs(logbook) do
table.insert(ret, e)
local ret = {}
for _, e in ipairs(logbook) do
if not e.read and e.isPopup then
byRead[false] = {}
for _, entry in ipairs(getLogbook()) do
if not entry.hideInRecent then
--print("Setting Logbook entry to read" .. entryId .. " -> " ..dumps(read))
for _, e in ipairs(logbook) do
if e.entryId == entryId then
if not next(logbook) then
for _, key in ipairs(arrayReverse(logbookEntries)) do
M.logbookEntry(key)
@/lua/common/lpack.lua
if not pcall(require, "table.clear") then
table.clear = function(tab) for k, _ in ipairs(tab) do tab[k] = nil end end
end
@/lua/ge/extensions/editor/sceneTree.lua
if node.isGroup and (not showGroups or node.open or node.openOnSearch) and node.children then
for orderIndex, childId in ipairs(node.renderChildrenOrder) do
local child = node.children[childId]
local expandableClasses = {"PrefabInstance", "SimGroup", "SimSet"}
for i,v in ipairs(expandableClasses) do
if v == className then
if childrenIds then
for _, objId in ipairs(childrenIds) do
local object = scenetree.findObjectById(objId)
if not instance.selectedNodes or tableIsEmpty(instance.selectedNodes) then return end
for _, node in ipairs(instance.selectedNodes) do
if node.parent then
local oldGroups = {}
for _, node in ipairs(instance.selectedNodes) do
local object = scenetree.findObjectById(node.id)
if actionData.oldGroups then
for index, oldGroupId in ipairs(actionData.oldGroups) do
if oldGroupId ~= actionData.newGroup then
local highestNode
for i, node in ipairs(nodes) do
local level = getNodeLevel(node)
if node.selected then
for _, n in ipairs(instance.selectedNodes) do
setFieldRec(n, newValue, objectIDs)
local oldGroups = {}
for _, node in ipairs(instance.selectedNodes) do
local object = scenetree.findObjectById(node.id)
local validCustomMenuItems = {}
for _, item in ipairs(extendedSceneTreeObjectMenuItems) do
local validator = item.validator or function(obj) return true end
local generateExtendedSceneTreeObjectMenuItems = function(items)
for _, item in ipairs(items) do
if item.title and imgui.Selectable1(item.title) and item.extendedSceneTreeObjectMenuItems then
for orderIndex, childId in ipairs(node.renderChildrenOrder) do
local child = node.children[childId]
for li, n in ipairs(searchResults) do
n.listIndex = li
for index, instance in pairs(guiInstancer.instances) do
for _, id in ipairs(selectedIds) do
local node = findNodeById(instance, nil, id)
@/lua/ge/extensions/career/modules/branches/landing.lua
for _, tierData in pairs(rewards) do
for _, reward in ipairs(tierData) do
ret[reward.attributeKey] = reward.rewardAmount
local newRet = {}
for _, attKey in ipairs(keys) do
table.insert(newRet, {attributeKey = attKey, rewardAmount = ret[attKey], icon=career_branches.getBranchIcon(attKey) })
local list = {}
for _, unlock in ipairs(unlocks[i].unlocks or {}) do
if unlock.type == "tasklist" then
local maxRequiredValue = 0
for _, value in ipairs(unlockInfo) do
maxRequiredValue = maxRequiredValue + value.requiredValue
local amounts = {available = 0, locked = 0}
for _, item in ipairs(career_modules_delivery_parcelManager.getAllCargoForFacilityUnexpiredUndelivered(fac.id)) do
career_modules_delivery_generator.finalizeParcelItemDistanceAndRewards(item)
local modifierKeys = {}
for _, mod in ipairs(item.modifiers or {}) do
modifierKeys[mod.type] = true
-- trailers + vehicles
for _, t in ipairs({
{key="trailer", icon="smallTrailer", label="Available Trailers", skill="logistics-delivery"},
local amounts = {available = 0, locked = 0}
for _, item in ipairs(career_modules_delivery_vehicleOfferManager.getAllOfferAtFacilityUnexpired(fac.id)) do
if item.data.type == t.key then
for i, fac in ipairs(facilities) do
local data = {
data.hasOrders = false
for _, orders in ipairs(data.availableOrders) do
if orders.amounts.available > 0 or orders.amounts.locked > 0 then
local ret = {}
for _, s in ipairs(skills) do
ret[s.id] = {
-- certifications
for _, certification in ipairs(br.certifications or {}) do
local unlocked = career_modules_unlockFlags.getFlag(certification.unlockFlag)
local defaultCount = 0
for _, obj in ipairs(ds.info.objectives) do
table.insert(defaults, ds.saveData.objectivesCompleted[obj.id] or false)
-- Find all domains and determine their target type
for _, branch in ipairs(branches) do
if branch.isDomain then
-- Check children of this domain
for _, childBranch in ipairs(branches) do
if childBranch.parentId == branch.id and childBranch.isBranch then
-- Find branches for this domain
for _, branch in ipairs(branches) do
if branch.parentId == pathId then
arrayReverse(parentBreadcrumbs)
for _, breadcrumb in ipairs(parentBreadcrumbs) do
table.insert(data.breadcrumbs, breadcrumb)
--Sort the misison tables and add them to the main table that will be send to the UI
for _, league in ipairs(data.leagues) do
for i, mId in ipairs(league.missions) do
for _, league in ipairs(data.leagues) do
for i, mId in ipairs(league.missions) do
local m = gameplay_missions_missions.getMissionById(mId)
@/lua/ge/extensions/editor/materialEditor.lua
local err, warn, info = {}, {}, {}
for _, it in ipairs(list) do
if it.level == 3 then
im.Separator()
for _, it in ipairs(items) do
im.BulletText("%s", it.text)
for i, e in ipairs(order) do
local suf, items, icon, tint = e[1], e[2], e[3], e[4]
local meshNames = scenetree.findClassObjects('TSStatic')
for _, objName in ipairs(meshNames) do
local obj = scenetree.findObject(objName)
if mats then
for _, mname in ipairs(mats) do
if mname == matName then
local shapeLoader = ShapePreview()
for _, defName in ipairs(defs) do
local defObj = scenetree.findObject(defName)
if mm then
for _, m in ipairs(mm) do
if m == matName then
local idx = 0
for _, row in ipairs(data.rows or {}) do
idx = idx + 1
local fidx = 0
for _, row in ipairs(data.forestRows or {}) do
fidx = fidx + 1
if clearFilter then im.ImGuiTextFilter_Clear(matFilter) end
for k, val in ipairs(v.materialNameList) do
if val == matName then
for _, objName in ipairs(editor.selection.object) do
local obj = scenetree.findObject(objName)
local matNames = obj:getMaterialNames()
for _, matName in ipairs(matNames) do
if not tbl[matName] then
local tbl = {}
for _, forestItem in ipairs(editor.selection.forestItem) do
local matNames = forestItem:getMaterialNames()
local matNames = forestItem:getMaterialNames()
for _, matName in ipairs(matNames) do
if not tbl[matName] then
local previewMeshNames = {}
for index, filePath in ipairs(previewMeshes) do
local _, file, _ = path.splitWithoutExt(filePath)
local selectionIndex = 1
for index, cubemap in ipairs(cubemaps) do
if selectedCubemapObj:getName() == cubemap then
if im.BeginChild1("CreateCubemapsLeftChild", nil, true) then
for index, cubemap in ipairs(cubemaps) do
if selectedCubemapObj then
if cubemapName ~= "" then
for index, name in ipairs(cubemaps) do
if name == cubemapName then
if pickingFromObjectMaterials then
for _, matName in ipairs(pickingFromObjectMaterials) do
if im.Selectable1(matName) then
if sortedTags then
for _, tagName in ipairs(sortedTags) do
if im.TreeNodeEx1(tagName) then
if im.TreeNodeEx1(tagName) then
for _, material in ipairs(tags[tagName]) do
if im.SmallButton(material) then
@/lua/ge/extensions/ui/apps.lua
local res = {}
for _, fn in ipairs(jsonFiles) do
local appDir, dn, ext = path.split(fn)
appData.typesTranslated = {}
for _, typeKey in ipairs(appData.types) do
table.insert(appData.typesTranslated, translateLanguage(typeKey, typeKey, true))
if layout and layout.apps then
for i, app in ipairs(layout.apps) do
if app.appName == appName then
local res = {}
for _, originalFilePath in ipairs(FS:findFiles(originalLayoutPath, '*.uilayout.json', -1, false, false)) do
local userFilePath = originalFilePath:gsub(originalLayoutPath, layoutPath)
if not userLayoutChanged then
for _, originalApp in ipairs(origLayout.apps) do
if originalApp.appVersion then
local jsonFiles = FS:findFiles(layoutPath, '*.uilayout.json', -1, false, false)
for _, fn in ipairs(jsonFiles) do
local layout = jsonReadFile(fn)
local originalLayout = jsonReadFile(originalFilePath)
for _, app in ipairs(originalLayout.apps) do
local appIndex = getAppIndexByName(data, app.appName)
-- if the app doesnt have a version, check if it is in the removed apps of the original layout and set the version to the removed app version
for _, app in ipairs(data.apps) do
if not app.appVersion then
local layouts = getAvailableLayouts()
for _, layout in ipairs(layouts) do
--dump({'delete?', layout.filename, filenameToDelete})
@/lua/vehicle/extensions/tech/platooning.lua
local total = 0
for _, speed in ipairs(speeds) do
total = total + speed
for i, vehicles in ipairs(relayVehicles) do
for k, v in pairs(mapmgr.getObjects()) do
velocities = 0
for i, k in ipairs(relayVehiclesVel) do
velocities = velocities + k
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/pursuitRoadblock.lua
local vehIds = {}
for _, v in ipairs({'vehId1', 'vehId2', 'vehId3'}) do
if self.pinIn[v].value then
@/lua/ge/extensions/editor/assemblySpline/distribution.lua
end
for _, variation in ipairs(componentGroup.variations) do
local varEnabled = isBridge and mol.getBridgeEnabled(spline, variation.id) or mol.getRigidEnabled(spline, variation.id)
end
for _, variation in ipairs(componentGroup.variations) do
local varEnabled = isBridge and mol.getBridgeEnabled(spline, variation.id) or mol.getRigidEnabled(spline, variation.id)
-- Clear existing result arrays for each component
for _, rigid in ipairs(molecule.rigids) do
if resultArrays[rigid.mesh.id] then
end
for _, bridge in ipairs(molecule.bridges) do
if resultArrays[bridge.mesh.id] then
table.clear(rigidMaps)
for i, rigid in ipairs(molecule.rigids) do
-- Check if any component in this group (base + variations) is enabled.
local hasEnabledComponent = mol.getRigidEnabled(spline, rigid.mesh.id)
for _, variation in ipairs(rigid.variations) do
if mol.getRigidEnabled(spline, variation.id) then
table.clear(bridgeMaps)
for i, bridge in ipairs(molecule.bridges) do
-- Check if any component in this group (base + variations) is enabled.
local hasEnabledComponent = mol.getBridgeEnabled(spline, bridge.mesh.id)
for _, variation in ipairs(bridge.variations) do
if mol.getBridgeEnabled(spline, variation.id) then
@/lua/ge/extensions/editor/missionEditor/additionalAttributes.lua
local eh = self.missionEditor.getCurrentEditorHelperWhenActive()
for _, attKey in ipairs(self.sortedAttKeys) do
local attribute = self.attributes[attKey]
im.Separator()
for _, v in ipairs(attribute.valuesSorted) do
if im.Selectable1(v.label, val.key == v.key) then
local ret = {}
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.date and m.date >= time then
local listById = {}
for _, m in ipairs(list) do listById[m.id] = m end
if im.Button("Update Affected Missions") then
if im.Button("Update Affected Missions") then
for _, mId in ipairs(self._timeUpdaterData.missionIds) do
local m = listById[mId]
local remIdx = -1
for i, mId in ipairs(self._timeUpdaterData.missionIds) do
local m = listById[mId]
@/lua/ge/extensions/gameplay/crawl/general.lua
local reverseRot180 = quatFromAxisAngle(vec3(0, 1, 0), math.pi)
for _, node in ipairs(M.activeTrail.path.nodes) do
if node.rotation then
if trails and not M.activeTrail and (career_career.isActive() or settings.getValue("enableCrawlInFreeroam")) then
for _, trail in ipairs(trails) do
local startingPosition = nil
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
if elem.type == "crawl" then
@/lua/ge/extensions/editor/missionEditor/prefabs.lua
table.clear(self.filenames)
for _, p in ipairs(mission.prefabs or {}) do
table.insert(self.filenames, im.ArrayChar(2048, p or ""))
local editEnded = im.BoolPtr(false)
for i, prefab in ipairs(self.filenames) do
local originalPrefabName = self.mission.prefabs[i]
@/lua/vehicle/extensions/tech/CANBus/CANBusPeak.lua
for index, byte in ipairs(data) do
sendMsg.DATA[index - 1] = byte --start data array at [0]
@/lua/ge/extensions/freeroam/organizations.lua
-- parse any other organization files inside the "/organizations" folder
for _,file in ipairs(FS:findFiles("gameplay/organizations/", '*.organizations.json', -1, false, true)) do
local data = jsonReadFile(file)
local function doesOrganizationOfferDeliveries(organization)
for _, facility in ipairs(freeroam_facilities.getFacilitiesByType("deliveryProvider")) do
if facility.associatedOrganization == organization.id then
local hasUnlocks = false
for i, levelInfo in ipairs(organization.reputationLevels) do
if levelInfo.unlocks and not tableIsEmpty(levelInfo.unlocks) then return true end
for i, repLevelInfo in ipairs(organization.reputationLevels) do
repLevelInfo.label = career_modules_reputation.getLabel(i-2)
@/lua/ge/extensions/editor/rallyEditor/pacenotes/measurementsForm.lua
local currentLabel = "none"
for _, opt in ipairs(geoPacenotes.intensityVariationOptions) do
if opt.value == currentIntensity then
if im.BeginCombo("##intensityVariationDivision", currentLabel) then
for _, opt in ipairs(geoPacenotes.intensityVariationOptions) do
local isSelected = opt.value == currentIntensity
@/lua/ge/extensions/tech/platoonFunctions.lua
-- Iterate through the vehicles list to find the index of the vehicle
for i, id in ipairs(vehicles) do
if id == vehicleID then
if platoons[leaderID] then
for i, id in ipairs(platoons[leaderID].vehicles) do
if id == vehicleID then
if isLastVehicle == false then
for i, v in ipairs(vehiclesList) do
if i > 1 then
for leaderID, platoon in pairs(platoons) do
for i, vehicleID in ipairs(platoon.vehicles) do
end
local vehiclesList = platoonArch.getRelayVehicles()
for i, v in ipairs(vehiclesList) do
local launchFunctonCall = "extensions.tech_platooning.endPlatoon("..v..")"
for i, v in ipairs(vehiclesList) do
if i > 1 then
for platoonID, platoon in pairs(platoons) do -- Loop over all platoons
for i, vehicleID in ipairs(platoon.vehicles) do -- Loop over vehicles (index-based)
local sensorID = platoon.ultrasonics[i] -- Get corresponding sensor ID
@/lua/ge/extensions/editor/dynamicDecals/docs.lua
table.sort(section.children, sortFn)
for _, child in ipairs(section.children) do
sortSectionChildren(child)
im.TableHeadersRow()
for _, inputAction in ipairs(inputActionInfo) do
im.TableNextColumn()
inputActionInfo = {}
for _,device in ipairs(extensions.core_input_bindings.bindings) do
if device.devname == "keyboard0" or device.devname == "mouse0" then
if device.devname == "keyboard0" or device.devname == "mouse0" then
for _, binding in ipairs(device.contents.bindings) do
local actionmap = extensions.core_input_actions.getActiveActions()[binding.action].actionMap
if not sec.children then return end
for _, child in ipairs(sec.children) do
if child.name == name then
for k, sectionName in ipairs(data.section) do
if k ~= #data.section then
if not section.children then return end
for _, child in ipairs(section.children) do
if child.name == name then
else
for _, child in ipairs(curSection.children) do
if child.name == name then
@/lua/ge/extensions/editor/raceEditor/timeTrials.lua
self.filenames = {}
for _, pn in ipairs(prefabData) do
self.filenames[pn.fieldName] = {}
self.filenames[pn.fieldName] = {}
for _, p in ipairs(self.path[pn.fieldName] or {}) do
table.insert(self.filenames[pn.fieldName], im.ArrayChar(2048, p or ""))
if im.BeginCombo("Difficulty", intDiffToString(self.path.difficulty)) then
for i, d in ipairs(difficulties) do
if im.Selectable1(d, d == intDiffToString(self.path.difficulty)) then
end
for i, pn in ipairs(prefabData) do
im.Separator()
local at = nil
for i, f in ipairs(files) do
if f ~= "" and FS:fileExists(f) then
local str = "No file at:"
for _,f in ipairs(files) do str = str.."\n - " .. f end
for i, prefab in ipairs(list) do
if editor.uiIconImageButton(editor.icons.delete_forever, im.ImVec2(24, 24), nil, nil, nil,'##rem'..prefab..i) then
@/lua/ge/extensions/editor/tech/roadArchitect/junctions.lua
local jNodes = {}
for _,roadId in ipairs(roadIds) do
local road = roadNetwork[roadId]
@/lua/ge/extensions/flowgraph/nodes/gameplay/crawl/applyPenalty.lua
local templates = {}
for _, penaltyType in ipairs(penaltyTypes) do
table.insert(templates, {value = penaltyType, label = penaltyType})
@/lua/vehicle/powertrain/linearActuator.lua
local currentExtend = 0
for _, cid in ipairs(device.actuatorBeams) do
--screwBeam(int outId, float torqueForce, float speedLimit, float slipForce, float helixAngleCos, float face1Cos, float face2Cos, float frictionForceStick, float frictionCoef, float slipSpeedLimit, float minExtend, float maxExtend)
@/gameplay/missionTypes/rallyLoop/editor.lua
})
for _, mission in ipairs(missions) do
local translatedName = translateLanguage(mission.name, mission.name, true)
-- Update dropdown values dynamically when mission is loaded
for _, element in ipairs(self.elements) do
if element.fieldName and string.find(element.fieldName, "_") then
@/lua/vehicle/controller/bypassDampers.lua
local function update(dt)
for _, damper in ipairs(dampers) do
local beamLength = obj:getBeamLength(damper.beamCid)
--find the updated zone the old fashioned way by iterating over all of them until we find the right one
for zoneId, zoneData in ipairs(damperZones) do
if displacement >= zoneData.zoneStart and displacement < zoneData.zoneEnd then
-- local function debugDraw(focusPos)
-- for _, damper in ipairs(dampers) do
-- obj.debugDrawProxy:drawNodeText(v.data.beams[damper.beamCid].id1, color(255, 0, 0, 255), damperZones[damper.currentZoneId].zoneStart or "N/A", 0)
local i = 1
for _, distance in ipairs(sortedZoneDistances) do
local zoneData = beamZones[distance]
@/lua/ge/extensions/flowgraph/nodes/ui/setUILayout.lua
self.pinInLocal.appContainerContext.hardTemplates = {}
for _, appId in ipairs(tableKeysSorted(apps)) do
table.insert(self.pinInLocal.appContainerContext.hardTemplates, {value = appId})
@/lua/ge/extensions/flowgraph/nodes/activity/autoStarGoals.lua
})
for _, star in ipairs(self.mgr.activity.careerSetup._activeStarCache.sortedStars) do
if self.mgr.activity.careerSetup.starsActive[star] then
@/lua/ge/extensions/career/modules/vehiclePerformance.lua
function(ret)
for _, tank in ipairs(ret[1]) do
core_vehicleBridge.executeAction(veh, 'setEnergyStorageEnergy', tank.name, tank.maxEnergy)
local performanceData = {}
for _, key in ipairs(timerKeys) do
performanceData[key] = gameplay_drag_general.getData().racers[vehId].timers[key].value
local function onComputerAddFunctions(menuData, computerFunctions)
for _, vehicleData in ipairs(menuData.vehiclesInGarage) do
local inventoryId = vehicleData.inventoryId
@/lua/common/jbeam/sections/licenseplatesSkins.lua
elseif type(part.slotType) == 'table' then
for _, slotType in ipairs(part.slotType) do
isLicenseplate = isLicenseplate or (type(slotType) == 'string' and slotType:find('_licenseplate'))
@/lua/ge/extensions/gameplay/crashTest/crashTestScoring.lua
elseif stepData.damageTargets == "Target(s)" then
for _, targetId in ipairs(stepData.jbeamTargets) do
table.insert(vehIds, targetId)
table.insert(vehIds, stepData.plVehId)
for _, targetId in ipairs(stepData.jbeamTargets) do
table.insert(vehIds, targetId)
local totalDamageScore = 0
for _, vehId in ipairs(vehIds) do
totalDamageScore = totalDamageScore + calculateIndividualDamageScore(stepData.damageAmount, stepData.damageCondition, vehId)
local totalScore = 0
for _, stepScoreData in ipairs(scoringDataPerStep) do
for _, scoreData in pairs(stepScoreData) do
@/lua/ge/extensions/core/vehicle/colors.lua
local result = {}
for i,v in ipairs(stringToTable(colorString, '%s')) do
result[i] = tonumber(v)
-- round the values. same as we do in colorTableToRoundedColorString
for i, paint in ipairs(vd.config.paints) do
for attribute, value in pairs(paint) do
if type(value) == "table" then
for j, value2 in ipairs(value) do
value[j] = round(value2*100)/100
@/lua/ge/extensions/flowgraph/nodes/util/getMapObjectsDynField.lua
local object = getObjectByID(objId)
for _, name in ipairs(object:getDynamicFields()) do
if name == dynamicFieldName then
@/lua/ge/extensions/campaign/campaignsLoader.lua
local campaignList = getList()
for _,camp in ipairs(campaignList) do
if camp.sourcePath == path then
@/lua/ge/extensions/editor/audioRibbonEditor.lua
-- Check all rivers for closer surface hits.
for _, river in ipairs(rivers) do
local segmentsCount = river:getSegmentCount()
@/lua/ge/extensions/editor/tech/roadArchitect/roads.lua
local nodes, widths, ctr = {}, {}, 1 -- Grab all the nodes and widths of this decal road.
for _, node in ipairs(editor.getNodes(sel)) do
nodes[ctr], widths[ctr] = node.pos, node.width
local function offsetRoads2Terrain()
for _, road in ipairs(roads) do
road.isConformRoadToTerrain = im.BoolPtr(true)
local function offsetByValue(offset)
for _, road in ipairs(roads) do
local nodes = road.nodes
@/lua/vehicle/wheels.lua
for _, v in ipairs(axleBeamLookup[beamName]) do
local wd = M.wheelRotators[v]
for _, v in ipairs(virtualAirspeedMaps) do
local gainSum = (v.acceleration + M.wheelCount * v.wheelCoef)
@/lua/ge/extensions/util/photomode.lua
local result = {}
for i,file in ipairs(FS:findFiles('ui/modules/photomode/ui-overlays', '*.png', 0, false, false)) do
table.insert(result, {filename=file})
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartTree.lua
vEditor.selectedASTNodeMap[nodeIdx] = true
for _, ni in ipairs(ast.transient.hierarchy[nodeIdx] or {}) do
_highlightAstNode(ni)
vEditor.selectedASTNodeMap[nodeIdx] = nil
for _, ni in ipairs(ast.transient.hierarchy[nodeIdx] or {}) do
_unhighlightAstNode(ni)
for k, objData in ipairs(hitObjects) do
if k >= 2 then
-- Generate lookup table for pickedNodes index based on node cid
for k,v in ipairs(vEditor.selectedNodes) do
pickedNodes[v.cid] = k
else
for _, node in ipairs(vEditor.selectedNodes) do
_deselectAndUnhighlightNode(node)
if not transformingNodes and im.IsMouseClicked(0) and not editor.keyModifiers.shift then
for _, node in ipairs(vEditor.selectedNodes) do
_deselectAndUnhighlightNode(node)
-- Generate lookup table for pickedBeams index based on beam name
for k, beam in ipairs(vEditor.selectedBeams) do
local id = beam['id1:'] .. beam['id2:']
else
for _, beam in ipairs(vEditor.selectedBeams) do
_deselectAndUnhighlightNode(beam)
if im.IsMouseClicked(0) and not editor.keyModifiers.shift then
for _, beam in ipairs(vEditor.selectedBeams) do
_deselectAndUnhighlightNode(beam)
@/lua/vehicle/input.lua
if debug then
for k, v in ipairs(frontWheels) do
local namef = wheels.wheels[v[1]].name
local namesr = {}
for l, w in ipairs(v[3]) do
table.insert(namesr, wheels.wheels[w].name)
local totalDownForce = 0
for _, v in ipairs(frontWheels) do
local wd = v[2]
local totalDownForce = 0
for _, v in ipairs(frontWheels) do
local frontWheel = v[1]
local wheelTurnRadiusTotal = 0
for _, rearWheel in ipairs(rearWheels) do
wheelTurnRadiusTotal = wheelTurnRadiusTotal + obj:wheelTurnRadius(frontWheel, rearWheel)
@/lua/common/libs/xlsxlib/xlsxlib.lua
local dom = parseXMLContent(zip, relsFile)
for _, child in ipairs(dom.root.kids) do
if getLocalName(child) == "Relationship" then
local dom = parseXMLContent(zip, sharedStringsFile)
for _, child in ipairs(dom.root.kids) do
if getLocalName(child) == "si" then
local textValue = ""
for _, subChild in ipairs(child.kids) do
if getLocalName(subChild) == "t" then
-- Rich text run
for _, rChild in ipairs(subChild.kids) do
if getLocalName(rChild) == "t" then
for _, child in ipairs(dom.root.kids) do
if getLocalName(child) == "sheets" then
if getLocalName(child) == "sheets" then
for _, sheet in ipairs(child.kids) do
if getLocalName(sheet) == "sheet" then
-- Iterate through children of within the worksheet
for _, child in ipairs(dom.root.kids) do
if getLocalName(child) == "sheetData" then
if getLocalName(child) == "sheetData" then
for _, rowNode in ipairs(child.kids) do
if getLocalName(rowNode) == "row" then
for _, cellNode in ipairs(rowNode.kids) do
if getLocalName(cellNode) == "c" then
-- Handle different cell types
for _, cChild in ipairs(cellNode.kids) do
if getLocalName(cChild) == "v" then
cellValue = ""
for _, isChild in ipairs(cChild.kids) do
if getLocalName(isChild) == "t" then
elseif getLocalName(isChild) == "r" then
for _, rChild in ipairs(isChild.kids) do
if getLocalName(rChild) == "t" then
local function tableContains(t, value)
for _, v in ipairs(t) do
if v == value then
@/lua/ge/extensions/flowgraph/nodes/activity/aggregateAttempt.lua
if hasDefaultUnlockedStar then
for _, starKey in ipairs(self.mgr.activity.careerSetup._activeStarCache.defaultStarKeysSorted) do
if attempt.unlockedStars[starKey] then
@/gameplay/missionTypes/collection/customNodes/collectionMarkersNode.lua
-- delete existing objects
for _, m in ipairs(self.mgr.markerData or {}) do
local markerObj = scenetree.findObjectById(m.markerObjectId)
self.mgr.markerData = {}
for _, pn in ipairs(path.pathnodes.sorted) do
local data = {
local cameraPos = core_camera.getPosition()
for _, m in ipairs(self.mgr.markerData or {}) do
local pos = m.pos
function C:onDrawOnMinimap(td)
for _, m in ipairs(self.mgr.markerData or {}) do
local clr = m.colorTimer
function C:onDrawOnMinimapBorder(td)
for _, m in ipairs(self.mgr.markerData or {}) do
local clr = m.colorTimer
@/lua/ge/extensions/career/modules/testDrive.lua
local isTestDrivePoi = false
for _, elem in ipairs(elemData) do
if elem.type == "testDriveEnd" then
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/vePowerTrain.lua
local deviceNamesUnsorted = {}
for _,device in ipairs(vEditor.powertrainDevices) do
if device.name then
local keys = tableKeysSorted(deviceNamesUnsorted)
for _,name in ipairs(keys) do
table.insert(deviceNames, name)
end
for _, device in ipairs(vEditor.powertrainDevices) do
if device.name == deviceNames[devicePtr[0]+1] then
@/lua/ge/extensions/tech/adasUltrasonic.lua
initialized = false
for _, ultrasonic in ipairs(ultrasonics) do
extensions.tech_sensors.removeSensor(ultrasonic)
@/lua/ge/extensions/gameplay/route/route.lua
local pathLen = #self.path
for j, pwp in ipairs(path) do
if not self.path[pathLen] or self.path[pathLen].wp ~= pwp then
local lastIdx = #self.path
for i, p in ipairs(path) do
table.insert(self.path, {pos = map.getMap().nodes[p].pos, wp = p, linkCount = map.getNodeLinkCount(p)})
function C:getNextFixedWP()
for _, wp in ipairs(self.path) do
if wp.fixed then return wp.pos end
table.insert(fixedWps, startPos)
for _, wp in ipairs(self.path) do
if wp.fixed then table.insert(fixedWps, wp.pos) end
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/pathDefaultStartTransform.lua
if self.data.useStringMatch then -- used in some special cases
for _, v in ipairs(self.pinIn.pathData.value.startPositions.sorted) do
if string.find(v.name, self.pinIn.name.value) then -- uses first result, if found
@/lua/ge/extensions/gameplay/drift/stuntZones.lua
if im.BeginChild1("Stunt zones", im.ImVec2(im.GetWindowContentRegionWidth(), 150)) then
for _, stuntZone in ipairs(stuntZones) do
im.Text(stuntZone.data.zoneData.type .. " id : " .. stuntZone.data.id)
if gameplay_drift_drift.doesPlHaveVeh() then
for _, stuntZone in ipairs(stuntZones) do
if stuntZone:isAvailable() then
local function reset()
for _, stuntZone in ipairs(stuntZones) do
stuntZone:reset()
-- specific setup if needed / sanitizing
for _, stuntZone in ipairs(zones) do
local createdStuntZone = {
if not isDrifting then
for _, stuntZone in ipairs(stuntZones) do
if stuntZone.data.zoneData.type == "donut" then
local i = 1
for _, stuntZone in ipairs(stuntZones) do
if stuntZone.data.id == id then
local function onVehicleDestroyed(vehId)
for _, stuntZone in ipairs(stuntZones) do
if stuntZone.onVehicleDestroyed then
@/lua/ge/extensions/gameplay/rally/notebook/pacenote.lua
self.notes = {}
for _,lang in ipairs(self.notebook:getLanguages()) do
lang = lang.language
function C:setAllRadii(newRadius, wpType)
for _,wp in ipairs(self.pacenoteWaypoints.sorted) do
if not wpType or wp.waypointType == wpType then
function C:allToTerrain()
for _,wp in ipairs(self.pacenoteWaypoints.sorted) do
wp.pos.z = core_terrain.getTerrainHeight(wp.pos)
for _,txt in ipairs(notesArray) do
-- if rallyUtil.useNote(before) then
for i, fname in ipairs(fnames) do
local _, basename, _ = path.split(fname)
function C:checkFilesExist(audioMode, fnames)
for _,fname in ipairs(fnames) do
if not fname or fname == '' then
function C:getCornerStartWaypoint()
for i,wp in ipairs(self.pacenoteWaypoints.sorted) do
if wp.waypointType == waypointTypes.wpTypeCornerStart then
function C:getCornerEndWaypoint()
for i,wp in ipairs(self.pacenoteWaypoints.sorted) do
if wp.waypointType == waypointTypes.wpTypeCornerEnd then
for _,noteStr in ipairs(noteStrs) do
local fname = self.notebook:missionPacenoteAudioFile(rallyUtil.structuredDir, noteStr)
for _,noteStr in ipairs(noteStrs) do
local pacenoteHash = rallyUtil.pacenoteHashSha1(noteStr)
local fnames = self:audioFnamesStructuredOnline()
for _,fname in ipairs(fnames) do
FS:removeFile(fname)
-- Find matching cornerLength category based on angle
for _, lengthEntry in ipairs(compositor.config.cornerLength) do
if angleDegrees >= lengthEntry.angleDegMin and angleDegrees < lengthEntry.angleDegMax then
@/lua/ge/extensions/editor/dragRaceEditor/dragSettings.lua
log('D', 'drag_race_editor', 'Found ' .. #levelSettingsFiles .. ' level settings files')
for _, file in ipairs(levelSettingsFiles) do
-- Extract filename from path
-- Try to find mission settings with different level name formats
for _, testLevelName in ipairs(possibleLevelNames) do
-- Load settings from dragStripRace missions
log('D', 'drag_race_editor', 'Found ' .. #dragStripRaceFiles .. ' dragStripRace settings files')
for _, file in ipairs(dragStripRaceFiles) do
log('D', 'drag_race_editor', 'Found dragStripRace file: ' .. file)
log('D', 'drag_race_editor', 'Found ' .. #dragStripAPMFiles .. ' dragStripAPM settings files')
for _, file in ipairs(dragStripAPMFiles) do
log('D', 'drag_race_editor', 'Found dragStripAPM file: ' .. file)
for i, settingsFile in ipairs(allSettingsFiles) do
local isSelected = i == selectedSettingsIndex
for i, phase in ipairs(dragSettings.phases) do
local isSelected = i == selectedPhaseIndex
for i, p in ipairs(dragSettings.phases) do
im.Text(i .. ". " .. p.name)
@/lua/ge/extensions/career/modules/inventory.lua
local minDist = math.huge
for _, garage in ipairs(facilities.garages) do
local zones = freeroam_facilities.getZonesForFacility(garage)
end
for _, zone in ipairs(zones) do
for inventoryId, veh in pairs(spawnedVehicles) do
for _, performanceData in ipairs(vehicleData.performanceHistory or {}) do
processPerformanceData(performanceData)
chooseButtonsData = _chooseButtonsData or {{}}
for _, buttonData in ipairs(chooseButtonsData) do
buttonData.buttonText = buttonData.buttonText or "Choose Vehicle"
for _, tag in ipairs(tags) do
if not vehData.owned then
@/lua/ge/extensions/core/inventory.lua
local found
for _,item in ipairs(entryTable) do
found = true
local entryTable = itemsTable[itemType]
for index,entry in ipairs(entryTable) do
if entry.model == valueObj.model and entry.config == valueObj.config then
if type(itemEntry) == 'table' then
for _,v in ipairs(itemEntry) do
if v.itemId == itemId then
if type(entry) == 'table' then
for _,item in ipairs(entry) do
opFunc(itemType, item)
@/lua/ge/extensions/gameplay/util/damageAssessment.lua
for _, edge in ipairs(edges) do
debugDrawer:drawLine(corners[edge[1]], corners[edge[2]], magentaColor)
local sum = 0
for _, value in ipairs(tableNumbers) do
sum = sum + value
local variance = 0
for _, value in ipairs(tableNumbers) do
local adjustedValue = math.max(value, 0)
}
for _, cellId in ipairs(location.damageRequirements.cells) do
local damageDiff = newSectionsDamageInfoRaw[cellId] - oldSectionsDamageInfoRaw[cellId]
local cellDamages = {}
for _, cellId in ipairs(location.damageRequirements.cells) do
local damageDiff = newSectionsDamageInfoRaw[cellId] - oldSectionsDamageInfoRaw[cellId]
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/createRallyGroundMarker.lua
-- disabled for the time being
-- for _, pathnode in ipairs(pathnodes) do
-- local wp = vec3(pathnode.pos)
@/lua/ge/extensions/editor/assetManagementTool.lua
for i, record in ipairs(invalidLinkFiles) do
if not record.fixed then
for index, record in ipairs(assetsByIndex) do
hasMatch = true
-- delete the original files and create links files
for _, path in ipairs(asset.paths) do
FS:removeFile(path)
for _, filepath in ipairs(paths) do
vfsPath = FS:native2Virtual(filepath)
for i, filename in ipairs(filenames) do
for folderIndex, folder in ipairs(searchFolders) do
message = "Gathering files from: " .. folder
for i, filename in ipairs(filenames) do
updateCounter = updateCounter + 1
for _, filename in ipairs(asset.paths) do
if assetsByHash[hash] and not tableContains(assetsByHash[hash].paths, filename) then
for folderIndex, folder in ipairs(searchPaths) do
message = "Gathering link files from: " .. folder
for i, filename in ipairs(filenames) do
updateCounter = updateCounter + 1
for i, filename in ipairs(filenames) do
updateCounter = updateCounter + 1
for i, record in ipairs(invalidLinkFiles) do
updateCounter = updateCounter + 1
for i, filename in ipairs(filenames) do
updateCounter = updateCounter + 1
for i, filename in ipairs(filenames) do
updateCounter = updateCounter + 1
for i, filename in ipairs(filenames) do
updateCounter = updateCounter + 1
for key, val in pairs(assetsByHash) do
for _, path in ipairs(val.paths) do
assets[path] = val.hash
for _, hash in ipairs(visibleHashes) do
selectedHashes[hash] = true
if asset and asset.paths then
for _, path in ipairs(asset.paths) do
assets[path] = nil
@/lua/ge/extensions/gameplay/rally/driveline/drivelineRoute.lua
-- Preload items: Populates the self.items table
for i,point in ipairs(points) do
local stableId = point.metadata and point.metadata.stableId
local splitCount = 1
for _, pn in ipairs(racePath.pathnodes.sorted) do
local pnType = pn.name
for i, pathnode in ipairs(pathnodes) do
local point = pathnode:getStaticRoutePoint()
local splitLabels = {}
for _, splitData in ipairs(splitDataList) do
local distFromStart = splitData.distFromStart
if use2DecimalPlaces then
for _, splitData in ipairs(splitDataList) do
local distFromStart = splitData.distFromStart
-- use 1 decimal place labels
for _, splitData in ipairs(splitDataList) do
local distFromStart = splitData.distFromStart
local step3Points = pointsList:getAll()
for i, point in ipairs(step3Points) do
local wp = string.format("driveline_%d", i)
local spStopZone = nil
for _, sp in ipairs(racePath.startPositions.sorted) do
if sp.name == "STOP_ZONE" or sp.name == "SS_stop_control" or sp.name == "TC_out" then
local pnTypes = getRacePathnodeTypes(racePath)
for i,pathnode in ipairs(racePath.pathnodes.sorted) do
insertRacePathnode(racePath, preRoutePoints, pathnode, kdTreePreRoute, stableIdIndexPreRoute, pnTypes)
-- Step 7: Insert pacenote waypoints into the points list.
for _,pn in ipairs(notebookPath.pacenotes.sorted) do
insertPacenoteWaypoint(preRoutePoints, pn:getCornerStartWaypoint(), kdTreePreRoute, stableIdIndexPreRoute)
local routePathRaceAiWithoutFixed = {}
for i, point in ipairs(preRoutePoints) do
if not point.noFixed then
local startIndex = nil
for i, point in ipairs(routePathRaceAiWithoutFixed) do
if point.metadata and point.metadata.racePathnodeType == 'spStart' then
local stopIndex = nil
for i, point in ipairs(routePathRaceAiWithoutFixed) do
if point.metadata and point.metadata.racePathnodeType == 'spStopZone' then
for i, point in ipairs(routePathRaceAiWithoutFixed) do
table.insert(self.finalPreRouteInput, {
-- Step 12: calculate cached lengths for pacenotes
for _,pn in ipairs(self:getPacenotes()) do
local wpCS = pn:getCornerStartWaypoint()
-- first clear all events
for i,pacenote in ipairs(self:getPacenotes()) do
-- log('D', logTag, string.format('clearing events for %s', pacenote.name))
-- log('D', logTag, string.format('nextPnId id=%d name=%s', nextPnId, self.nextPacenoteWpFromRecalc.pacenote.name))
for i, pacenote in ipairs(self:getPacenotes()) do
if pacenote.id == nextPnId then
self.nextPacenoteIdxForEval = #self:getPacenotes() + 1
for i, pacenote in ipairs(self:getPacenotes()) do
local event = self:getPacenoteEvent(pacenote)
for i, point in ipairs(routeToDraw.path) do
clr = rainbowColor(#routeToDraw.path, i, 1)
for i, point in ipairs(self.route.path) do
local pos = vec3(point.pos)
local profileIndex = 1
for i, point in ipairs(self.routeStatic.path) do
-- Use pre-calculated distance from metadata if available
@/lua/ge/extensions/gameplay/rally/vehicleCapture.lua
if f then
for _,cap in ipairs(self.capturesBuffer) do
local content = jsonEncode(cap)
@/lua/vehicle/energyStorage.lua
if files then
for _, file in ipairs(files) do
local _, fileNameWithExt, _ = path.split(file)
end
for _, name in ipairs(storage.breakTriggerBeam) do
beamTriggers[name] = storage
for _, partType in ipairs(partTypeData or {}) do
local split = split(partType, ":")
local relevantStorages = getPartRelevantStorages(partTypeData)
for _, relevantStorage in ipairs(relevantStorages) do
local storage = M.getStorage(relevantStorage)
for _, relevantStorage in ipairs(relevantStorages) do
local storage = M.getStorage(relevantStorage)
@/lua/ge/extensions/editor/missionEditor/general.lua
self.recBooleans = {}
for _, rec in ipairs(self.recommendedAttributes) do
self.recBooleans[rec] = im.BoolPtr(false)
self._groupLabelTranslated = nil
for _, rec in ipairs(self.recommendedAttributes) do
self.recBooleans[rec][0] = (self.mission.recommendedAttributesKeyBasedCache and self.mission.recommendedAttributesKeyBasedCache[rec]) or false
@/lua/ge/extensions/career/modules/milestones/generalMilestones/branches.lua
for i, branchInfo in ipairs(career_branches.getSortedBranches()) do
if not branchInfo.isInDevelopment then
@/lua/common/extensions/ui/flowgraph/editor_api_luaintf.lua
local nodeIds = M.GetSelectedNodeIds()
for idx, id in ipairs(nodeIds) do
nodes[idx - 1] = id
local linkIds = M.GetSelectedLinkIds()
for idx, id in ipairs(linkIds) do
links[idx - 1] = id
local nodeIds = M.GetActionContextNodeIds()
for idx, id in ipairs(nodeIds) do
nodes[idx - 1] = id
local linkIds = M.GetActionContextLinkIds()
for idx, id in ipairs(linkIds) do
links[idx - 1] = id
@/lua/ge/extensions/editor/masterSpline/splineMgr.lua
local function setLinkedSplinesDirty(masterSpline)
for _, layer in ipairs(masterSpline.layers) do
if layer.linkedSplineId and setLinkedSplineDirtyJumpTable[layer.linkType] then
for _, masterSpline in ipairs(masterSplines) do
for _, layer in ipairs(masterSpline.layers) do
for _, masterSpline in ipairs(masterSplines) do
for _, layer in ipairs(masterSpline.layers) do
if layer.linkedSplineId and layer.linkType then
local meshSplineMap = meshSplineLink.getSplineMap()
for _, id in ipairs(meshSplineIds) do
local idx = meshSplineMap[id]
local assemblySplineMap = assemblySplineLink.getSplineMap()
for _, id in ipairs(assemblySplineIds) do
local idx = assemblySplineMap[id]
local decalSplineMap = decalSplineLink.getSplineMap()
for _, id in ipairs(decalSplineIds) do
local idx = decalSplineMap[id]
local roadSplineMap = roadSplineLink.getIdToIdxMap()
for _, id in ipairs(roadSplineIds) do
local idx = roadSplineMap[id]
-- Restore mesh splines
for _, meshSpline in ipairs(stateData.linkedSplines.meshSpline) do
if not meshSplineLink.isLinked(meshSpline.id) then
-- Restore assembly splines
for _, assemblySpline in ipairs(stateData.linkedSplines.assemblySpline) do
if not assemblySplineLink.isLinked(assemblySpline.id) then
-- Restore decal splines
for _, decalSpline in ipairs(stateData.linkedSplines.decalSpline) do
if not decalSplineLink.isLinked(decalSpline.id) then
-- Restore road splines
for _, roadSpline in ipairs(stateData.linkedSplines.roadSpline) do
if not roadSplineLink.isLinked(roadSpline.id) then
if spline then
for _, layer in ipairs(spline.layers) do
if layer.linkedSplineId and not (meshSplineLink.isLinked(layer.linkedSplineId) or assemblySplineLink.isLinked(layer.linkedSplineId) or decalSplineLink.isLinked(layer.linkedSplineId) or roadSplineLink.isLinked(layer.linkedSplineId)) then
@/lua/vehicle/controller/hydraulics/hydraulicsCombustionEngineControl.lua
for _, electric in ipairs(relevantElectrics) do
if electrics.values[electric] and electricActivationSigns[sign(electrics.values[electric] or 0)] then
@/lua/ge/extensions/career/modules/insurance/insurance.lua
local insuranceProvidersFileNames = FS:findFiles("gameplay/insurance/providers", "*.json", -1, true, false)
for _, insuranceProviderFileName in ipairs(insuranceProvidersFileNames) do
local insuranceInfo = jsonReadFile(insuranceProviderFileName)
local classesFileNames = FS:findFiles("gameplay/insurance/classes", "*.json", -1, true, false)
for _, className in ipairs(classesFileNames) do
local classInfo = jsonReadFile(className)
@/lua/vehicle/extensions/tech/CANBus/RacingDisplay.lua
local power = 0
for _, engine in ipairs(engines) do
torque = torque + engine.outputTorque1 or 0
engines = {}
for _, engine in ipairs(powertrain.getDevicesByCategory("engine")) do
table.insert(engines, engine)
@/lua/ge/extensions/ui/vehiclePaint.lua
local result = { }
for i,v in ipairs(stringToTable(colorString, '%s')) do
result[i] = tonumber(v)
@/lua/ge/extensions/editor/missionEditor/progressSingle.lua
im.Text(string.format("Total Stars unlocked: %d / %d",self.formattedSaveData.unlockedStars.totalUnlockedStarCount, self.formattedSaveData.unlockedStars.totalStars))
for _, star in ipairs(self.formattedSaveData.unlockedStars.stars) do
im.PushID1(star.key)
if im.BeginCombo("Progress Key", self.currentProgressKey) then
for _, k in ipairs(progressKeys) do
if im.Selectable1(k, k==self.currentProgressKey) then self.currentProgressKey = k end
@/lua/ge/extensions/gameplay/discover/discover_037.lua
}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
local setupVehs = {}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
local random = math.random
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
step.timeout = math.huge
for _, veh in ipairs(balls) do
local pos = veh:getPosition()
local pigeonOOB = false
for _, veh in ipairs(setupVehs) do
local pos = veh:getPosition()
local randomPos = randomPos()
for _, veh in ipairs(setupVehs) do
--spawn.safeTeleport(veh, vec3(randomPos), quat(0,0,0,1), nil, nil, nil, nil, false)
}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
local explodeVehicles = {}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
table.insert(seq, util_stepHandler.makeStepReturnTrueFunction(function()
for _, veh in ipairs(explodeVehicles) do
local off = veh:getPosition() - avgPosition
table.insert(seq, util_stepHandler.makeStepWait(1.8))
for _, vehicle in ipairs(explodeVehicles) do
table.insert(seq, util_stepHandler.makeStepReturnTrueFunction(function()
@/lua/ge/extensions/core/multiseat.lua
local result = {}
for _,devname in ipairs(devnames) do
if devname:startswith("keyboard") or devname:startswith("mouse") then
local curIndex = #vehicles
for index,vehicle in ipairs(vehicles) do
local id = vehicle and vehicle:getID()
@/lua/common/tcpServer.lua
if data then
for _, clientData in ipairs(data) do
local connection, message = unpack(clientData)
for connection, dataChunks in pairs(recData) do
for _, dataRaw in ipairs(dataChunks) do
self:_onDataRaw(connection, dataRaw, res)
-- Close all connections
for _, connection in ipairs(self.connections or {}) do
if connection then
@/gameplay/missionTypes/precisionParking/constructor.lua
self.fgVariables = {}
--for _, name in ipairs({"timeAvailable", "model", "config"}) do
self.fgVariables = self.missionTypeData
@/lua/ge/extensions/editor/rallyEditor/drivelineTab.lua
local pointsWithNormals = {}
for _, point in ipairs(self.drivelineV3.finalDrivelinePoints) do
table.insert(pointsWithNormals, {pos = point.pos, normal = point.normal})
-- Convert points to spline nodes
for i, pathPoint in ipairs(pointsToUse) do
table.insert(self.drivelineV3.spline.nodes, vec3(pathPoint.pos))
local serializedPoints = {}
for i, point in ipairs(self.drivelineV3.finalDrivelinePoints) do
table.insert(serializedPoints, {point.pos.x, point.pos.y, point.pos.z})
self.bufferPoints = {}
for _, point in ipairs(self.drivelineV3.finalDrivelinePoints) do
table.insert(self.bufferPoints, vec3(point.pos))
for _, pos in ipairs(self.bufferPoints) do
minX = math.min(minX, pos.x)
local radiusSq = self.bufferRadius * self.bufferRadius
for _, bufferPos in ipairs(self.bufferPoints) do
if point:squaredDistance(bufferPos) <= radiusSq then
for i, node in ipairs(self.drivelineV3.spline.nodes) do
local dist = node:distance(rayPos)
@/lua/common/jbeam/interaction.lua
for _, filename in ipairs(interactionFilenames) do
--log('I', 'events', 'loaded interaction file: ' .. tostring(filename))
@/lua/common/libs/lua-websockets/websocket/handshake.lua
for protocol in headers['sec-websocket-protocol']:gmatch('([^,%s]+)%s?,?') do
for _,supported in ipairs(protocols) do
if supported == protocol then
@/lua/ge/extensions/editor/roadEditor.lua
local function indexOf(list, value)
for index, v in ipairs(list) do
if value == v then
if not tableIsEmpty(selectedRoadsIds) then
for _, roadID in ipairs(selectedRoadsIds) do
local road = scenetree.findObjectById(roadID)
if not selectedNodes[roadId] then return false end
for _, id in ipairs(selectedNodes[roadId]) do
if nodeId == id then return true end
if not selectedNodes[roadId] then return end
for _, id in ipairs(selectedNodes[roadId]) do
if nodeId == id then
local function isRoadSelected(roadID)
for _, selectedRoadID in ipairs(selectedRoadsIds) do
if selectedRoadID == roadID then
selectedNodes[roadID] = {}
for _, nodeID in ipairs(arrayNodeIDs) do
table.insert(selectedNodes[roadID], nodeID)
if not road then goto continue end
for _, nodeID in ipairs(nodes) do
local roadNodePositions = actionData.oldPositions[roadID]
if not road then goto continue end
for _, nodeID in ipairs(nodes) do
local roadNodePositions = actionData.newPositions[roadID]
for roadID, nodeInfos in pairs(actionData.nodeInfos) do
for _, nodeInfo in ipairs(nodeInfos) do
local road = scenetree.findObjectById(roadID)
editor.selectObjectById(roadID, editor.SelectMode_Add)
for _, nodeInfo in ipairs(nodeInfos) do
editor.addRoadNode(roadID, nodeInfo)
local function duplicateRoadActionUndo(actionData)
for _, roadID in ipairs(actionData.arrayRoadIDs) do
editor.deleteRoad(roadID)
local newRoadIDs = {}
for index, nodes in ipairs(actionData.nodes) do
if actionData.arrayRoadIDs then
for _, newRoadID in ipairs(newRoadIDs) do
table.insert(actionData.arrayRoadIDs, newRoadID)
-- Loop through all the nodes
for _, node in ipairs(editor.getNodes(newRoad)) do
insertNode(originalRoad, node.pos, node.width, u_32_max_int)
-- Loop through all the nodes
for id, node in ipairs(editor.getNodes(originalRoad)) do
if (id - 1) == nodeID then
if road2Data.fuseNodeIndex == 1 then
for _, node in ipairs(road2Nodes) do
insertNode(road1, node.pos, node.width, insertIndex)
local fuseIndex2 = nil
for _, nodeIndex1 in ipairs(edgeNodes1) do
for _, nodeIndex2 in ipairs(edgeNodes2) do
for _, nodeIndex1 in ipairs(edgeNodes1) do
for _, nodeIndex2 in ipairs(edgeNodes2) do
local distVec = nodesRoad1[nodeIndex1].pos - nodesRoad2[nodeIndex2].pos
local function flipRoadsDirectionActionUndo(actionData)
for _, r in ipairs(actionData.roads) do
editor.deleteRoad(r.id)
local function flipRoadsDirectionActionRedo(actionData)
for _, r in ipairs(actionData.roads) do
editor.deleteRoad(r.id)
local roads = {}
for _, id in ipairs(selectedRoadsIds) do
local road = scenetree.findObjectById(id)
local fieldVal = valArray[1]
for _, val in ipairs(valArray) do
if val ~= fieldVal then
if selectedRoad then
for _, nodeID in ipairs(nodesTbl) do
local selNodePos = selectedRoad:getNodePosition(nodeID)
local road = scenetree.findObjectById(roadID)
for _, nodeID in ipairs(nodes) do
oldPosTbl[nodeID] = road:getNodePosition(nodeID)
local newPosTbl = newPositionsTbl[roadID]
for _, nodeID in ipairs(nodes) do
newPosTbl[nodeID] = vec3(nodePosition[0], nodePosition[1], nodePosition[2])
local road = scenetree.findObjectById(roadID)
for _, nodeID in ipairs(nodes) do
oldWidthsTbl[nodeID] = road:getNodeWidth(nodeID)
local newWidthsTbl = newWidths[roadID]
for _, nodeID in ipairs(nodes) do
newWidthsTbl[nodeID] = nodeWidth[0]
local roadAndNodeIDsTbl = {}
for _, roadID in ipairs(selectedRoadsIds) do
local selectedSingleNode = getSelectedSingleNodeInRoad(roadID)
local function showNodes(road)
for index, node in ipairs(editor.getNodes(road)) do
local pos = node.pos
local function finishRoad()
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
for _, roadID in ipairs(selectedRoadsIds) do
local road = scenetree.findObjectById(roadID)
if not road then goto continue end
for i, node in ipairs(editor.getNodes(road)) do
local distNodeToCam = (node.pos - camPos):length()
--Calculate mean pos of selected heading/trailing single nodes
for _, roadId in ipairs(selectedRoadsIds) do
local selRoad = scenetree.findObjectById(roadId)
for _, roadId in ipairs(selectedRoadsIds) do
local selRoad = scenetree.findObjectById(roadId)
-- Check the selected roads first
for _, roadID in ipairs(selectedRoadsIds) do
local road = scenetree.findObjectById(roadID)
local selectedRoadIndex = nil
for _, roadID in ipairs(selectedRoadsIds) do
local selectedHoveredRoadIndex = indexOf(hoveredRoadsIDs, roadID)
-- Color the hovered roads
for _, roadID in ipairs(hoveredRoadsIDs) do
if roadID == selectedRoadIndex then
local tempNodeAvailable = false
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
local roadInfosTbl = {}
for _, activeRoadID in ipairs(activeRoadsIDs) do
local tempNodeIndex = getRoadTempNodeIndex(activeRoadID)
local selectedRoad = scenetree.findObjectById(roadID)
for _, nodeID in ipairs(nodes) do
posTbl[nodeID] = selectedRoad:getNodePosition(nodeID)
if editor.getPreference("roadEditor.general.dragWidth") then
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
for roadID, nodes in pairs(selectedNodes) do
for _, nodeID in ipairs(nodes) do
local nodePosTbl = dragNodesStartPositions[roadID]
if editor.keyModifiers.alt and not mouseButtonHeldOnNode and mouseMoved then
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
local selectedRoad = nil
for _, roadID in ipairs(selectedRoadsIds) do
selectedRoad = scenetree.findObjectById(roadID)
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
selectedNodes[roadID] = {}
for _, nodeID in ipairs(nodesInRect) do
if isRoadSelected(roadID) then
local nodeWidthsTotal = 0
for _, nodeInfo in ipairs(editor.getNodes(selectedRoad)) do
nodeWidthsTotal = nodeWidthsTotal + nodeInfo.width
local nodes = {}
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
if (selectedRoad:getNodeCount() - numSelectedNodesInRoad) >= 2 then
for _, nodeID in ipairs(nodeIDs) do
local selNodePos = selectedRoad:getNodePosition(nodeID)
local duplicatedRoadIds = {}
for _, roadID in ipairs(selectedRoadsIds) do
local selectedRoad = scenetree.findObjectById(roadID)
local arrayNodes = {}
for _, roadID in ipairs(duplicatedRoadIds) do
local selectedRoad = scenetree.findObjectById(roadID)
local tempSelectedNodes = {}
for _, roadID in ipairs(selectedRoadsIds) do
if selectedNodes[roadID] and not tableIsEmpty(selectedNodes[roadID]) then
@/lua/ge/extensions/gameplay/markers/bigmapMarker.lua
local count = 0
for i, poi in ipairs(pois) do
cluster.pos = cluster.pos + poi.markerInfo.bigmapMarker.pos
@/lua/ge/extensions/flowgraph/nodes/debug/aiDebug.lua
local modeTypes = {}
for _, tmp in ipairs(modes) do
table.insert(modeTypes, { value = tmp })
@/lua/ge/extensions/career/modules/delivery/cargoScreen.lua
else
for _, loc in ipairs(group[1].destination.destinations) do
ret.bigMapIds[string.format("delivery-parking-%s-%s", loc.facId, loc.psPath)] = true
-- add all ids to the ret.
for _, cargo in ipairs(group) do
table.insert(ret.ids, cargo.id)
local transientMoveCounts = 0
for _, cargo in ipairs(group) do
transientMoveCounts = transientMoveCounts + (cargo._transientMove and 1 or 0)
local modifierKeys = {}
for _, mod in ipairs(group[1].modifiers) do
local modData = dParcelMods.getModData(mod.type)
-- bonus time for timed cargo is in the modifier.
for _, mod in ipairs(ret.modifiers) do
if mod.key == "timed" then
local cargo = group[1]
for _, con in ipairs(playerCargoContainers) do
-- if this container has other cargo that does not match with the current cargo, skip container.
if not isMixable then
for _, otherCargo in ipairs(con.rawCargo) do
if otherCargo.type ~= cargo.type then
-- check how many cargo in this group are already supposed to be going there
for _, cargo in ipairs(group) do
if cargo._transientMove then
local tgtIds = {}
for id, elem in ipairs(ret.targetLocations) do
if elem.enabled then
local autoloadCounts = 0
for _, id in ipairs(tgtIds) do
for i = 1, ret.targetLocations[id].maxAmount do
local cargoByGroupId = {}
for _, c in ipairs(cargo) do
--if not c.hiddenInFacility then
local isVehicleDeliveryTutorialActive = dTutorial.isVehicleDeliveryTutorialActive()
for _, offer in ipairs(offers) do
hasSpawnWhenCommitingCargoOffer = hasSpawnWhenCommitingCargoOffer or offer.spawnWhenCommitingCargo
for _, offer in ipairs(offers) do
dGenerator.finalizeVehicleOffer(offer)
local res = {}
for _, taskData in ipairs(vehicleTasks) do
if not taskData.giveBack then
local vehOffers = dVehOfferManager.getAllOfferUnexpired()
for _, offer in ipairs(vehOffers) do
if offer.spawnWhenCommitingCargo then
local destinations = { }
for _, fac in ipairs(dGenerator.getFacilities()) do
if fac.logisticTypesReceivedLookup[materialType] and fac.materialStorages[materialType] then
local destinations = { }
for _, fac in ipairs(dGenerator.getFacilities()) do
if fac.logisticTypesProvidedLookup[materialType] and fac.materialStorages[materialType] then
local totalStorableVolume = 0
for _, con in ipairs(playerCargoContainers) do
local materialData = dGenerator.getMaterialsTemplatesById(storage.materialType)
local transientCargoSlots = 0
for _, cargo in ipairs(dParcelManager.getAllCargoCustomFilter(function(c) return c.sourceStorage == storage.id and c._transientMove end)) do
if dParcelManager.sameLocation(cargo._transientMove.targetLocation, con.location) then
local facStorage = fac.materialStorages[materialType]
for _, cargo in ipairs(dParcelManager.getAllCargoCustomFilter(function(c) return c.sourceStorage == facStorage.id and c._transientMove end)) do
cargo.location = {type="delete"}
local emptyPartialStorages, emptyWholeStorages, validPartialStorages, validWholeStorages = {}, {}, {}, {}
for _, con in ipairs(playerCargoContainers) do
if con.cargoTypesLookup[cargoType] and con.freeCargoSlots > 0 then
elseif targetLocation.type == "vehicle" then
for _, con in ipairs(playerCargoContainers) do
if con.containerId == targetLocation.containerId and con.vehId == targetLocation.vehId then
local data = { }
for _, materialType in ipairs(tableKeysSorted(fac.materialStorages)) do
local storage = fac.materialStorages[materialType]
}
for _, loc in ipairs(fluidData.locations or {}) do
fluidData.bigMapIds[loc.bigMapId] = true
for _, targetLocation in ipairs(fluidData.targetLocations) do
fluidData._transientMaterialMoveAmount = fluidData._transientMaterialMoveAmount + targetLocation.selectedAmount
local destinations = { }
for _, fac in ipairs(dGenerator.getFacilities()) do
if fac.logisticTypesReceivedLookup[materialType] then
local hasTooFastVehicle = false
for _, con in ipairs(playerCargoContainers) do
if not hasTooFastVehicle then
local loanersFormatted = career_modules_loanerVehicles.formatLoanerOfferForUi(fac) or {}
for _, item in ipairs(loanersFormatted) do
item.cardType = "loaner"
for _, item in ipairs(career_modules_loanerVehicles.formatSpawnedLoanersForUi()) do
item.isFacilityCard = false
local vehs, trailers = {}, {}
for _, offer in ipairs(vehOffers) do
if offer.data.type == "vehicle" then
-- handle each container individually
for _, con in ipairs(playerCargoContainers) do
local entry = {
}
for _, formatted in ipairs(entry.cargo) do
formatted.nextTasks = {{label="Bring to " .. formatted.destinationName, checked = false}}
for _, formatted in ipairs(clusterFormatCargo(con.transientCargo)) do
formatted.transientMove = true
-- go through each item in this container
for _, cargo in ipairs(entry.cargo) do
-- enable systems for this type, even if the facilitiy does not offer it
-- check other conatiners if it can go there
for _, otherCon in ipairs(playerCargoContainers) do
--if cargo is fluid or materials, can only go in other containers with the same fluid/materials
local materialType = cargo.materialType
for _, otherCargo in ipairs(otherCon.rawCargo) do
validTarget = validTarget and otherCargo.materialType == cargo.materialType
uiData.player.acceptedOffers = getAcceptedVehicleOffers()
for _, offer in ipairs(uiData.player.acceptedOffers) do
if offer.type == "vehicle" then
for poiId, list in pairs(visibleBigMapIdsToCardIds) do
for _, cargo in ipairs(list) do
--dump(cargoId, cargo.id)
-- Trigger all tutorial generators at this facility
for _, generator in ipairs(fac.logisticGenerators or {}) do
if generator.isTutorialGenerator then
-- Trigger all tutorial vehicle generators at this facility
for _, generator in ipairs(fac.logisticGenerators or {}) do
if generator.isTutorialGenerator then
local vehOffers = dVehOfferManager.getAllOfferUnexpired()
for _, offer in ipairs(vehOffers) do
if offer.spawnWhenCommitingCargo and offer.origin.facId == cargoScreenFacId then
dParcelManager.clearAllTransientMoves()
for _, offer in ipairs(dVehOfferManager.getAllOfferCustomFilter(function() return true end)) do
offer.spawnWhenCommitingCargo = nil
local hasTargetableCargo = false
for _, cargo in ipairs(allCargo) do
local target
local cardIds = {}
for _, id in ipairs(freeroam_bigMapMarkers.getIdsFromHoveredPoiId(poiId)) do
local elem = visibleBigMapIdsToCardIds[id]
local unsimplifiedRoute = {}
for _, loc in ipairs(route.locations) do
if loc.type ~= "multi" then
local fromPos = dGenerator.getLocationCoordinates(cargo.location)
for _, dest in ipairs(cargo.destination.destinations) do
local toPos = dGenerator.getLocationCoordinates(dest)
@/lua/ge/extensions/flowgraph/nodes/string/stringconcat.lua
-- update all new inputs
for _,pin in ipairs(self.pinList) do
-- skip unsuitable pins that don't affect the computation of the output concat string
-- find out suitable pins, and which of them are empty & the end of the list
for _,pin in ipairs(self.pinList) do
if pin.direction == "in" and pin.type ~= "flow" then
@/lua/common/jbeam/tableSchema.lua
end
for i, _ in ipairs(ctx.header) do
if ctx.header[i] ~= data[1][i] then
-- now care about the rest
for rk,rv in ipairs(rowValue) do
--log('D', "jbeam.", "### "..header[rk].."//"..tostring(newRow[header[rk]]))
-- walk the list entries
for _, rowValue in ipairs(jbeamTable) do
processJbeamTableRow(ctx, rowValue)
@/lua/ge/extensions/editor/util/searchUtil.lua
end
for _, result in ipairs(self.results) do
result.frecency = self:getFrecencyScore(result.frecencyId)
-- self.search:setSameScoreResolvingFunction(sortFun)
for _, elem in ipairs(elementsAsList) do
self:queryElement({
im.BeginChild1("##"..string_label.."childCombo", im.ImVec2(im.GetContentRegionAvailWidth(), 140 * (editor and editor.getPreference and editor.getPreference("ui.general.scale") or 1)) )
for _, result in ipairs(self.filtered) do
if self.matchString ~= '' then
@/lua/ge/extensions/util/groundModelDebug.lua
for _, k in ipairs(gms) do
local v = core_environment.groundModels[k]
-- if it's an alias add it to the parents aliases table
for _, k in ipairs(gms) do
if groundModels[k].isAlias == true then
for _, k in ipairs(vgmk) do
local v = visibleGroundModels[k]
-- c.worlds[1].tris = 0
-- for kb, body in ipairs(c.worlds[1].bodies) do
-- body.tris = 0
-- body.tris = 0
-- for kc, col in ipairs(body.cols) do
-- body.tris = body.tris + col.triCount
-- for kb, body in ipairs(c.worlds[1].bodies) do
-- local weight = ((body.tris * 50) / c.worlds[1].tris) * firstColumnSize
@/lua/ge/extensions/core/groundMarkerArrows.lua
for i, wpLog in ipairs(lastWpLog) do
im.TableNextColumn()
@/lua/ge/extensions/gameplay/sites/customFields.lua
self.tags = {}
for _, name in ipairs(data.names or {}) do
if data.types[name] == 'string' then
end
for _, t in ipairs(data.tags or {}) do
self.tags[t] = 1
@/lua/ge/extensions/editor/raceEditor/startPositions.lua
im.BeginChild1("sp", im.ImVec2(220 * im.uiscale[0], 0 ), im.WindowFlags_ChildWindow)
for i, sp in ipairs(self.path.startPositions.sorted) do
if im.Selectable1(sp.name, sp.id == self.index) then
@/lua/ge/extensions/flowgraph/nodes/mission/UpdateDisplayDragRace.lua
if #timeDisplayValue > 0 and #timeDisplayValue < 6 then
for i,v in ipairs(timeDisplayValue) do
timeDigits[i]:preApply()
for i,v in ipairs(speedDisplayValue) do
speedDigits[i]:preApply()
@/lua/vehicle/controller/tech/recorders.lua
local data = { time = time }
for _, item in ipairs(recordedQuantities) do
local name = item.name
@/lua/ge/extensions/editor/api/preferencesRegistry.lua
if prefInfo[10] then
for i, val in ipairs(prefInfo[10]) do
table.insert(enumTable, {name = val, value = i})
function C:findCategory(name)
for _, cat in ipairs(self.categories) do
if cat.name == name then return cat end
function C:findSubCategory(category, name)
for _, subcat in ipairs(category.subcategories) do
if subcat.name == name then return subcat end
if type(subcat) ~= "table" then return nil end
for _, item in ipairs(subcat.items) do
if item.name == prefName then return item end
if not subCateg then return nil end
for _, item in ipairs(subCateg.items) do
if item.name == itemName then return item end
self.dontCallHookForSetValue = true
for _, item in ipairs(self.changedItems) do
extensions.hook("onEditorPreferenceValueChanged", item.itemPath, item.value)
-- fill all items with default values so its easy to lookup without search
for _, cat in ipairs(self.categories) do
for _, subCat in ipairs(cat.subcategories) do
for _, cat in ipairs(self.categories) do
for _, subCat in ipairs(cat.subcategories) do
for _, item in ipairs(subCat.items) do
for _, subCat in ipairs(cat.subcategories) do
for _, item in ipairs(subCat.items) do
local path = cat.name .. "." .. subCat.name .. "." .. item.name
function C:callHookForSetValue()
for _, cat in ipairs(self.categories) do
for _, subCat in ipairs(cat.subcategories) do
for _, cat in ipairs(self.categories) do
for _, subCat in ipairs(cat.subcategories) do
for _, item in ipairs(subCat.items) do
for _, subCat in ipairs(cat.subcategories) do
for _, item in ipairs(subCat.items) do
local path = cat.name .. "." .. subCat.name .. "." .. item.name
-- Recursive all-categories mode
for _, cat in ipairs(self.categories) do
self:resetToDefaults(cat.name)
@/lua/ge/extensions/editor/terraform/fetchSources.lua
local sources = {}
for _, meshRoadName in ipairs(scenetree.findClassObjects("MeshRoad")) do
local road = scenetree.findObject(meshRoadName)
@/lua/ge/extensions/util/trackBuilder/ceilingMesh.lua
for _, faceList in ipairs(shape.faces) do
for vIndex = 2, #faceList -1 do
local vOff = 0
for _, faceList in ipairs(shape.faces) do
local vOff = 0
local endCap = {}
for i,face in ipairs(shape.cap) do
startCap[(i-1)*3 + 1] = { v = face[1]-1, n = 0, u = 0}
local minWidth = 50
for _,p in ipairs(segment.points) do
if p.width and p.width > maxWidth then
local scaledWidthsNeeded = {}
for _,s in ipairs(widthsNeeded) do
for i = s*LUTDetail, (s+1) * LUTDetail do
-- now comes actual lookuptable calculation:
for _,s in ipairs(scaledWidthsNeeded) do
-- This is the actual width of the track we are dealing with in this step.
-- caluclate the normals
for _, faceList in ipairs(shape.faces) do
-- normal for the first point is always sharp
vertices[#vertices].uvX = len
for i, faceList in ipairs(shape.faces) do
local uvCenterOff = vertices[shape.uvCenterIndex[i]].uvX
local uvCenterOff = vertices[shape.uvCenterIndex[i]].uvX
for _,fIndex in ipairs(faceList) do
vertices[fIndex].uvX = vertices[fIndex].uvX - uvCenterOff
for i,p in ipairs(vertexLUT.vertices) do
tmpVec3:set(
end
for i,p in ipairs(vertexLUT.normals) do
tmpVec3:set(
local nOff = shape.faceInfo.normalCount * cpIndex
for i, f in ipairs(shape.faceInfo.faces) do
faces[i + cpIndex * shape.faceInfo.faceCount] = {v = f.v + vOff-1, n = f.n + nOff-1, u = f.u + vOff-1}
if segment.meshInfo.ceilingMesh.startCap or segment.meshInfo.forceStartCap then
for i, f in ipairs(shape.faceInfo.startCap) do
faces[faceCount+i] = {v = f.v, n = normalCount-1, u = f.v + uvCount-1 }
if segment.meshInfo.ceilingMesh.endCap or segment.meshInfo.forceEndCap then
for i, f in ipairs(shape.faceInfo.endCap) do
faces[faceCount+i] = {v = vertexCount +f.v, n = normalCount, u = f.v + 13 + uvCount }
@/lua/ge/extensions/ui/vehicleSelector/tiles.lua
local sourceIcons = {}
for _, source in ipairs(sources) do
if string.endswith(source, ".svg") then
@/lua/ge/extensions/career/modules/delivery/vehicleTasks.lua
local function onCouplerAttached(objId1, objId2, nodeId, obj2nodeId)
for _, taskData in ipairs(vehicleTasks) do
if taskData.vehId == objId1 or taskData.vehId == objId2 then
local function onCouplerDetached(objId1, objId2, nodeId, obj2nodeId)
for _, taskData in ipairs(vehicleTasks) do
if taskData.vehId == objId1 or taskData.vehId == objId2 then
local function onTrailerAttached(objId1, objId2)
for _, taskData in ipairs(vehicleTasks) do
if taskData.vehId then
local adjustedRewards = deepcopy(originalRewards)
for _, bd in ipairs(breakdown) do
for key, amount in pairs(bd.rewards) do
local vehicleRewardData = {}
for _, taskData in ipairs(vehicleTasks) do
local formatted = dCargoScreen.formatAcceptedOfferForUI(taskData.offer)
local vehsClose, trailersClose = 0,0
for _, taskData in ipairs(vehicleTasks) do
local activeTask = taskData.tasks[taskData.activeTaskIndex]
local offersById = tableValuesAsLookupDict(offerIds)
for _, taskData in ipairs(vehicleTasks) do
if offersById[taskData.offer.id] then
taskThatChangedThisFrame = nil
for _, taskData in ipairs(vehicleTasks) do
if not taskData.remove then
end
for _, taskData in ipairs(vehicleTasks) do
if not taskData.remove then
end
for _, taskData in ipairs(vehicleTasks) do
if not taskData.remove then
if taskDataRemoveThisFrame then
for id, taskData in ipairs(vehicleTasks) do
if taskData.remove then
-- remove from the back to avoid ids moving
for _, id in ipairs(arrayReverse(idsToRemove)) do
local taskToBeRemoved = vehicleTasks[id]
local ret = {}
for id, taskData in ipairs(vehicleTasks) do
for _, task in ipairs(taskData.tasks) do
for id, taskData in ipairs(vehicleTasks) do
for _, task in ipairs(taskData.tasks) do
if task.destination then
local function isVehicleDeliveryVehicle(vehId)
for _, taskData in ipairs(vehicleTasks) do
if taskData.vehId == vehId then
local function giveBackDeliveryVehicle(vehId)
for _, taskData in ipairs(vehicleTasks) do
if taskData.vehId == vehId then
local fine = {}
for _, taskData in ipairs(vehicleTasks) do
for attKey, amount in pairs(M.getFineForAbandon(taskData)) do
local function abandonAllVehicleTasks()
for _, taskData in ipairs(vehicleTasks) do
if be:getPlayerVehicleID(0) == taskData.vehId then
local function getVehicleTaskForOffer(offer)
for _, task in ipairs(vehicleTasks) do
if task.offer.id == offer.id then
@/lua/ge/extensions/gameplay/crashTest/scenarioManager.lua
local object = getObjectByID(objId)
for _, name in ipairs(object:getDynamicFields()) do
if string.find(name, dynamicFieldName) then
local function freezePlayerVehicles(freeze)
for _, stepData in ipairs(sanitizedStepsData) do
freezeVehicleById(stepData.plVehId, freeze)
local function isVehAStepTarget(vehId, stepIndex)
for _, targetId in ipairs(sanitizedStepsData[stepIndex].jbeamTargets) do
if targetId == vehId then
local function hasEveryJbeamFinishedCrashing()
for _, vehId in ipairs(currentStepParameters.jbeamTargets) do
if isVehCurrentlyCrashing(vehId) then
for _, vehId in ipairs(currentStepParameters.jbeamTargets) do
if isVehACurrentStepDamageTarget(vehId) then
local id = 1
for _, step in ipairs(crashTestData) do
local sanitizedStep = {}
for _, stepData in ipairs(sanitizedStepsData) do
if stepData.id == currentStepIndex_ or forceActivate then
if stepData.id == currentStepIndex_ or forceActivate then
for _, vehId in ipairs(stepData.jbeamTargets) do
getObjectByID(vehId):setActive(1)
else
for _, vehId in ipairs(stepData.jbeamTargets) do
getObjectByID(vehId):setActive(0)
local function stopAllAi()
for _, stepData in ipairs(sanitizedStepsData) do
if stepData.aiType == "ScriptAi" then
local function trackVehiclesForCrash()
for _, stepData in ipairs(sanitizedStepsData) do
for _, vehId in ipairs(stepData.jbeamTargets) do
for _, stepData in ipairs(sanitizedStepsData) do
for _, vehId in ipairs(stepData.jbeamTargets) do
tryAddVehicleToCrashDetection(vehId)
if currentStepParameters.jbeamTargets then
for _, vehId in ipairs(currentStepParameters.jbeamTargets) do
if shouldDrawMarker(vehId) then
else --display all targets
for _, stepData in ipairs(sanitizedStepsData) do
if stepData.targetType == "Static object" then
else
for _, vehId in ipairs(stepData.jbeamTargets) do
local veh = getObjectByID(vehId)
if currentStepParameters.aiType == "ScriptAi" or currentStepParameters.aiType == "Stuck Throttle" then
for _, vehId in ipairs(currentStepParameters.jbeamTargets) do
if shouldDrawMarker(vehId) then
@/lua/ge/extensions/gameplay/missions/unlocks.lua
local missionIdsById = {}
for _, mission in ipairs(missions) do
local startableInfo = conditionMet(mission.startCondition or deepcopy(conditionTypes['always']))
end
for _, mission in ipairs(missions) do
local isVisible = true
else
for _, bId in ipairs(mission.unlocks.backward or {}) do
local back = gameplay_missions_missions.getMissionById(bId)
local cache = {}
for _, mission in ipairs(gameplay_missions_missions.get()) do
cache[mission.id] = deepcopy(mission.unlocks)
local ret = {}
for _, key in ipairs(keysToCheck) do
if a[key] ~= b[key] then
local diff = {list = {}, byId = {}, missionsList={}}
for _, mission in ipairs(gameplay_missions_missions.get()) do
local id = mission.id
local fwd = {list = {}}
for _, id in ipairs(mission.unlocks.forward) do
local otherMission = gameplay_missions_missions.getMissionById(id)
if cond.nested then
for _, n in ipairs(cond.nested) do
getMissionsForCondition(n, list)
if cond.nested then
for _, n in ipairs(cond.nested) do
M.getBranchLevelForCondition(n, list)
nxt = {}
for _, mId in ipairs(front) do
missionById[mId].unlocks.maxBranchlevel = math.max(missionById[mId].unlocks.maxBranchlevel, startLevel)
missionById[mId].unlocks.maxBranchlevel = math.max(missionById[mId].unlocks.maxBranchlevel, startLevel)
for _, nId in ipairs(missionById[mId].unlocks.forward) do
nxt[nId] = true
-- first, get the base data for all missions: associated missions, branch levels.
for _, m in ipairs(missions) do
missionById[m.id] = m
for bId, list in pairs(backward) do
for _, fId in ipairs(list or {}) do
if not forward[fId] then forward[fId] = {} end
-- set the data to the unlocks field of the mission.
for _, m in ipairs(missions) do
if #backward[m.id] > 0 then
local missionIdsWithBranchCondition = tableKeysSorted(highestLevelForMission)
for _, mId in ipairs(missionIdsWithBranchCondition) do
propagateBranchLevel(mId, missionById)
local depth = 0
for _, m in ipairs(missions) do
m.unlocks.depth = -1
nxt = {}
for _, mId in ipairs(front) do
missionById[mId].unlocks.depth = math.max(missionById[mId].unlocks.depth, depth)
missionById[mId].unlocks.depth = math.max(missionById[mId].unlocks.depth, depth)
for _, nId in ipairs(missionById[mId].unlocks.forward) do
nxt[nId] = true
local maxLevel = 0
for _, m in ipairs(missions) do
maxDepthPerBranchlevel[m.unlocks.maxBranchlevel] = math.max(m.unlocks.depth, maxDepthPerBranchlevel[m.unlocks.maxBranchlevel] or 0)
-- shift the depth of a mission based on the amount of branches, branch depth, branch level
for _, m in ipairs(missions) do
m.unlocks.depth = m.unlocks.depth + maxDepthPerBranchlevel[m.unlocks.maxBranchlevel] + (m.unlocks.maxBranchlevel)*1
local count = 0
for _, file in ipairs(files) do
local aConds = require(file:sub(0,-5))
@/lua/ge/extensions/core/trafficSignals.lua
if statics then
for _, obj in ipairs(statics) do -- search for static objects with dynamic data
local instanceName = obj.signalInstance -- signal instance dynamic field
for _, id in ipairs(self.linkedObjects) do -- actual traffic signal objects
local obj = scenetree.findObjectById(id)
if obj then
for i, light in ipairs(lightsArray) do
obj:setField(instanceColorKeys[i], '0', light == 'black' and lightOff or lightOn)
artDir = artDir..'art/shapes/'
for _, f in ipairs(FS:findFiles(artDir, '*', -1, true, false)) do
if string.find(f, shapeFile) then
artDir = 'art/shapes/' -- if not found, then search the common assets
for _, f in ipairs(FS:findFiles(artDir, '*', -1, true, false)) do
if string.find(f, shapeFile) then
local refPos = self.pos + self.dir * 5 -- this is rough; the radius should reach to somewhere near the intersection center
for _, instance in ipairs(instances) do
-- intersection requirements here
for _, oid in ipairs(signalObjects) do
local obj = scenetree.findObjectById(oid)
for _, light in ipairs(lightsTbl) do
debugDrawer:drawSphere(debugPos, 0.25, controllerDefinitions.signalColors[light] or controllerDefinitions.signalColors.white)
for _, inner in ipairs(stepData) do -- inner table: {controllerName, phaseIndex, stateIndex}
local seqCtrl = controllerStates[inner[1]]
if instancesByName[self.name] then
for i, instance in ipairs(instances) do
if instance.name == self.name then
if data.states then
for _, state in ipairs(data.states) do
local stateData = self:getStateData(state)
if not self.isSimple and self.states[1] then -- checks if state durations are enabled
for _, state in ipairs(self.states) do
if not state.duration or state.duration < 0 then
for _, state in ipairs(self.states) do
if state.state == 'greenTrafficLight' or state.state == 'greenFlashingTrafficLight' then
if controllersByName[self.name] then
for i, ctrl in ipairs(controllers) do
if ctrl.name == self.name then
for _, phase in ipairs(self.phases) do
phase.totalDuration = 0
phase.controllerIds = {}
for _, cd in ipairs(phase.controllerData) do
table.insert(phase.controllerIds, cd.id)
for _, cid in ipairs(phase.controllerIds) do
local ctrl = controllersRef and controllersRef[cid] or elementsById[cid] -- use controllersRef if provided, otherwise use the existing elementsById
for _, inner in ipairs(stepData) do -- inner table: {controllerName, phaseIndex, stateIndex}
self.currPhase = inner[2]
local stepData = self.timeline[self.timelineTimes[self.currStep]]
for _, inner in ipairs(stepData) do -- inner table: {controllerName, phaseIndex, stateIndex}
local state = self.controllerStates[inner[1]]
local stepData = self.timeline[self.timelineTimes[self.currStep]]
for _, inner in ipairs(stepData) do
local state = self.controllerStates[inner[1]]
-- the following code builds internal timeline and controllerStates tables, which are read and processed during the simulation
for phaseIdx, phase in ipairs(self.phases) do
local totalTimeUpdated = false
local phaseTime = phase.startTime or totalTime
for _, cid in ipairs(phase.controllerIds) do
if elementsById[cid] then
for _, instance in ipairs(instances) do
if instance.sequenceId == self.id and instance.controllerId == cid then
local stateTime = phaseTime
for stateIdx, state in ipairs(controller.states) do
self.timeline[stateTime] = self.timeline[stateTime] or {}
if sequencesByName[self.name] then
for i, sequence in ipairs(sequences) do
if sequence.name == self.name then
for _, sequence in ipairs(sequences) do
sequence:setActive(not sequence.startDisabled)
for _, instance in ipairs(instances) do
if not instance._invalid then
for _, ctrl in ipairs(controllers) do
ctrl:calcDuration()
for _, sequence in ipairs(sequences) do
sequence:calcDuration()
if obj then
for i, state in ipairs(stateArray) do
obj:setField(instanceColorKeys[i], '0', state and lightOn or lightOff)
local delInstances, delControllers, delSequences = {}, {}, {}
for i, v in ipairs(instances) do
if not elementsById[v.id] then
end
for i, v in ipairs(controllers) do
if not elementsById[v.id] then
end
for i, v in ipairs(sequences) do
if not elementsById[v.id] then
data.instances = data.instances or {}
for i, v in ipairs(data.instances) do
local new = SignalInstance:new()
data.controllers = data.controllers or {}
for i, v in ipairs(data.controllers) do
local new = SignalController:new()
data.sequences = data.sequences or {}
for i, v in ipairs(data.sequences) do
local new = SignalSequence:new()
for _, instance in ipairs(instances) do
if instance:getState() == stateName then
for _, sequence in ipairs(sequences) do
if sequence.active and sequence.enableTestTimer and not sequence.ignoreTimer then -- optional self timer for sequences (for debug or inspection purposes)
signalUpdateResults[k].lightStates = {}
for _, light in ipairs(stateData.lights) do
table.insert(signalUpdateResults[k].lightStates, light ~= 'black')
for _, instance in ipairs(instances) do
if core_camera.getPosition():squaredDistance(instance.pos) <= viewDistSq then -- checks if camera is close enough to signal
data[k] = {}
for _, v in ipairs(e) do
table.insert(data[k], v:onSerialize())
for _, v in ipairs(data.instances) do
local res = SignalInstance:new()
end
for _, v in ipairs(data.controllers) do
local res = SignalController:new()
end
for _, v in ipairs(data.sequences) do
local res = SignalSequence:new()
for k, e in pairs({instances = instances, controllers = controllers, sequences = sequences}) do
for i, v in ipairs(e) do
if type(v.id) == 'number' then
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/levelTiles.lua
local function onGameplaySelectorGetTiles(items)
for _, level in ipairs(core_levels.getList()) do
local defaultSpawnPointCount = 0
local defaultSpawnPointCount = 0
for idx, spawnPoint in ipairs(level.spawnPoints) do
local name = spawnPoint.translationId or spawnPoint.name or spawnPoint.objectname or "Unnamed Spawnpoint"
if level then
for _, s in ipairs(level.spawnPoints) do
if s.objectname == spawnPointObjectName then
table.clear(data.buttonInfo)
for _, button in ipairs(customButtons) do
table.insert(data.buttonInfo, buttonInstance.addButton(function()
if level then
for _, s in ipairs(level.spawnPoints) do
if s.objectname == spawnPointObjectName then
@/lua/vehicle/controller/playerController.lua
local ballNodeForceVector = (-vectorUp * ballNodeForce)
for _, cid in ipairs(ballGroundContactNodesPast) do
obj:applyForceVector(cid, ballNodeForceVector)
end
for _, cid in ipairs(lockBeams) do
obj:setBeamLength(cid, obj:getBeamLength(cid))
@/lua/ge/extensions/flowgraph/nodes/logic/compare.lua
if im.BeginCombo("##comparisonFunc", self.comparison.opName, 0) then
for _,comparison in ipairs(comparisonOps) do
if im.Selectable1(comparison.opName, comparison.opName == self.comparison.opName) then
for _, comparison in ipairs(comparisonOps) do
if opSymbol == comparison.opSymbol then
@/lua/ge/extensions/editor/terrainEditor.lua
if var.paintMaterialNamesArray then
for k, mat in ipairs(var.paintMaterialNamesArray) do
-- log('I', 'terrainEditor', '[DEBUG] Material[' .. k .. '] = "' .. mat .. '"')
local function getMtlByName(matName) --terrain layers
for k, mat in ipairs(paintMaterialProxies) do
if mat == matName then
local function getGlobalMtlIdByName(matName) --all terrain material
for k, mat in ipairs(paintMaterialProxies) do
if mat.internalName == matName then
for k, map in ipairs(terrainImpExp.textureMaps) do
if path == map.path then
local function getBrushByName(brushName)
for _, brush in ipairs(terrainBrushes) do
if brush.name == brushName and (brush.disabled == nil or brush.disabled == false) then
clearTextureMaps()
for k, map in ipairs(preset.opacityMaps) do
addTextureMap(map)
for k, mtl in ipairs(mtls) do
local mtlName = mtl:getInternalName()
-- set indices
for k, mtlProxy in ipairs(paintMaterialProxies) do
if paintMaterialIndices[mtlProxy.material:getID()] ~= nil then
terrainBlockProxies = {}
for _, name in ipairs(scenetree.findClassObjects("TerrainBlock")) do
terrainBlockProxies[name] = {selected = false, id = scenetree.findObject(name):getID()}
local materials = {}
for i,map in ipairs(terrainImpExp.textureMaps) do
-- Validate that materialId matches the actual material name
if var.paintMaterialNamesArray then
for j, matName in ipairs(var.paintMaterialNamesArray) do
if matName == map.material then
local time = os.time()
for _,map in ipairs(opMaps) do
local stat = FS:stat(map)
else
for k,m in ipairs(terrainImpExp.textureMaps) do
m.selected = false
local function hasPaintMaterial(name)
for _, mat in ipairs(paintMaterialProxies) do
if mat.internalName == name then
for _, mat in ipairs(paintMaterialProxies) do
if mat.index == terrainMtlProxy.index then
local thisFrameHoveredIndex = nil
for index, matProxy in ipairs(paintMaterialProxies) do
if matProxy.inTerrainBlock then
local time = os.time()
for k, map in ipairs(terrainImpExp.textureMaps) do
table.insert(data.opacityMaps, map.path)
if im.CollapsingHeader1("Texture Maps", im.TreeNodeFlags_DefaultOpen) then
for k, map in ipairs(terrainImpExp.textureMaps) do
-- im.Spacing()
for i, brushType in ipairs(brushTypes) do
terrainEditorEditModeToolbarBrushTypeButton(brushType, true)
for i, brush in ipairs(terrainBrushes) do
terrainEditorEditModeToolbarBrushButton(brush)
elseif brushName == "terraform" then
for _, b in ipairs(terrainBrushes) do
if b.name == "terraform" then
if brushTypeName ~= "" then
for _, brushType in ipairs(brushTypes) do
if brushTypeName == brushType.name then
@/lua/vehicle/extensions/scenario/functionFreezer.lua
-- parse function names, so we know what must be frozen/unfrozen in the future
for _,functionString in ipairs(data) do
local func = loadstring("return "..functionString)() -- func is only used for sanitization checks
@/lua/ge/extensions/ui/gameplaySelector/general.lua
-- Check filters
for _, filter in ipairs(validFilters) do
local propVal = item[filter.propName:lower()]
if details and details.buttonInfo then
for _, button in ipairs(details.buttonInfo) do
if button.isDoubleClickAction or #details.buttonInfo == 1 then
@/lua/common/libs/luasocket/socket/socket.lua
err = "no info on address"
for i, alt in base.ipairs(addrinfo) do
if alt.family == "inet" then
@/lua/ge/extensions/flowgraph/nodes/gameplay/sites/location.lua
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("out", {'string','number'}, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
end
for _, o in ipairs(self.options) do
self.pinOut[o].value = self._location.customFields.values[o]
@/lua/ge/extensions/editor/flowgraph/examples.lua
for i, filename in ipairs(FS:findFiles(stateTemplatePath, '*flow.json', -1, true, false)) do
local debugEnabled = editor.getPreference("flowgraph.debug.editorDebug")
for _, result in ipairs(self.results or {}) do
if self.filterByType and string.lower(result.type) == string.lower(self.filterByType) or not self.filterByType then
table.sort(sortedExamples, function(a,b) return (element.examples[a].data.exampleOrder or 10^10) < (element.examples[b].data.exampleOrder or 10^10) end )
for i, key in ipairs(sortedExamples) do
local example = element.examples[key]
)
for _, key in ipairs(sortedKeys) do
if im.TreeNode1(key.."##"..depth) then
@/lua/ge/extensions/gameplay/rally/loop/rallyEventLog.lua
local result = {}
for _, item in ipairs(self.items) do
if item.type == type then
local result = {}
for _, item in ipairs(self.items) do
if item.data.stageTimeSecs then
local total = 0
for _, item in ipairs(self.items) do
if item.type == 'penalty' and item.data.amount then
local total = 0
for _, item in ipairs(self.items) do
if item.data.stageTimeSecs then
-- First pass: collect all groups in order
for _, item in ipairs(self.items) do
local eventGroup = item.eventGroup
local groups = {}
for _, eventGroup in ipairs(groupOrder) do
local groupData = groupMap[eventGroup]
@/lua/vehicle/extensions/profiling/p.lua
local ann = prof_ann
for _, file in ipairs(files) do
local f0 = file:byte()
@/lua/ge/extensions/editor/meshSpline/import.lua
local uniquePaths = {}
for _, path in ipairs(mainMeshes) do -- Count the number of times each mesh path appears.
uniquePaths[path] = (uniquePaths[path] or 0) + 1
local sequence = {}
for i, path in ipairs(mainMeshes) do
local idx = (i - 1) % #uniqueList + 1
if data.deletedTSStatics then -- Recreate the deleted TSStatic objects
for _, entry in ipairs(data.deletedTSStatics) do
local obj = createObject("TSStatic")
if data.deletedTSStatics then -- Delete the previously restored TSStatic objects (if any still exist)
for _, entry in ipairs(data.deletedTSStatics) do
if entry.name then
@/lua/ge/extensions/editor/camPathEditor.lua
local function getSplineResolution(dist)
for i, threshold in ipairs(splineThresholds) do
if threshold > dist then
if selectedMarker then
for i, marker in ipairs(path.markers) do
marker.index = i
if selectedMarker then
for i, marker in ipairs(path.markers) do
if marker.index == selectedMarker then
local lastPoint = nil
for index, marker in ipairs(markers) do
--marker.pos = marker.pos
local hasTrackingMarker = false
for _, marker in ipairs(M.currentPath.markers) do
if marker.trackPosition then
for index, marker in ipairs(M.currentPath.markers) do
im.TableNextRow()
local minNodeDist = u_32_max_int
for _, path in ipairs(core_paths.getPaths()) do
for i, marker in ipairs(path.markers) do
for _, path in ipairs(core_paths.getPaths()) do
for i, marker in ipairs(path.markers) do
local distMarkerToCam = (marker.pos - camPos):length()
if im.BeginCombo('##overlayMode', overlayModes[overlayMode[0] + 1]) then
for i, modeName in ipairs(overlayModes) do
if im.Selectable1(modeName, overlayMode[0] == (i - 1)) then
if im.BeginCombo('##paths', showedName) then
for _, path in ipairs(core_paths.getPaths()) do
if im.Selectable1(path.name .. '##' .. path.id) then
arrayReverse(files)
for _, recording in ipairs(files) do
if im.Selectable1(recording.filename, nil) then
for i, path in ipairs(core_paths.getPaths()) do
drawDebugPath(path, focusPos)
@/lua/ge/extensions/core/camera.lua
constructorsCache = {}
for _,file in ipairs(FS:findFiles(camDirectory, "*.lua", 1, false, false)) do
local _,camMode,_ = path.splitWithoutExt(file)
--log("D", "", "Running cameras order:")
--for i,v in ipairs(runningCamsOrderCache) do
--log("D", "", string.format(" #%i: order=%5.3f, name=%s", i, v.cam.runningOrder, v.name))
local slotId = 1
for _, v in ipairs(config) do
local visible = vdata.cameras[v.name] and not vdata.cameras[v.name].hidden
local function getCamIdFromName(camName)
for id,config in ipairs(configuration) do
if config.name == camName then
local function getConfigByName(camName)
for i,config in ipairs(configuration) do
if config.name == camName then
local function _setVehicleCameraByName(vdata, camName, withTransition)
for camId, config in ipairs(configuration) do
if config.name == camName then
local config = getExtendedConfig(vdata)
for k,v in ipairs(config) do
if v.slotId == slotId then
end
for k,v in ipairs(camConfigs) do
if v.name ~= "onboard.driver" and string.lower(v.name) == "onboard.driver" then
configuration = {}
for k,v in ipairs(initialConfiguration) do
local enabled = v.enabled
local configured = false
for _,v in ipairs(configuration) do
if v.name == name then configured = true end
local lowestOrderId = nil
for k, name in ipairs(renaminingCamNames) do
-- locate idx with the minimum order value
-- running cameras
for _,v in ipairs(getRunningCamsOrder()) do
v.cam:update(camData)
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/followPath.lua
if im.BeginCombo("Reset Mode##rMode"..self.id , self.loopMode) then
for _, mode in ipairs({"neverReset","alwaysReset","startReset"}) do
if im.Selectable1(mode, mode==self.loopMode) then
local path = {}
for i, p in ipairs(self.path.path) do
path[i] = {x=p.x, y=p.y, z=p.z, t=p.t / self.timeScale, dir = p.dir or nil, up = p.up or nil}
@/lua/ge/extensions/flowgraph/nodes/mission/selectGarage2GarageVehicle.lua
-- vehicleOptions is a flat list: [{model, config, name}, ...]
for _, cfg in ipairs(vehicleOptions) do
if cfg.model and cfg.config then
local availableConfigs = {}
for _, configData in ipairs(allConfigs) do
if not self.usedConfigs[configData.model] or not self.usedConfigs[configData.model][configData.config] then
@/lua/vehicle/ai.lua
local lastPlanPidx = currentRoute.plan[currentRoute.plan.planCount].pathidx
for _, lc in ipairs(currentRoute.laneChanges) do
if lc.pathIdx <= lastPlanPidx then
for _, v in ipairs(traffic.trafficTable) do
dP:setSub2(v.posFront, ego.pos)
if opt.racing then
for _, v in ipairs(traffic.trafficTable) do -- side avoidance loop
local backAwereness = 0 --0.25 -- must be between 0 and 1
else
for _, v in ipairs(traffic.trafficTable) do -- side avoidance loop
local xnorm = v.posFront:xnormOnLine(midPos + lenVec, midPos - lenVec)
local sccIdx
for i, scc in ipairs(allSCC) do
-- finds the scc with the most nodes
local uTurn = false
for i, p in ipairs(currentRoute.path) do -- detect path u-turn
if p == playerNode then break end
table.clear(trafficPathState)
for i, v in ipairs(newPath) do trafficPathState[i] = v end
table.clear(trafficPathState)
for i, v in ipairs(path) do trafficPathState[i] = v end
currentRoute.lastLaneChangeIdx = currentRoute.lastLaneChangeIdx - k
for _, v in ipairs(currentRoute.laneChanges) do
v.pathIdx = v.pathIdx - k
if traffic and traffic[i] then
for _, data in ipairs(traffic[i]) do
local plPosOnPlan = linePointFromXnorm(n.pos, plan[i+1].pos, data[2])
@/lua/ge/extensions/ui/apps/pointsBar.lua
guiData.thresholdsReached = {}
for i, threshold in ipairs(pointsData.thresholds) do
guiData.thresholdsReached[i] = points >= threshold
guiData.thresholdPercentages = {}
for i, threshold in ipairs(pointsData.thresholds) do
guiData.thresholdPercentages[i] = threshold / maxValue * 100
im.Text("Thresholds:")
for i, threshold in ipairs(pointsData.thresholds) do
im.BulletText(string.format("Threshold %d: %d", i, threshold))
@/lua/ge/extensions/ui/vehicleSelector/detailsInteraction.lua
if M.customDetailsButtons and next(M.customDetailsButtons) then
for _, button in ipairs(M.customDetailsButtons) do
table.insert(buttonInfo, ui_vehicleSelector_vehicleOperations.addButton(function(additionalData)
@/lua/ge/extensions/flowgraph/nodes/ui/endScreen.lua
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
end
for _, btn in ipairs(self.options) do
if self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
if self.mgr.activity and self.mgr.activity.nextMissions then
for _, mid in ipairs(self.mgr.activity.nextMissions or {}) do
local mission = gameplay_missions_missions.getMissionById(mid)
local points, max = 0,0
for k, v in ipairs(self.pinIn.stats.value or {}) do
points = points + v.points or 0
statsData.text = ""
for _, c in ipairs(change.list) do
if type(c.new) == 'number' then
@/lua/ge/extensions/util/nodeBeamExport.lua
local maxIdx = 0
for _, f in ipairs(files) do
local name = string.match(f, '([^/\\]+)$')
@/lua/ge/extensions/campaign/dealer.lua
local found = false
for _,item in ipairs(entryTable) do
for k,v in pairs(item) do
print('dealer looping...')
for index,entry in ipairs(itemTable) do
print(entry.model, entry.config)
@/lua/ge/extensions/ui/missionInfo.lua
if M.buttonsTable then
for i,button in ipairs(M.buttonsTable) do
if button.action == actionName then
M.elemDataTable = {}
for i, elem in ipairs(content) do
M.buttonsTable[i] = elem.buttonFun
@/lua/ge/extensions/gameplay/missions/proceduralMissionGenerators/timeTrialMissions.lua
local data = path:onSerialize()
for _, field in ipairs(cacheFields) do data[field] = race[field] end
cachedRaceFiles[cacheFile] = data
local ret = {}
for _, elem in ipairs(list or {}) do
if elem ~= "" and elem ~= "/" then
local hiddenFiles = {}
for _, mission in ipairs(gameplay_missions_missions.getFilesData()) do
--if mission.missionType == 'timeTrial' then
for _, level in ipairs(data) do
for _, race in ipairs(level.tracks) do
for _, level in ipairs(data) do
for _, race in ipairs(level.tracks) do
--dump(dumps(race.ignoreAsMission or "fals").." ".. dumps(race.trackName) )
local previewFilenameExt = nil
for _, ext in ipairs(previewExt) do
if not mission.previewFile then
for key, _ in pairs(autoPrefabs) do
for i, p in ipairs(mission.missionTypeData[key] or {}) do
if not FS:fileExists(p) then
local found = false
for _, ext in ipairs(prefabExt) do
local file = "levels/"..level.levelName.."/"..p..ext
for list, suf in pairs(autoPrefabs) do
for _, ext in ipairs(prefabExt) do
local file = "levels/"..level.levelName.."/quickrace/"..race.trackName..suf..ext
mission.startTrigger.level = string.lower(level.levelName)
for _, sp in ipairs(race.startPositions) do
if sp.oldId == race.defaultStartPosition then
@/lua/ge/extensions/freeroam/freeroam.lua
if level and level.flowgraphs then
for _, absolutePath in ipairs(level.flowgraphs or {}) do
local relativePath = level.misFilePath..absolutePath
-- Find the time value for the given key
for _, option in ipairs(timeOfDayOptions) do
if option.key == time then
if core_recoveryPrompt.isActive() then return end
for _, mgr in ipairs(core_flowgraphManager.getAllManagers()) do
if mgr:blocksOnResetGameplay() then return end
@/lua/common/libs/luamqtt/mqtt/client.lua
local function remove_item(list, item)
for i, test in ipairs(list) do
if test == item then
self._handling[event] = true -- protecting self.handlers[event] table from modifications by client_mt:off() when iterating
for _, handler in ipairs(handlers) do
handler(...)
if to_remove then
for _, func in ipairs(to_remove) do
remove_item(handlers, func)
@/lua/ge/extensions/editor/mainToolbar.lua
currentSet.modes = {}
for _, mode in ipairs(selectedModesList) do
table.insert(currentSet.modes, {name = mode.name, key = mode.key})
local function findModeInAvailableModes(key)
for _, mode in ipairs(allModes) do
if mode.key == key then
if set then
for _, mode in ipairs(set.modes) do
if findModeInAvailableModes(mode.key) then
-- reset the selected bool when a set is clicked in the list
for _, mode in ipairs(allModes) do
mode.selected = false
if set then
for _, mode in ipairs(set.modes) do
if findModeInAvailableModes(mode.key) then
local selectedIndices = {}
for i, mode in ipairs(selectedModesList) do
if mode.selected then
local selectedIndices = {}
for i, mode in ipairs(selectedModesList) do
if mode.selected then
local selectedIndices = {}
for i, mode in ipairs(selectedModesList) do
if mode.selected then
local selectedIndices = {}
for i, mode in ipairs(selectedModesList) do
if mode.selected then
local function deselectAllAvailableModes()
for _, mode in ipairs(allModes) do
mode.selected = false
local function deselectAllSelectedModes()
for _, mode in ipairs(selectedModesList) do
mode.selected = false
currentSet = nil
for _, set in ipairs(editModeSets) do
if set.name == "Default Set" then
local setModes = {}
for _, modeName in ipairs(currentSet.modes) do
-- Find the mode key by display name
-- List of edit mode sets
for i, set in ipairs(editModeSets) do
local bgColor = i == selectedSetIndex and buttonColor_active or buttonColor_inactive
im.BeginChild1("EditModeSets", im.ImVec2(200, 400), true)
for i, set in ipairs(editModeSets) do
if set.name == "Default Set" then
local function findKeyInSelectedModes(key)
for _, mode in ipairs(selectedModesList) do
if mode.key == key then
if selectedSetIndex > 1 then
for i, mode in ipairs(allModes) do
if findKeyInSelectedModes(mode.key) then
local anyModeSelected = false
for _, mode in ipairs(allModes) do
if mode.selected then
-- Move all items to selected list
for _, mode in ipairs(allModes) do
if not findKeyInSelectedModes(mode.key) then
-- Add selected modes
for i, mode in ipairs(allModes) do
if mode.selected then
local hasSelectedSelected = false
for _, mode in ipairs(selectedModesList) do
if mode.selected then
local indicesToRemove = {}
for i, mode in ipairs(selectedModesList) do
if mode.selected then
-- Move all items to available list
for _, mode in ipairs(selectedModesList) do
if not findKeyInSelectedModes(mode.key) then
if selectedSetIndex > 1 then
for i, mode in ipairs(selectedModesList) do
local bgColor = mode.selected and buttonColor_active or buttonColor_inactive
local hasSelectedSelected = false
for _, mode in ipairs(selectedModesList) do
if mode.selected then
for _, key in ipairs(sortedKeys) do
local val = editor.editModes[key]
for _, key in ipairs(sortedKeys) do
if numIconsLeftToShow <= 0 then
local skippedEditMode = nil
for _, key in ipairs(sortedKeys) do
local breakIndex = isSelectedModeShownOnToolbar and 0 or 1
--Add the selected edit mode as the last icon on the toolbar
for _, key in ipairs(sortedKeys) do
local val = editor.editModes[key]
local uiScaling = editor.getPreference("ui.general.scale") or 1.0;
for _, key in ipairs(sortedKeys) do
local val = editor.editModes[key]
for _, key in ipairs(sortedKeys) do
local val = editor.editModes[key]
if path == "ui.general.enableVehicleControls" then
for _, mapName in ipairs(vehicleActionMaps) do
local map = scenetree.findObject(mapName)
@/lua/ge/extensions/ui/liveryEditor/layers/group.lua
dump("group setColor", rgbaArray)
-- for k, childLayer in ipairs(layer.children) do
-- childLayer.color = Point4F.fromTable(rgbaArray)
M.setMetallicIntensity = function(layer, metallicIntensity)
for k, childLayer in ipairs(layer.children) do
childLayer.metallicIntensity = metallicIntensity
M.setRoughnessIntensity = function(layer, roughnessIntensity)
for k, childLayer in ipairs(layer.children) do
childLayer.roughnessIntensity = roughnessIntensity
M.setNormalIntensity = function(layer, normalIntensity)
for k, childLayer in ipairs(layer.children) do
childLayer.normalIntensity = normalIntensity
@/lua/ge/extensions/flowgraph/baseStateNode.lua
self.transitionPins = {_in = {}, _out = {}}
for _, d in ipairs({'N','E','S','W'}) do
local pIn = _createPin(self.graph, self, "in", "transition", "tIn"..d)
@/lua/ge/extensions/gameplay/rally/notebook/structured/textCompositor.lua
sysNotes[name] = {}
for _,variant in ipairs(variants) do
local pacenoteHash = rallyUtil.pacenoteHashSha1(variant.text)
local sorted = {}
for _, k in ipairs(keys) do
table.insert(sorted, compacted[k])
for _, dist in ipairs(distances) do
table.insert(combined, { phrase = dist, hash = rallyUtil.pacenoteHashSha1(dist) })
for _, note in ipairs(pacenotes) do
table.insert(combined, { phrase = note, hash = rallyUtil.pacenoteHashSha1(note) })
systemCount = systemCount + #variants
for _,variant in ipairs(variants) do
table.insert(combined, { phrase = variant.text, hash = rallyUtil.pacenoteHashSha1(variant.text) })
local seen = {}
for _, item in ipairs(combined) do
if not seen[item.phrase] then
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaShifter.lua
local crc = 0x0
for _, b in ipairs(data) do
crc = bxor(crc, b)
else
-- for _, messageId in ipairs(messageIdsToIgnore) do
-- if msg.ID == messageId then
@/gameplay/missionTypes/aiRace/customNodes/aiScatterNode.lua
function C:workOnce()
for _, v in ipairs(getAllVehiclesByType()) do
local id = v:getID()
@/lua/ge/extensions/editor/missionPlaybook.lua
careerMissionIds = {}
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.careerSetup.showInCareer then
local sortedStars = mission.careerSetup._activeStarCache.sortedStars
for sIdx, key in ipairs(sortedStars) do
im.PushID1(key.."child")
local sortedStars = mission.careerSetup._activeStarCache.sortedStars
for sIdx, key in ipairs(sortedStars) do
if e.stars[key] then
for i, e in ipairs(M.book.instructions) do
if i < untilIdx then
local choiceBook = {}
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.careerSetup.showInCareer and m.unlocks.startable then
local defaultCache = {}
for i, key in ipairs(m.careerSetup._activeStarCache.defaultStarKeysSorted) do
defaultCache[key] = true
local bonusChoices = {}
for _, key in ipairs(m.careerSetup._activeStarCache.bonusStarKeysSorted) do
if not m.saveData.unlockedStars[key] then
if params.defaultOrder then
for _, e in ipairs(choiceBook) do
for _, i in ipairs(e) do
for _, e in ipairs(choiceBook) do
for _, i in ipairs(e) do
table.insert(instructions, i)
if im.BeginMenu("All Missions, only...") then
for _, tier in ipairs({1, 2, 3}) do
if im.MenuItem1("All Missions, only Tier " .. tier) then
im.Separator()
for _, amount in ipairs({1,5,10,25,50,100}) do
if im.MenuItem1("All Missions, only ".. amount.." stars") then
end
for _, branch in ipairs(career_branches.getSortedBranches()) do
im.Separator()
end
for _, tier in ipairs({1, 2, 3}) do
if im.MenuItem1("Only " .. branch.name..", only Tier " .. tier) then
for i, e in ipairs(M.book.instructions) do
im.PushID1(i.."ElementPlaybook")
@/lua/ge/extensions/editor/api/decal.lua
local function saveDecals()
for _,template in ipairs(templatesQueuedForDel) do
if template:getFileName() == getDecalDataFilePath() then
@/lua/ge/extensions/editor/bulkRename.lua
for _, id in ipairs(objectIds) do
obj = scenetree.findObjectById(id)
@/lua/ge/extensions/core/flowgraphManager.lua
end)
--for _, simpleNodeConstructor in ipairs(FS:findFiles(simpleNodeConstructorPath,"*.json")) do
-- require(simpleNodeConstructor)
local function clearAllManagers()
for _, mgr in ipairs(managers) do
mgr:destroy()
local function getManagerByID(id)
for _,mgr in ipairs(managers) do
if mgr.id == id then
local index = -1
for i, m in ipairs(managers) do
if mgr.id == m.id then index = i end
local function onLoadingScreenFadeout()
for _, fg in ipairs(startOnLoadingScreenFadeoutList) do
fg:setRunning(true)
local function onUpdate()
for _, mgr in ipairs(managers) do
mgr:resolveHooksAndReset()
end
for _,mgr in ipairs(nextFrameStart) do
mgr:setRunning(true)
end
for _,mgr in ipairs(nextFrameRemove) do
M.removeManager(mgr)
table.clear(nextFrameStart)
for _, mgr in ipairs(managers) do
mgr:broadcastCall("onFlowgraphManagerPreUpdate")
if filename:sub(string.len(filename)-7,string.len(filename)) == 'Node.lua' then
for _,manager in ipairs(managers) do
if manager.savedDir and (manager.savedDir.."customNodes/") == dirname then
local uniques = {}
for i,mgr in ipairs(managers) do
if not mgr.transient then
local index = -1
for j, mgr in ipairs(managers) do
if mgr == u then index = j end
if data.mgrs then
for i, mgr in ipairs(data.mgrs) do
local m = M.addManager(mgr)
if data.uniques then
for _, un in ipairs(data.uniques) do
uniqueManagers[un.name] = managers[un.index]
local lookup = {}
for i, filename in ipairs(FS:findFiles(nodePath, '*.lua', -1, true, false)) do
local dirname, fn, e = path.split(filename)
if node.pinSchema then
for _, pin in ipairs(node.pinSchema) do
if type(pin.type) == 'table' then -- because multiple types per pin are possible
local lookup = {}
for i, filename in ipairs(FS:findFiles(stateTemplatePath, '*state.flow.json', -1, true, false)) do
local dirname, fn, e = path.splitWithoutExt(filename, true)
if name == 'reset' then
for i, mgr in ipairs(managers) do
mgr:broadcastCall('onControlsReset')
elseif name == 'action' then
for i, mgr in ipairs(managers) do
mgr:broadcastCall('onControlsAction')
@/lua/ge/extensions/core/settings/settings.lua
for _, compositorPath in ipairs(compositorDirs) do
local _, basenameCmp, _ = path.split(compositorPath)
local voiceDirs = FS:directoryList(compositorPath, false, true)
for _, voiceDir in ipairs(voiceDirs) do
local _, basenameVoice, _ = path.split(voiceDir)
-- Apply Graphics Quality states first because these control other settings that the user may have changed to create a custom setting
for _,qualityKey in ipairs(graphicQualityGroups) do
local value = newState[qualityKey]
for _, k in ipairs(sortedKeys) do
local s = newState[k]
local paints = {}
for _, colorString in ipairs(userColorPresets)do
local color = stringToTable(colorString)
@/lua/ge/extensions/editor/missionEditor/objectives.lua
extensions.load('career_branches')
for _, branch in ipairs(career_branches.getSortedBranches()) do
table.insert(self.attributeOptions, branch.attributeKey)
for key, rewards in pairs(m.careerSetup.starRewards) do
for _, re in ipairs(rewards) do
if re.rewardAmount == 0 then
im.Separator()
for i, key in ipairs(self.starKeysSorted) do
if not self.mission.careerSetup.starsActive[key] then im.BeginDisabled() end
if im.BeginCombo('','...') then
for _, key in ipairs(self.attributeOptions) do
if im.Selectable1(key,false) then
local remIdx = nil
for i, re in ipairs(rewards) do
im.PushID1("Reward"..i)
for i, key in ipairs(self.starKeysSorted) do
im.PushID1(key.."child")
local bonusStars = {}
for idx, key in ipairs(self.starKeysSorted) do
if self.mission.careerSetup.starsActive[key] and not tableFindKey(self.mission.careerSetup.defaultStarKeys, key) then
for key, rewards in pairs(self.mission.careerSetup.starRewards) do
for _, re in ipairs(rewards) do
sums.all[re.attributeKey] = (sums.all[re.attributeKey] or 0) + re.rewardAmount
im.NextColumn()
for _, key in ipairs(tableKeysSorted(sums.all)) do
im.Text(key .." -> ".. sums.all[key])
im.NextColumn()
for _, key in ipairs(tableKeysSorted(sums.defaultOnly)) do
im.Text(key .." -> ".. sums.defaultOnly[key])
im.NextColumn()
for _, key in ipairs(tableKeysSorted(sums.bonusOnly)) do
im.Text(key .." -> ".. sums.bonusOnly[key])
@/lua/ge/extensions/editor/dynamicDecals/selection.lua
if layer.children then
for _, child in ipairs(layer.children) do
if child.type == api.layerTypes.decal or child.type == api.layerTypes.brushStroke or child.type == api.layerTypes.path then
@/gameplay/missionTypes/generatedTimeTrial/constructor.lua
self.allPrefabs = {}
for _, p in ipairs(self.missionTypeData.prefabs) do table.insert(self.allPrefabs, p) end
if settings.reverse then for _, p in ipairs(self.missionTypeData.reversePrefabs) do table.insert(self.allPrefabs, p) end end
for _, p in ipairs(self.missionTypeData.prefabs) do table.insert(self.allPrefabs, p) end
if settings.reverse then for _, p in ipairs(self.missionTypeData.reversePrefabs) do table.insert(self.allPrefabs, p) end end
if not settings.reverse then for _, p in ipairs(self.missionTypeData.forwardPrefabs) do table.insert(self.allPrefabs, p) end end
if settings.reverse then for _, p in ipairs(self.missionTypeData.reversePrefabs) do table.insert(self.allPrefabs, p) end end
if not settings.reverse then for _, p in ipairs(self.missionTypeData.forwardPrefabs) do table.insert(self.allPrefabs, p) end end
self.currentProgressKey = string.format("%d-%s-%s",settings.laps or self.missionTypeData.defaultLaps, (settings.reverse or false) and self.missionTypeData.reversible, (settings.rolling or false) and self.missionTypeData.allowRollingStart)
local ret = {}
for i, nId in ipairs(path.config.linearSegments or {}) do
local node = path.pathnodes.objects[nId]
@/lua/ge/extensions/scenario/race_marker.lua
markers[markerListName] = {}
for _, wp in ipairs(wps) do
local marker = createRaceMarker()
@/lua/ge/extensions/editor/missionEditor/careerSetup.lua
extensions.load('career_branches')
for _, branch in ipairs(career_branches.getSortedBranches()) do
table.insert(self.attributeOptions, branch.attributeKey)
if im.BeginCombo('','...') then
for _, key in ipairs(self.attributeOptions) do
if im.Selectable1(key,false) then
local remIdx = nil
for i, re in ipairs(fee) do
im.PushID1("Reward"..i)
if im.BeginCombo("##Skill", self.mission.careerSetup.skill or "(none)") then
for _, skill in ipairs(self.skillOptions) do
if im.Selectable1(skill, skill == self.mission.careerSetup.skill) then
@/gameplay/missionTypes/flowgraph/editor.lua
self:clear()
for _, elem in ipairs(fgConfigurators[fgPath]) do
if elem.type == 'decoText' then
@/lua/common/libs/LuaIRC/set.lua
self.connections[socket] = nil
for k, s in ipairs(self.sockets) do
if socket == s then
if read then
for k, socket in ipairs(read) do
read[k] = self.connections[socket]
@/lua/ge/extensions/editor/vehicleDetailViewer.lua
im.TextUnformatted("Available Layouts:")
for lidx, layoutFilename in ipairs(availableLayoutFiles) do
local _, baseFilename = path.splitWithoutExt(layoutFilename, '.vehicleDetailSetting.json')
@/lua/ge/extensions/util/wsTest.lua
if #events == 0 then return end
for _, evt in ipairs(events) do
if evt.type == 'D' and evt.msg ~= '' then
@/lua/ge/extensions/gameplay/drift/stallingSystem.lua
for _, item in ipairs(history) do
uniqueStunts[item.stuntId] = true
tempScore = gymkhanaStallingOptions.stunts[stunt.type].posStallingWeight
for _, stuntj in ipairs(history) do
buffer[tostring(stuntj.stuntId)] = {repetitions = 0}
@/lua/ge/extensions/gameplay/crashTest/crashTestTaskList.lua
local function clearTasklist()
for _, stepData in ipairs(crashTestData) do
guihooks.trigger("SetTasklistTask", {
local function resetTasklist()
for _, stepData in ipairs(crashTestData) do
guihooks.trigger("SetTasklistTask", {
@/lua/ge/extensions/ui/apps/minimap/minimap.lua
local dpi = im.GetWindowDpiScale()
for i, cluster in ipairs(gameplay_playmodeMarkers.getPlaymodeClusters()) do
local marker = gameplay_playmodeMarkers.getMarkerForCluster(cluster)
end
for _, key in ipairs(tableKeysSorted(stats)) do
im.Text(string.format("%s: %d", key, stats[key]))
im.Separator()
for _, key in ipairs(tableKeysSorted(debugSettings)) do
if debugSettingsData[key] then
if im.BeginCombo(key, debugSettingsData[key][debugSettings[key]].name) then
for i, v in ipairs(debugSettingsData[key]) do
if im.Selectable1(v.name) then
@/lua/ge/extensions/editor/dynamicDecalsTool.lua
if section.buttons then
for k, button in ipairs(section.buttons) do
im.SetCursorPos(im.ImVec2(beforeCPos.x + headerWidth + k * (imguiStyle.ItemSpacing.x) + (k - 1) * buttonHeight, beforeCPos.y))
local nodeColor = im.ImVec4(nodeColorTbl[1], nodeColorTbl[2], nodeColorTbl[3], nodeColorTbl[4])
for _, section in ipairs(sections) do
if section.order >= 1000 then
local nodeColor = im.ImVec4(nodeColorTbl[1], nodeColorTbl[2], nodeColorTbl[3], nodeColorTbl[4])
for _, section in ipairs(sections) do
if section.order < 1000 then
for _, section in ipairs(sections) do
-- Draw windows
-- DECAL TOOL, BRUSH STROKE TOOL, PATH TOOL
for _, item in ipairs(toolbarToolItems) do
item.guiFn()
for _, item in ipairs(toolbarActionItems) do
item.guiFn()
for _, child in ipairs(docsSection.children) do
if im.Button(child.name, im.ImVec2(im.GetContentRegionAvailWidth(), 0)) then
for _, dependency in ipairs(M.dependencies) do
if string.startswith(dependency, "editor_dynamicDecals") then
local sectionsOrder = editor.getPreference("dynamicDecalsTool.general.sectionsOrder")
for _, section in ipairs(sections) do
if section.window then
for _, section in ipairs(sections) do
if section.window then
if path == "dynamicDecalsTool.general.sectionsOrder" then
for _, section in ipairs(sections) do
if value[section.name] then
for _, dependency in ipairs(M.dependencies) do
if string.startswith(dependency, "editor_dynamicDecals") and extensions[dependency].editorPreferenceValueChanged then
{sectionsOrder = {"table", {}, "Order of the sections in the tool window.\nThe lower the number, the higher up the section is displayed.\nIf the number is 1000 or greater, the section will appear in the advanced sections.", nil, nil, nil, nil, nil, function(cat, subCat, item)
for _, section in ipairs(sections) do
im.PushItemWidth(im.CalcTextSize("Texture Fill Layer Properties").x + 2 * im.GetStyle().FramePadding.x)
for _, dependency in ipairs(M.dependencies) do
if string.startswith(dependency, "editor_dynamicDecals") and extensions[dependency].registerEditorPreferences then
M.setSectionOpenState = function(name, newState, setScroll)
for _, section in ipairs(sections) do
if name == section.name then
M.getSectionOpenState = function(name)
for _, section in ipairs(sections) do
if name == section.name then
@/lua/ge/extensions/editor/dragRaceEditor/lanes.lua
for i, lane in ipairs(allLanes) do
local isSelected = i == selectedLaneIndex
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
@/lua/ge/extensions/gameplay/missions/progress.lua
starRewards.originalRewardsPerStar[star] = deepcopy(rewards)
for _, reward in ipairs(rewards) do
local baseAmount = (starRewards.sums[reward.attributeKey] or 0)
career_branches.orderAttributeKeysByBranchOrder(ordered)
for _, key in ipairs(ordered) do
table.insert(starRewards.sumList,{attributeKey = key, rewardAmount = starRewards.sums[key], icon = career_branches.getBranchIcon(key) })
-- configurable aggregates
for _, config in ipairs(mission.autoAggregates or {}) do
if autoAggregate[config.type] then
if career_career and career_career.isActive() and career_modules_logbook then
for _, elem in ipairs(unlockedMissions) do
career_modules_logbook.missionUnlocked(elem.id)
for star, rewards in pairs(starRewards.originalRewardsPerStar) do
for _, reward in ipairs(rewards) do
if not rewardsByAttribute[reward.attributeKey] then
career_branches.orderAttributeKeysByBranchOrder(ordered)
for _, key in ipairs(ordered) do
local rewardInfo = rewardsByAttribute[key]
for _, bd in ipairs(rewardInfo.breakdown) do
bd.soundClass = rewardInfo.soundClass
-- iterate over attempts
for _, attempt in ipairs(progressData.attempts) do
-- iterate over attempts
for _, attempt in ipairs(progressData.attempts) do
local newList = {}
for _, reward in ipairs(list) do
local elem = {rewardAmount = reward.rewardAmount, icon = career_branches.getBranchIcon(reward.attributeKey), attributeKey = reward.attributeKey}
log("D","", string.format("%s - %s reduced to x%0.2f", mission.id, key, rewardMultiplier*100 ))
for _, reward in ipairs(list) do
if reward.attributeKey == "money" then
local function setDynamicStarRewards(mission, userSettings)
for _, key in ipairs(mission.careerSetup._activeStarCache.sortedStars) do
if mission.getDynamicStarReward then
ret['recent'] = 'newRecentLeaderboardEntryKey'
for _, elem in ipairs(mission.autoAggregates) do
if elem.leaderboardKey and elem.newLeaderboardEntryKey then
table.insert(res.labels, " ")
for _, recording in ipairs(autoRecordings) do
if recording.meta.attempt.progressKey == progressKey then
-- build rows
for count, attemptIndex in ipairs(attemptIndices) do
if not limit or count <= limit then
local hasValue = false
for _, row in ipairs(res.rows) do
if row[colIndex] and row[colIndex].text ~= "-" and row[colIndex].text ~= "" then
local newRows = {}
for _, row in ipairs(res.rows) do
local newRow = {}
for i, key in ipairs(starKeys) do
local count = mission.saveData.unlockedStars[key] or 0
for _, key in ipairs(allProgressKeys) do
M.ensureProgressExistsForKey(mission, key)
local progressKeyTranslations = {}
for _, key in ipairs(allProgressKeys) do
progressKeyTranslations[key] = mission.getProgressKeyTranslation and mission:getProgressKeyTranslation(key) or key
local bonusUnlockedStarCount = 0
for i, key in ipairs(starKeys) do
local count = 0
for _, file in ipairs(files) do
local aConds = require(file:sub(0, -5))
local allProgressKeys = tableKeysSorted(mission.saveData.progress)
for _, progressKey in ipairs(allProgressKeys) do
for i = 1, amount do
@/lua/vehicle/extensions/gameplayInterface.lua
local function checkValueChangeNotifications(dt)
for _, v in ipairs(registeredValueChangeNotifications) do
local currentValue = electrics.values[v.electricsKey]
local indexToRemove
for k, v in ipairs(registeredValueChangeNotifications) do
if v.callbackId == callbackId and v.electricsKey == electricsKey then
local function onReset()
for _, v in ipairs(registeredValueChangeNotifications) do
v.lastValue = nil
if moduleFiles then
for _, filePath in ipairs(moduleFiles) do
local _, file, _ = path.split(filePath)
@/lua/ge/extensions/career/modules/painting.lua
local total = {money = {amount = 0, canBeNegative = false}}
for index, paintOptions in ipairs(package) do
if not tableIsEmpty(paintOptions) then
for _, vehicleData in ipairs(menuData.vehiclesInGarage) do
local computerFunctionData = {
@/lua/ge/extensions/scenario/driftGoal.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
local fobjData = map.objects[map.objectNames[instance.vehicleName]]
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'drift' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
if instance.driftScore < instance.value.minDrift then
@/lua/ge/extensions/core/cameraModes/autozoom.lua
-- compute zoom steps (discrete zooming levels, rather than a smooth continuum of fov angles)
for _,step in ipairs(self.steps) do
if distance < step[1] then break end
@/lua/ge/extensions/gameplay/playmodeMarkers.lua
local function sanitizeCluster(cluster)
for _, key in ipairs({"id","visibilityPos","visibilityRadius"}) do
if not cluster[key] then log("E","","No ".. key .. " for cluster " .. (cluster.id or dumps(cluster)))
poisByMarkerType[markerType] = {}
for _, poi in ipairs(pois) do
if poi.markerInfo[markerType] then
-- check all clusters if they have required fields
for _, cluster in ipairs(allClusters) do
sanitizeCluster(cluster)
playmodeKd = kdTree.new()
for _, cluster in ipairs(getPlaymodeClusters()) do
playmodeKd:preLoad(cluster.id, cluster.visibilityPos.x-cluster.visibilityRadius, cluster.visibilityPos.y-cluster.visibilityRadius, cluster.visibilityPos.x+cluster.visibilityRadius, cluster.visibilityPos.y+cluster.visibilityRadius)
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamSpellchecker.lua
-- walk the list entries
for rowKey, rowValue in ipairs(sectionData) do
local mods = nil
--[[
for _, row in ipairs(sectionData) do
local mods = nil
for _, filePath in ipairs(filePaths) do
local dir, fileName, _ = path.splitWithoutExt(filePath)
@/lua/ge/extensions/editor/crawlEditor/paths.lua
local allPaths = editor_crawlEditor.getAllPaths()
for i, p in ipairs(allPaths) do
if p == path then
for i, path in ipairs(allPaths) do
local isSelected = (i == selection.index)
local removeIdx = nil
for i, pathnode in ipairs(path.nodes) do
im.PushID1(i.."_pathnode")
local objs = {}
for i, pn in ipairs(self.path.nodes) do
local nextIdx = i == #self.path.nodes and 1 or i + 1
local objects = {}
for i, pathnode in ipairs(self.path.nodes) do
table.insert(objects, {
for i, pathnode in ipairs(self.path.nodes) do
local isSelected = (i == self.selectedPathnodeIndex)
@/gameplay/missionTypes/aiRace/customNodes/autoStartPositionsNode.lua
for i, vehId in ipairs(vehIds) do
for _, sp in ipairs(self.pinIn.pathData.value.startPositions.sorted) do
for i, vehId in ipairs(vehIds) do
for _, sp in ipairs(self.pinIn.pathData.value.startPositions.sorted) do
if string.find(string.lower(sp.name), 'start') then -- needs to contain the word "start"
@/lua/ge/extensions/scenario/raceMarkers/sideMarker.lua
function C:clearMarkers()
for _, id in ipairs(self._ids or {}) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/editor/dynamicDecals/brushes.lua
table.remove(brushes, index)
for _, brush in ipairs(brushes) do
brush.id = nil
else
for k, brush in ipairs(brushesData) do
if checkFilter_brush(brush.name) then
@/lua/ge/extensions/career/modules/partShopping.lua
local currentNode = tree
for _, segment in ipairs(segments) do
if currentNode.children and currentNode.children[segment] then
for i=2, tableSize(jbeamData.cargoStorage) do
for _, cargoType in ipairs(jbeamData.cargoStorage[i][3]) do
if cargoType == "dryBulk" or cargoType == "fluid" then
if treeNode.suitablePartNames then
for _, suitablePartName in ipairs(treeNode.suitablePartNames) do
local part = generatePart(suitablePartName, currentVehicleData, availableParts, treeNode.path, slotName, vehicleObj)
local function getDefaultPartName(jbeamData, slotName)
for _, slot in ipairs(jbeamData.slots2) do
if slot.name == slotName and slot.default and slot.default ~= "" then return slot.default end
previewVehicle.partConditions[initialVehicleNode.partPath] = initialVehicle.partConditions[initialVehicleNode.partPath]
for _, slot in ipairs(initialVehicleNode.children or {}) do
fillWithInitialParts(slot.path, currentVehicleData)
local function installPartByPartShopId(partShopId)
for _, part in ipairs(partsInShop) do
if part.partShopId == partShopId then
for _, vehicleData in ipairs(menuData.vehiclesInGarage) do
local inventoryId = vehicleData.inventoryId
@/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
local wps = {}
for _, pn in ipairs(pathData.pathnodes.sorted) do
table.insert(wps, {name = pn.id, pos = pn.pos, radius = pn.radius, normal = pn.hasNormal and pn.normal})
local wps = {}
for _, e in ipairs(state.nextPathnodes) do
wps[e[1].id] = e[2]
end
for _, e in ipairs(state.overNextPathnodes) do
wps[e[1].id] = 'next'
if pathData then
for i, pn in ipairs(pathData.pathnodes.sorted) do
debugDrawer:drawSphere(pn.pos, pn.radius, colorWhite)
local wps = {}
for _, e in ipairs(state.nextPathnodes) do
wps[e[1].id] = e[2]
end
for _, e in ipairs(state.overNextPathnodes) do
wps[e[1].id] = 'next'
local i = 0
for lapIndex,lapValue in ipairs(times) do
-- first, all sections
for cpIndex,cpValue in ipairs(times[lapIndex]) do
if retDetail[i] then
local oldFiles = FS:findFiles(oldRootDir, '*.json', -1, true, false)
for _, file in ipairs(oldFiles) do
if string.find(file, originalFilename) then
editMode = true
for _, info in ipairs(json) do
local radius = type(info.size) == 'table' and info.size[1] or info.size
files = arrayConcat(files, oldFiles)
for _, file in ipairs(files) do
local dir, fn, e = path.split(file)
for _, pn in ipairs(pathData.pathnodes.sorted) do
if radius == -1 then
@/lua/ge/extensions/scenario/timeLimit.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
--instance.wait = 5
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'timeLimit' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
statistics_statistics.setGoalProgress(instance.vId, instance.id, instance.vId, {status=instance.status.result, maxPoints=nil})
@/lua/ge/extensions/core/multiSpawn.lua
local randNum = random() * vehData.popTotal
for i, v in ipairs(vehData) do
if randNum < v.pop then
for _, v in ipairs(vehData) do
local countryFactor = 1
vehData = setPopulationData(vehData, params.country, params.modelPopPower)
for _, v in ipairs(vehData) do
v.configData = setPopulationData(v.configData, nil, params.configPopPower)
for _, id in ipairs(vehIds) do
local data = {}
for _, v in ipairs(getAllVehiclesByType()) do
if not (ignorePlayer and v:getID() == be:getPlayerVehicleID(0)) then
local vehIds = {}
for i, data in ipairs(spawnData) do
log('I', logTag, string.format('Vehicle group spawning in progress (%d / %d)', i, #spawnData))
for i, v in ipairs(spawnData) do
v.cling = spawnOptions.cling
options = options or {}
for i, v in ipairs(vehIds) do
local obj = getObjectByID(v)
for i, options in ipairs(groupCopy) do
if options[1] then -- old array format
for j, color in ipairs(oldColorKeys) do -- convert old colors to paints
if options[color] then
for j, pName in ipairs(paintNameKeys) do
local pKey = paintKeys[j]
if options.randomPaints then
for _, v in ipairs(group) do
local modelData = core_vehicles.getModel(v.model or '')
@/gameplay/missionTypes/aiRace/customNodes/activateRaceNode.lua
if self.pinIn.aiVehIds.value then
for _, id in ipairs(self.pinIn.aiVehIds.value) do
table.insert(vehIds, id)
@/lua/ge/extensions/editor/textEditor.lua
for index, instance in pairs(guiInstancer.instances) do
for _, objId in ipairs(objIds) do
for _, objId2 in ipairs(instance.objIds) do
for _, objId in ipairs(objIds) do
for _, objId2 in ipairs(instance.objIds) do
if objId == objId2 then
end
for _, index in ipairs(removeList) do
removeInstance(index)
@/lua/vehicle/extensions/tech/trailSim.lua
local trailerData = deserialize(dataString)
for i, d in ipairs(trailerData) do
data[4 + i] = d
@/lua/ge/extensions/freeroam/facilities.lua
if type(path) ~= "table" then path = {path} end
for _, p in ipairs(path) do
if FS:fileExists(p) then return p end
if type(f.sitesFile) == "table" then
for index, file in ipairs(f.sitesFile) do
f.sitesFile[index] = fileExistsDefault({fileDir..file, levelDir.. file}, levelDir.."facilities.sites.json")
for type, listKey in pairs(facilityTypeToListName) do
for i, f in ipairs(data[listKey] or {}) do
parseFacility(f, type, facilities[listKey], levelDir, fileDir, fn, i)
-- parse any other facility files inside the levels /facilities folder
for _,file in ipairs(FS:findFiles(levelInfo.dir.."/facilities/", '*.facilities.json', -1, false, true)) do
parseFacilitiyFile(file, facilitiesByLevel[levelName], levelInfo.misFilePath)
for _, f in ipairs(facilities[listName]) do
if f.id == id then
for _, pair in ipairs(facility.doors or {}) do
local obj = scenetree.findObject(pair[1])
for _, pair in ipairs(facility.doors or {}) do
local obj = scenetree.findObject(pair[1])
else
for _, sitesFile in ipairs(facility.sitesFile) do
table.insert(sites, gameplay_sites_sitesManager.loadSites(sitesFile))
end
for _, parkingSpotName in ipairs(facility.parkingSpotNames) do
local psFound = false
local psFound = false
for _, sitesFromFile in ipairs(sites) do
local spot = sitesFromFile.parkingSpots.byName[parkingSpotName]
else
for _, sitesFile in ipairs(facility.sitesFile) do
table.insert(sites, gameplay_sites_sitesManager.loadSites(sitesFile))
for _, zoneName in ipairs(facility.zoneNames) do
local psFound = false
local psFound = false
for _, sitesFromFile in ipairs(sites) do
local zone = sitesFromFile.zones.byName[zoneName]
invalid = true}
for _, zone in ipairs(zones) do
for i, v in ipairs(zone.vertices) do
for _, zone in ipairs(zones) do
for i, v in ipairs(zone.vertices) do
aabb.xMin = math.min(aabb.xMin, v.pos.x)
local center, count = vec3(0,0,0), 0
for _, pair in ipairs(f.doors or {}) do
local obj = scenetree.findObject(pair[1])
local maxDistSqr = 0
for _, pair in ipairs(f.doors or {}) do
local obj = scenetree.findObject(pair[1])
if career_career.isActive() then
for i, dealership in ipairs(facilities.dealerships or {}) do
M.walkingMarkerFormatFacility(dealership, elements)
end
for i, computer in ipairs(facilities.computers or {}) do
M.walkingMarkerFormatFacility(computer, elements)
end
--for i, garage in ipairs(facilities.garages or {}) do
--M.zoneMarkerFormatFacility(garage, elements, "poi_garage_2")
end
for i, dragstrip in ipairs(facilities.dragstrips or {}) do
M.walkingMarkerFormatFacility(dragstrip, elements)
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
if elem.facility then
data.props = {}
for _, prop in ipairs(elem.facility.activityAcceptProps or {}) do
table.insert(data.props,{
data.props = {}
for _, prop in ipairs(elem.facility.activityAcceptProps or {}) do
table.insert(data.props,{
data.props = {}
for _, prop in ipairs(elem.facility.activityAcceptProps or {}) do
table.insert(data.props,{
@/lua/ge/extensions/editor/roadSpline.lua
if selection then
for _, objName in ipairs(editor.selection.object) do
local obj = scenetree.findObject(objName)
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/elemental/imNumbers.lua
if im.BeginCombo("##imNumberMode" .. self.id, self.mode) then
for _, fun in ipairs(self.modes) do
if im.Selectable1(fun, fun == self.mode) then
@/lua/ge/extensions/gameplay/drag/display.lua
-- Check if at least one digit exists
for _, laneDigits in ipairs(digits.timeDigits) do
if laneDigits and #laneDigits > 0 and laneDigits[1] then
end
for _, laneTree in ipairs(dragData.strip.treeLights) do
if laneTree and laneTree.stageLights then
if not dragData then return end
for _, laneTree in ipairs(dragData.strip.treeLights) do
for _,group in pairs(laneTree) do
for _, digitTypeData in pairs(dragData.strip.displayDigits) do
for _,laneTypeData in ipairs(digitTypeData) do
for _,digit in ipairs(laneTypeData) do
for _,laneTypeData in ipairs(digitTypeData) do
for _,digit in ipairs(laneTypeData) do
if digit and simObjectExists(digit) then
if #timeDisplayValue > 0 and #timeDisplayValue < 6 then
for i,v in ipairs(timeDisplayValue) do
if timeDigits[i] and simObjectExists(timeDigits[i]) then
for i,v in ipairs(speedDisplayValue) do
if speedDigits and speedDigits[i] and simObjectExists(speedDigits[i]) then
for _, stage in ipairs(lightStages) do
if t > stage[1] and t < stage[2] then
-- First flash on
for _, laneTree in ipairs(dragData.strip.treeLights) do
for _, group in pairs(laneTree) do
for _, digitTypeData in pairs(dragData.strip.displayDigits) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
if digit and simObjectExists(digit) then
-- First flash off
for _, laneTree in ipairs(dragData.strip.treeLights) do
for _, group in pairs(laneTree) do
for _, digitTypeData in pairs(dragData.strip.displayDigits) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
if digit and simObjectExists(digit) then
-- Second flash on
for _, laneTree in ipairs(dragData.strip.treeLights) do
for _, group in pairs(laneTree) do
for _, digitTypeData in pairs(dragData.strip.displayDigits) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
if digit and simObjectExists(digit) then
-- Second flash off (final state)
for _, laneTree in ipairs(dragData.strip.treeLights) do
for _, group in pairs(laneTree) do
for _, digitTypeData in pairs(dragData.strip.displayDigits) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
for _, laneTypeData in ipairs(digitTypeData) do
for _, digit in ipairs(laneTypeData) do
if digit and simObjectExists(digit) then
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/decal.lua
if layer.children then
for k, child in ipairs(layer.children) do
if child[property] ~= nil then
local sMeshesCopy = api.getShapeMeshes()
for _, n in ipairs(layer.meshes[vehicleObj.jbeam]) do
if sMeshesCopy[n] then
if meshes then
for k, v in ipairs(layer.meshes[vehicleObj.jbeam]) do
if v == name then
im.TableHeadersRow()
for _, property in ipairs(api.properties.Decal) do
im.TableNextColumn()
tblx = {}
for _, blendMode in ipairs(api.blendModes) do
table.insert(tblx, blendMode.name)
@/lua/ge/extensions/util/stepHandler.lua
local foundLevel = false
for i, v in ipairs(core_levels.getList()) do
if v.levelName:lower() == step.level:lower() then
if not taskData.active then im.BeginDisabled() end
for i, step in ipairs(taskData.steps) do
im.TextWrapped(string.format("%s%d - %s",taskData.currentStep == i and "ACTIVE " or "", i, step.name or "Unnamed Step"))
@/lua/ge/extensions/gameplay/discover/discover_038.lua
local vehiclesByInternalName = {}
for _, vehId in ipairs(scenetree.findClassObjects("BeamNGVehicle")) do
local vehicle = scenetree.findObjectById(tonumber(vehId))
local vehiclesByInternalName = {}
for _, vehId in ipairs(scenetree.findClassObjects("BeamNGVehicle")) do
local vehicle = scenetree.findObjectById(tonumber(vehId))
@/lua/ge/extensions/gameplay/drift/general.lua
local function checkLoadedExtensions()
for _, filePath in ipairs(driftExtensions) do
local extensionName = string.match(extensions.luaPathToExtName(filePath), "extensions_([%w_]+)%.lua")
if data.challengeModes then
for _, challengeMode_ in ipairs(data.challengeModes) do
if challengeMode_ == challengeMode then
if data.contexts then
for _, context_ in ipairs(data.contexts) do
if context_ == context then
local s = ""
for _, n in ipairs(contextList) do
s = s .. tostring(n) .. "\0"
s = ""
for _, n in ipairs(challengeModeList) do
s = s .. tostring(n) .. "\0"
@/lua/ge/extensions/editor/sidewalkSpline.lua
if piece.variations then
for j, variation in ipairs(piece.variations) do
-- Enable/disable checkbox for variation.
if piece.variations then
for j, variation in ipairs(piece.variations) do
if kit.getPieceEnabled(selSpline, variation.varId) then
if piece.variations then
for j, variation in ipairs(piece.variations) do
local varId = variation.varId
@/lua/ge/extensions/ui/vehicleSelector/general.lua
filterData.type = 'set'
for _, key in ipairs(tableKeysSorted(filterByProp[propName])) do
table.insert(filterData.options, key)
local match = false
for _, propKey in ipairs(filtersWhiteList) do
local propVal = configOrModel[propKey]
for _, filter in ipairs(validFilters) do
local propVal = configOrModel[filter.propName]
@/lua/ge/extensions/gameplay/rally/vehicleTracker.lua
-- local vRot = quatFromDir(vehicle:getDirectionVector(), vehicle:getDirectionVectorUp())
-- for i, corner in ipairs(self.wheelOffsets) do
-- self.previousCorners[i]:set(self.currentCorners[i])
@/gameplay/missionTypes/evade/customNodes/autoStartPositionsNode.lua
for i, vehId in ipairs(self.pinIn.vehicleIds.value) do
for _, sp in ipairs(self.pinIn.pathData.value.startPositions.sorted) do
for i, vehId in ipairs(self.pinIn.vehicleIds.value) do
for _, sp in ipairs(self.pinIn.pathData.value.startPositions.sorted) do
local index = string.match(sp.name, '%d+')
@/lua/ge/extensions/editor/flowgraph/welcome.lua
local btnCount = 0
for k, file in ipairs(recentFiles) do
if FS:fileExists(file) then
end
for _, e in ipairs(self._examplesSorted) do
if fancyIconButton('exampleE'..e.data.name, editor.icons.folder_open, editor.icons.folder,
@/lua/ge/extensions/core/vehiclePaints.lua
local multiPaintSetupsByName = {}
for _, multiPaintSetup in ipairs(model.multiPaintSetups) do
multiPaintSetupsByName[multiPaintSetup.name] = multiPaintSetup
end
for _, multiPaintSetup in ipairs(model.multiPaintSetups) do
if multiPaintSetup.forAllConfigs then
-- then add all the remaining multiPaintSetups with 1 probability
for _, multiPaintSetup in ipairs(model.multiPaintSetups) do
if multiPaintSetup.forAllConfigs then
local sum = 0
for _, paintResult in ipairs(paintHelper.allPaintResults) do
sum = sum + paintResult.probability
for _, result in ipairs(sortedResults) do
local percentage = (result.count / amount) * 100
@/gameplay/missionTypes/dragStripAPM/constructor.lua
local starInfo, message = {}, nil
for _, key in ipairs(starKeys) do
local info = {
for _, medal in ipairs({'Bronze','Silver','Gold'}) do
unlockedStars['time'..medal] = time <= self.fgVariables['time'..medal] and position == 1
@/lua/vehicle/extensions/core/quickAccess.lua
for path, items in pairs(menuTreeCopy) do
for _, e in ipairs(items) do
if type(e) == "table" then
for _, category in ipairs(vehicleFeatureCategories) do
local res = tableMerge(category, {level = '/root/playerVehicle/'})
@/lua/ge/extensions/ui/liveryEditor/layers/decal.lua
for _, action in ipairs(ACTIONS) do
if action.value == "enabled" then
@/lua/ge/extensions/editor/dynamicDecals/settings.lua
tblx = {}
for _, textureRes in ipairs(api.textureResolutions) do
table.insert(tblx, textureRes.name)
for _, id in ipairs(api.getMaterialIndices()) do
table.insert(res, materialsMapMaterialIdxToMaterialName[id])
@/lua/ge/extensions/tech/pythonExport.lua
buf:put('(')
for _, v in ipairs(value) do
if not first then
@/lua/ge/client/lighting.lua
-- dump(files)
-- for _,filepath in ipairs(files) do
-- TorqueScriptLua.exec(filepath)
-- dump(files)
for _,filepath in ipairs(files) do
local dir, filename, ext = path.splitWithoutExt(filepath)
local lightManagersNames = split(defaultLightManagerNames, '\n')
for _, managerName in ipairs(lightManagersNames) do
succeeded = setLightManager(managerName)
-- dump(files)
-- for _,filepath in ipairs(files) do
-- TorqueScriptLua.exec(filepath)
-- log('I', 'lightManager', ' files = '..dumps(files))
for _,filepath in ipairs(files) do
local dir, filename, ext = path.splitWithoutExt(filepath)
local lightManagersNames = split(defaultLightManagerNames, '\n')
for _, managerName in ipairs(lightManagersNames) do
succeeded = setLightManager(managerName)
@/lua/ge/extensions/career/modules/linearTutorial.lua
local tutorialPopups = {"welcome", "driving", "crashRecover", "bigmap", "refueling", "missions", "postMission", "dealership", "computer", "partShopping", "finishing", "logbook", "milestones", "progress"}
for _, key in ipairs(tutorialPopups) do
saveData.flags[key] = true
-- if career is being stopped
for _, mgr in ipairs(core_flowgraphManager.getAllManagers()) do
if mgr._isCareerFlowgraph then
M.wasIntroPopupsSeen = function(pages)
for _, page in ipairs(pages or {}) do
if not getTutorialFlag(page) then
M[key] = function()
for _, v in ipairs(values) do
M.introPopup(v)
M.showAllSplashscreensAndLogbookEntries = function()
for _, key in ipairs(M.allTutorialFlags) do saveData.flags[key] = false end
if im.Selectable1("View All In Order") then
for _, file in ipairs(introPopupFiles) do
if next(file) then
if im.Selectable1("Un-view all") then
for _, file in ipairs(introPopupFiles) do
if next(file) then
im.Dummy(im.ImVec2(1,3))
for _, file in ipairs(introPopupFiles) do
if not next(file) then
@/lua/ge/extensions/editor/decalSpline/populate.lua
local cumulative = 0
for _, decal in ipairs(decals) do
cumulative = cumulative + decal.normalized
local total = 0
for _, decal in ipairs(components) do
total = total + decal.probability
local totalInv = 1.0 / total
for _, decal in ipairs(components) do
decal.normalized = decal.probability * totalInv
@/lua/ge/extensions/editor/aiTests.lua
for i, marker in ipairs(routeMarkers) do
local isWaypoint = i > 1 and i < count
local path = {}
for i, marker in ipairs(routeMarkers) do
table.insert(path, marker.pos)
local path = {}
for i, marker in ipairs(routeMarkers) do
if string.find(marker.objectName, "Waypoint") then
end
for i, point in ipairs(route.path) do
local clr = rainbowColor(#route.path, i, 1)
for i, marker in ipairs(routeMarkers) do
debugDrawer:drawTextAdvanced(marker.pos, marker.objectName, colorWhite, true, false, colorIBlack)
local _del
for _, id in ipairs(vehicleIds) do -- vehicle validator loop
local obj = getObjectByID(id)
if _del then
for _, v in ipairs(_del) do
removeVehicle(v)
if im.Selectable1("Setup All Vehicles...", true) then -- sets up all other vehicles
for _, v in ipairs(getAllVehiclesByType()) do
if not v.isParkingOnly then
for _, key in ipairs(paramKeys) do
local p = params[key]
path = {}
for _, v in ipairs(route.path) do
if v.wp then
@/lua/ge/extensions/editor/vizHelper.lua
vizHelper = FS:findFiles(artPath, "*", -1, true, false)
for k, v in ipairs(vizHelper) do
vizHelper[k] = string.sub(v, string.len(artPath) + 1)
@/lua/common/tech/techCommunication.lua
local readable, _, err = socket.select(servers, nil, 0)
for _, input in ipairs(readable) do
local client = input:accept()
@/lua/ge/extensions/gameplay/city.lua
for _, zone in ipairs(sites:getZonesForPosition(pos)) do
local prio = zone.customFields:get(prioFieldName) or 0
local fieldNameFiles = {}
for _, zone in ipairs(getHighestPrioZone(pos)) do
for _, suf in ipairs(suffixes) do
for _, zone in ipairs(getHighestPrioZone(pos)) do
for _, suf in ipairs(suffixes) do
if zone.customFields:has(fieldName..suf) then
@/lua/ge/extensions/flowgraph/nodes/types/transform.lua
if im.BeginCombo("##transformMode" .. self.id, self.mode) then
for _, m in ipairs(self.modes) do
if im.Selectable1(m, m == self.mode) then
if im.BeginCombo("##displayMode" .. self.id, self.displayMode) then
for _, m in ipairs(displayModes) do
if im.Selectable1(m, m == self.displayMode) then
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
@/lua/ge/extensions/career/modules/delivery/generator.lua
local validFacs = {}
for _, fac in ipairs(facilities) do
if fac.id ~= originId then
local iHalf = 0
for i, loc in ipairs(loc2.destinations) do
dists[i] = M.getDistanceBetweenFacilities(loc1, loc)
--local modMultiplier = 1---0.9 + 0.1 * #item.modifiers
--for _, mod in ipairs(item.modifiers) do
-- modMultiplier = modMultiplier * (mod.moneyMultipler or 1)
local files = FS:findFiles("gameplay/delivery/", '*.deliveryParcels.json', -1, false, true)
for _,file in ipairs(files) do
for k, v in pairs(jsonReadFile(file) or {}) do
item.duplicationChance = item.duplicationChance or {1}
for _, chance in ipairs(item.duplicationChance or {}) do
item.duplicationChanceSum = item.duplicationChanceSum + chance
local sum = 0
for _, item in ipairs(generator.validTemplates) do
sum = sum + item.chance
local sum = 0
for amount, chance in ipairs(template.duplicationChance) do
sum = sum + chance
-- Check if any of these are tutorial parcels
for _, cargo in ipairs(existingTutorialParcels) do
local template = M.getParcelTemplateById(cargo.templateId)
for _, cargo in ipairs(playerCargo) do
local template = M.getParcelTemplateById(cargo.templateId)
log("E","","No Template! " .. dumps(generator.logisticTypesLookup))
for _, item in ipairs(getDeliveryParcelTemplates()) do
dump(item.id, item.logisticType)
--dump(typesLookup)
for _, f in ipairs(facilities) do
if f.id ~= fac.id then
eligibleVehicles = util_configListGenerator.getEligibleVehicles(false, true)
for _,file in ipairs(files) do
for id, filter in pairs(jsonReadFile(file) or {}) do
local distance = 0
for i, loc in ipairs(offer.locations) do
if lastLoc then
-- Check if any of these are tutorial vehicles
for _, offer in ipairs(existingTutorialVehicles) do
if offer.data and offer.data.isTutorialVehicle then
for _, task in ipairs(playerVehicleTasks) do
if task.offer and task.offer.data and task.offer.data.isTutorialVehicle then
local files = FS:findFiles("gameplay/delivery/", '*.deliveryMaterials.json', -1, false, true)
for _,file in ipairs(files) do
for id, data in pairs(jsonReadFile(file) or {}) do
}
for _, otherFac in ipairs(facilities) do
if otherFac.id ~= fac.id then
}
for _, otherFac in ipairs(facilities) do
if otherFac.id ~= fac.id then
--[[
for _, cargo in ipairs(con.rawCargo) do
if cargo.type == materialType and cargo.data.sourceFacId == sourceFacId then
--dump(typesLookup)
for _, f in ipairs(facilities) do
if f.id ~= fac.id and f.logisticTypesReceivedLookup[materialType] and f.materialStorages[materialType] then
if f.id ~= fac.id and f.logisticTypesReceivedLookup[materialType] and f.materialStorages[materialType] then
for _, apName in ipairs(tableKeysSorted(f.accessPointsByName)) do
local ap = f.accessPointsByName[apName]
local materialData = M.getMaterialsTemplatesById(cargo.materialType)
for i, size in ipairs(otherPartSizes or {}) do
-- split material parcel
if hasGeneratedThisFrame then return end
for _, fac in ipairs(facilities or {}) do
for _, generator in ipairs(fac.logisticGenerators) do
for _, fac in ipairs(facilities or {}) do
for _, generator in ipairs(fac.logisticGenerators) do
if generator.nextGenerationTimestamp - dGeneral.time() <= 0 then
generator.sumChance = 0
for _, item in ipairs(getDeliveryParcelTemplates()) do
local match = false
print(generator.name)
for _, item in ipairs(generator.validTemplates) do
-- print(string.format(" - %02d%% %s",100 * item.chance / generator.sumChance, item.item.id))
-- print(string.format(" - %02d%% %s",100 * item.chance / generator.sumChance, item.item.id))
for amount, amountChance in ipairs(item.item.duplicationChance) do
print(string.format(" - %02d%% Group of %d %s (%s slots)",100 * item.chance / generator.sumChance * amountChance / item.item.duplicationChanceSum, amount, item.item.id, table.concat(item.item.slots, ", ")))
table.sort(loanerSpots, function(a,b) return (a[priorityKey] or 0) < (b[priorityKey] or 0) end)
for _, psData in ipairs(loanerSpots) do
if psData[priorityKey] then
local psFound = false
for _, sitesFromFile in ipairs(sites) do
local ps = sitesFromFile.parkingSpots.byName[psData.psName]
if not facilitiesSetup then
for _, fac in ipairs(freeroam_facilities.getFacilitiesByType("deliveryProvider")) do
--print("Loading " .. fac.id)
local missing = false
for i, generator in ipairs(fac.logisticGenerators) do
generator.name = string.format("%s %d %s %d", fac.name, i, generator.type, generator.interval)
-- validate provider/receiver lookup
for _, logisticType in ipairs(generator.logisticTypes) do
if generatorTypeToDirection[generator.type] == "providedSystemsLookup" then
else
for _, sitesFile in ipairs(fac.sitesFile) do
table.insert(sites, gameplay_sites_sitesManager.loadSites(sitesFile))
for _, filter in ipairs(fac.multiDropOffSpotFilter or {}) do
if type(filter) == "table" and filter.type == "byZone" then
local psFound = false
for _, sitesFromFile in ipairs(sites) do
local zone = sitesFromFile.zones.byName[zoneName]
local zone = sitesFromFile.zones.byName[zoneName]
for _, ps in ipairs(sitesFromFile.parkingSpots.sorted) do
if zone:containsPoint2D(ps.pos) then
-- manual access points
for _, elem in ipairs(fac.manualAccessPoints or {}) do
local psFound = false
local psFound = false
for _, sitesFromFile in ipairs(sites) do
local ps = sitesFromFile.parkingSpots.byName[elem.psName]
local allTypes = {}
for _, fac in ipairs(facilities) do
for _, type in ipairs(fac.logisticTypesProvided) do
allTypes[type] = true
end
for _, type in ipairs(fac.logisticTypesReceived) do
allTypes[type] = true
end
for _, key in ipairs(tableKeysSorted(allTypes)) do
--print(string.format("%s -> %s", key, dumps(logisticTypeToSystem(key))))
local materialRatesProvided, materialRatesReceived = {}, {}
for _, fac in ipairs(facilities) do
for _, generator in ipairs(fac.logisticGenerators) do
for _, fac in ipairs(facilities) do
for _, generator in ipairs(fac.logisticGenerators) do
if generator.type == "materialProvider" then
end
for _, key in ipairs(tableKeysSorted(materialRatesProvided)) do
print(key)
print(string.format("Total IN: %0.2f/min", materialRatesProvided[key].total*60))
for _, facId in ipairs(tableKeysSorted(materialRatesProvided[key])) do
if facId ~= "total" then
print(string.format("Total OUT: %0.2f/min", materialRatesReceived[key].total*60))
for _, facId in ipairs(tableKeysSorted(materialRatesReceived[key])) do
if facId ~= "total" then
local orgToFacs = {}
for _, fac in ipairs(facilities) do
local orgKey = fac.associatedOrganization or "0none"
end
for _, orgId in ipairs(tableKeysSorted(orgToFacs)) do
local org = freeroam_organizations.getOrganization(orgId)
print(" - " .. org.name .. " ("..orgId..")")
for _, facId in ipairs(orgToFacs[orgId]) do
print(" - " .. facilitiesById[facId].name .. " ("..facId..")")
log("I","","Loading Parcels from file... " .. #loadData.parcels)
for _, cargo in ipairs(loadData.parcels) do
cargoId = cargoId + 1
-- otherwise, generate some new cargo
for _,fac in ipairs(facilities) do
for _, generator in ipairs(fac.logisticGenerators) do
for _,fac in ipairs(facilities) do
for _, generator in ipairs(fac.logisticGenerators) do
if generator.type == "parcelProvider" or generator.type == "parcelReceiver" then
log("I","","Loading Vehicle Offers from file... " .. #loadData.vehicleOffers)
for _, offer in ipairs(loadData.vehicleOffers) do
cargoId = cargoId + 1
log("I","","Generating initial Vehicle Offers...")
for _,fac in ipairs(facilities) do
for _, generator in ipairs(fac.logisticGenerators) do
for _,fac in ipairs(facilities) do
for _, generator in ipairs(fac.logisticGenerators) do
if generator.type == "vehOfferProvider" or generator.type == "trailerOfferProvider" then
local ret = {}
for _, fac in ipairs(facilities) do
if fac.associatedOrganization == orgId then
@/lua/ge/extensions/scenario/positionGoal.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
local endobj = scenetree.findObject(instance.value.endPoint)
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id ~= 'position' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
statistics_statistics.setGoalProgress(instance.vId, instance.id, instance.vId, {status=instance.status.result, maxPoints=nil})
@/lua/ge/extensions/util/export.lua
local function _findOrCreateMaterial(gltfRoot, matId)
for k,v in ipairs(gltfRoot.materials) do
if v.extras.bngMaterialId == matId then
for parent, children in pairs(slotMap) do
for idx, child in ipairs(children) do
parentage[child] = parent
if gltfRoot.nodes[kn].children then
for _,kc in ipairs(gltfRoot.nodes[kn].children) do
if parent[kc] then
-- if gltfRoot.nodes[luaIndex].children then
-- for k,v in ipairs(gltfRoot.nodes[luaIndex].children) do
-- dumpChild(v,i+1, parentNode)
gltfCurrentMaterial[k.."Index"] = {}
for klayer, layer in ipairs(v) do
if layer and layer ~= "" then
local tmp = 0
for k,v in ipairs(binaryBuffers) do
if k-1 == index then
f:write(string.char(0x42,0x49,0x4E,0x00)) --type BIN\0
for k,v in ipairs(binaryBuffers) do
if type(v.data) == 'cdata' then
@/lua/ge/extensions/career/modules/delivery/general.lua
local groupMap = {}
for _, cargo in ipairs(saveableCargo) do
local elem = {
local saveableVehicleOffers = dVehOfferManager.getAllOfferUnexpired()
for _, offer in ipairs(saveableVehicleOffers) do
-- vehicle offers dont need to be trunkated/cut before saving
-- facility data
for _, facility in ipairs(dGenerator.getFacilities()) do
local elem = {
}
for i, generator in ipairs(facility.logisticGenerators or {}) do
elem.logisticGenerators[i] = {
for _, container in ipairs(vehCargoContainerData[1]) do
local vehName = getVehicleName(vehId)
--end
for _, cargo in ipairs(elem.rawCargo) do
elem.usedCargoSlots = elem.usedCargoSlots + cargo.slots
for _, cargo in ipairs(elem.transientCargo) do
elem.usedCargoSlots = elem.usedCargoSlots + cargo.slots
for _, list in pairs(vehCargoData) do
for _, elem in ipairs(list) do
table.insert(ret, elem)
end
for _, cargo in ipairs(dParcelManager.getAllCargoInVehicles()) do
updatePerVehicle[cargo.location.vehId][cargo.location.containerId] = updatePerVehicle[cargo.location.vehId][cargo.location.containerId] or {
local maxForContainer = 0
for _, container in ipairs(vehCargoContainerData[1]) do
maxForContainer = math.max(maxForContainer, container.reachTargetTimeRemaining)
if deliveryModeActive then
for _, container in ipairs(mostRecentCargoContainerData) do
simpleDebugText3d(container.name, container.position, 0.15, colorForAttachmentDebug[container.attachmentStatus])
local targetFacilityIds = {}
for _, cargo in ipairs(dParcelManager.getAllCargoInVehicles()) do
if cargo.destination.type == "facilityParkingspot" then
elseif cargo.destination.type == "multi" then
for _, dest in ipairs(cargo.destination.destinations) do
addInteractivePoi(interactiveParkingSpots, dest.psPath, "dropOffs", cargo)
for _, cargo in ipairs(dParcelManager.getTransientMoveCargo()) do
local locPsPath = cargo.location.psPath
local trailerTargetDestinations = dVehicleTasks.getTargetDestinationsForActiveTasks()
for _, destination in ipairs(trailerTargetDestinations) do
targetFacilityIds[destination.facId] = true
for _, fac in ipairs(freeroam_facilities.getFacilitiesByType("deliveryProvider")) do
-- only process facilities if the facility is visible
if dCargoScreen.isCargoScreenOpen() then
for _, ps in ipairs(fac.trailerSpots) do
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
if elem.type == "logisticsOffice" then
}
for _, container in ipairs(mostRecentCargoContainerData) do
for _, cargo in ipairs(container.rawCargo) do
for _, container in ipairs(mostRecentCargoContainerData) do
for _, cargo in ipairs(container.rawCargo) do
local add = 1
elseif cargo.destination.type == "multi" then
for _, dest in ipairs(cargo.destination.destinations) do
dropOffableCargoByCargoType[type] = dropOffableCargoByCargoType[type] + ((dest.psPath == elem.psPath and (container.position - psPos):squaredLength() < 25*25) and add or 0)
}
for _, container in ipairs(mostRecentCargoContainerData) do
for _, cargo in ipairs(container.transientCargo) do
for _, container in ipairs(mostRecentCargoContainerData) do
for _, cargo in ipairs(container.transientCargo) do
local add = 1
}
for _, cargo in ipairs(dParcelManager.getAllCargoForFacilityUnexpiredUndelivered(elem.facId)) do
local add = 1
local vehOffers, trailerOffers = {}, {}
for _, offer in ipairs(dVehOfferManager.getAllOfferAtFacilityUnexpired(elem.facId)) do
if offer.data.type == "vehicle" then
if not deliveryModeActive then return end
for _, tag in ipairs(tags) do
if deliveryActivity[tag] then
if next(cargoInVehicles) then
for _, cargo in ipairs(cargoInVehicles) do
dParcelManager.changeCargoLocation(cargo.id, {type="deleted"})
if next(cargoInVehicles) then
for _, cargo in ipairs(cargoInVehicles) do
if (not onlyVehIdsAsKeys) or (cargo.location.vehId and onlyVehIdsAsKeys[cargo.location.vehId]) then
if cargo.modifiers then
for _, mod in ipairs(cargo.modifiers) do
modFac = modFac + (mod.abandonMultiplier or 0)
if next(cargoInVehicle) then
for _, cargo in ipairs(cargoInVehicle) do
dParcelManager.changeCargoLocation(cargo.id, {type="deleted"})
@/lua/ge/extensions/editor/util/editorElementHelper.lua
elem.valueChangedCallback = function(e)
for _, element in ipairs(hideElementList) do
element.hidden = not e.ptr[0]
-- move hideElement list to after the elem
for _, e in ipairs(hideElementList) do
local idx = arrayFindValueIndex(self.elements, e)
local fileTags = {}
for _, e in ipairs(allowedExtensions or {}) do
local dir, fn, ext = path.split(e[2], true)
end
for _, file in ipairs(filepathsInfolder) do
local dir, fn, ext = path.split(file, true)
-- gather all default fields for all self:elements
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
ret[val.fieldName] = val.value
self.container = c
for _, element in ipairs(self.elements) do
-- Pass both missionTypeData and the full mission container for editor-only storage
local foundFile = nil
for _, file in ipairs(e.filepathsInfolder) do
if FS:fileExists(c.missionFolder .. file) then
local fieldsChecked = {}
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
if ctd[val.fieldName] == nil and val.value ~= nil then
if checkContainerFunctions[element.type] then
for _, i in ipairs(checkContainerFunctions[element.type](element, ctd, c, self.mode) or {}) do
table.insert(issues, i)
for _, field in ipairs(tableKeysSorted(ctd)) do
if not fieldsChecked[field] then
local fixed = false
for _, val in ipairs(issues) do
if val.fixable then
if im.BeginCombo('##dropdown'..e.fieldName, "") then
for _, v in ipairs(e.displayOptions.dropdownValues) do
if im.Selectable1(v, v == ctd[e.fieldName]) then
local files = {}
for _, path in ipairs(paths) do
if path ~= "" then
if self.activity and self.activity.layers and type(self.activity.layers) == "table" then
for _, layer in ipairs(self.activity.layers) do
table.insert(files, layer.dir .. path)
end
for _, path in ipairs(files) do
if FS:fileExists(path) then
local searchFiles = {}
for _, layer in ipairs(container.layers or {{dir = container.missionFolder}}) do
for _, file in ipairs(e.filepathsInfolder) do
for _, layer in ipairs(container.layers or {{dir = container.missionFolder}}) do
for _, file in ipairs(e.filepathsInfolder) do
table.insert(searchFiles, layer.dir .. file)
end
for _, file in ipairs(searchFiles) do
if FS:fileExists(file) then
if im.BeginPopup("Editor Helper File Context Menu " .. e._id) then
for _, layer in ipairs(container.layers or {{dir = container.missionFolder}}) do
if im.Selectable1("Show layer in Explorer: "..layer.dir) then
if not (editor_camPathEditor and editor_camPathEditor.currentPath) then im.BeginDisabled() end
for _, fl in ipairs(e.filepathsInfolder) do
if im.Selectable1("Save current campath from editor to " .. fl) then
if not (editor_sitesEditor and editor_sitesEditor.getCurrentSites()) then im.BeginDisabled() end
for _, fl in ipairs(e.filepathsInfolder) do
if im.Selectable1("Save current sites file from editor to " .. fl) then
if im.BeginCombo('##'..e.fieldName, ctd[e.fieldName] or "(None!)") then
for _, v in ipairs(e.values) do
if im.Selectable1(v, v == ctd[e.fieldName]) then
for _, e in ipairs(self.elements) do
if e.clickable then
for _, e in ipairs(transformsToCheck) do
function C:editingAnyTransform()
for _, e in ipairs(self.elements) do
if e.transform and e.transform:correctEditMode() then
editEnded = im.BoolPtr(false)
for index, element in ipairs(self.elements) do
local show = not (element.hidden or (element.displayOptions and element.displayOptions.hidden))
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
end
for _, field in ipairs(ret) do
field.type = ui_flowgraph_editor.getAutoTypeFromName(field.label)
local fieldNamesWithType = {}
for _, elem in ipairs(self.elements) do
for _, fnElem in ipairs((customFieldNameTypeFunctions[elem.type] or genericFieldNameTypeGetter)(elem) or {}) do
for _, elem in ipairs(self.elements) do
for _, fnElem in ipairs((customFieldNameTypeFunctions[elem.type] or genericFieldNameTypeGetter)(elem) or {}) do
table.insert(fieldNamesWithType, fnElem)
@/lua/ge/extensions/career/modules/reputation.lua
local levels = organization.reputationLevels or {}
for i, lvl in ipairs(levels) do
if not lvl.requiredValue or val >= lvl.requiredValue then
for i, levelInfo in ipairs(organization.reputationLevels) do
for attributeKey, attributeValue in pairs(levelDefaults[i-2]) do
@/lua/common/extensions/tech/techCapture.lua
local filteredFiles = {}
for i, file in ipairs(files) do
local fileType, fileMerged = getCaptureTypeFromFile(file)
files = filterFilesByHeader(files, captureType)
for _, file in ipairs(files) do
log('D', logTag, 'Deleting ' .. file .. '.')
@/lua/ge/extensions/editor/objectTool.lua
local mementos = {}
for _, id in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(id)
local parentIds = {}
for i, id in ipairs(objectIDs) do
local obj = scenetree.findObjectById(id)
local missionGroup = scenetree.MissionGroup
for i, v in ipairs(objectMementos) do
if objectIDs and objectIDs[i] then
local function pasteObjectsUndo(actionData)
for _, id in ipairs(actionData.objectIds) do
editor.deleteObject(id)
actionData.objectIds = pasteObjects(actionData.objects, actionData.objectIds, actionData.parentIds)
for i, id in ipairs(actionData.objectIds) do
scenetree.findObjectById(id):setPosition(actionData.newPositions[i])
local delta = targetPos - editor.getAxisGizmoTransform():getColumn(3)
for i, id in ipairs(editor.selection.object) do
table.insert(newPositions, scenetree.findObjectById(editor.selection.object[i]):getPosition() + delta)
editor.clearObjectSelection()
for i, id in ipairs(actionData.objects) do
scenetree.findObjectById(id):setPosition(actionData.newPositions[i])
editor.clearObjectSelection()
for i, id in ipairs(actionData.objects) do
scenetree.findObjectById(id):setPosition(actionData.oldPositions[i])
local newPositions = {} -- new position tracker for redo
for i, id in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(id)
local newTransforms = editor.getTransformsGizmoTranslate(axisGizmoEventState.objects, axisGizmoEventState.objectHeights)
for index, transform in ipairs(newTransforms) do
local obj = objects[index]
local mementos = {}
for _, id in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(id)
local newTransforms = editor.getTransformsGizmoTranslate(axisGizmoEventState.objects, axisGizmoEventState.objectHeights)
for index, transform in ipairs(newTransforms) do
local obj = axisGizmoEventState.objects[index]
local filteredIndices = {}
for index, object in ipairs(objects) do
local className = object:getClassName()
if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
for _, obj in ipairs(selectedObjects) do
obj:enableCollision()
for _, object in ipairs(objectsInRect) do
drawSelectedObjectBBox(object, color)
if editor.selection and editor.selection.object then
for _, objId in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(objId)
local classes = worldEditorCppApi.getObjectClassNames()
for _, val in ipairs(classes) do
worldEditorCppApi.setHideIconClass(val, tableContains(hiddenObjectIconClasses, val))
extendedSceneTreeObjectMenuItems = function()
for _, id in ipairs(editor.selection.object or {}) do
local xform = MatrixF(true)
@/lua/ge/extensions/gameplay/missions/missionManager.lua
local foundLevel = false
for i, v in ipairs(core_levels.getList()) do
if v.levelName:lower() == step.level:lower() then
if not removeAllVehiclesBeforeMission then step.complete = true return end
for _, name in ipairs(scenetree.findClassObjects("BeamNGVehicle")) do
local obj = scenetree.findObject(name)
userSettings = {}
for _, elem in ipairs(settings) do
userSettings[elem.key] = elem.value
table.clear(mission.setupData.stashedVehicles)
for _, name in ipairs(scenetree.findClassObjects("BeamNGVehicle")) do
local obj = scenetree.findObject(name)
veh:queueLuaCommand([[
for _, v in ipairs(powertrain.getDevicesByType("differential")) do powertrain.toggleDeviceMode(v.name) end
]])
if trafficSetup.useTraffic and trafficSetup.usePrevTraffic and gameplay_traffic.getState() == 'on' then -- use existing traffic
for _, id in ipairs(gameplay_traffic.getTrafficList()) do
taskData.data.mission.setupData.stashedVehicles[id] = nil
end
for _, id in ipairs(gameplay_parking.getParkedCarsList()) do
taskData.data.mission.setupData.stashedVehicles[id] = nil
mission._vehicleTransforms = {}
for i, p in ipairs(mission.prefabs) do
local obj = spawnPrefab(mission.id.."_prefab_" .. i , p, "0 0 0", "0 0 0 1", "1 1 1")
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)")
if not taskData.active then im.BeginDisabled() end
for i, step in ipairs(taskData.steps) do
im.TextWrapped(string.format("%s%d - %s",taskData.currentStep == i and "ACTIVE " or "", i, step.name or "Unnamed Step"))
if foregroundMissionId then
for _, mission in ipairs(gameplay_missions_missions.get()) do
if mission._isOngoing then
@/lua/ge/extensions/scenario/raceGoals.lua
for _,v in ipairs(scenario.goals.vehicles) do
if type(v.value) == "table" then
local goals = M.state.goals
for _,instance in ipairs(scenario.goals.vehicles) do
local goalName = instance.id
if not goal then
for _, file in ipairs(goalPaths) do
if FS:fileExists('lua/ge/extensions/'..file..'.lua') then
@/lua/ge/extensions/editor/visualization.lua
if def.chips and #def.chips > 0 then
for _, chip in ipairs(def.chips) do _colorChip(chip[1], chip[2]) end
im.NewLine()
if def.bullets then for _, b in ipairs(def.bullets) do _bullet(b) end end
return true
local tbl = {}
for _, type in ipairs(editor.getVisualizationTypes()) do
local active = editor.getVisualizationType(type.name)
if #filterTokens == 0 then return true end -- #NoFilter :3
for _, token in ipairs(filterTokens) do
-- lower case matching
local materialDebugVisualizationTypeNames = {}
for _,v in ipairs(materialDebugVisualizationTypes) do
table.insert(materialDebugVisualizationTypeNames, v.displayName)
local tbl = {}
for _, type in ipairs(editor.getVisualizationTypes()) do
local active = im.BoolPtr(editor.getVisualizationType(type.name))
local classes = worldEditorCppApi.getRenderableObjectClassNames()
for _, name in ipairs(classes) do
local visible = im.BoolPtr(editor.getObjectTypeVisible(name))
local classes = worldEditorCppApi.getRenderableObjectClassNames()
for _, name in ipairs(classes) do
local selectable = im.BoolPtr(editor.getObjectTypeSelectable(name))
if path == "gizmos.visualization.visTypes" then
for _, type in ipairs(editor.getVisualizationTypes()) do
if value[type.name] ~= nil then
if path == "gizmos.visualization.visible" then
for _, name in ipairs(worldEditorCppApi.getObjectClassNames()) do
if value[name] ~= nil then
if path == "gizmos.visualization.selectable" then
for _, name in ipairs(worldEditorCppApi.getObjectClassNames()) do
if value[name] ~= nil then
local classes = worldEditorCppApi.getObjectClassNames()
for _, name in ipairs(classes) do
local visible = im.BoolPtr(editor.getObjectTypeVisible(name))
}
for k, v in ipairs(materialDebugVisualizationTypes) do
if v.getter() then
-- Fill visualizationTypesDefault here as VisualizationTypes are not available in onEditorRegisterPreferences
for _, type in ipairs(editor.getVisualizationTypes()) do
if type.name == "SFXEmitter.renderEmitters" or
@/lua/ge/extensions/scenario/damageGoal.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
local fobjData = map.objects[map.objectNames[instance.vehicleName]]
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'damage' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
statistics_statistics.setGoalProgress(instance.vId, instance.id, instance.vId, {status=instance.status.result, maxPoints=nil})
@/gameplay/missionTypes/garageToGarage/constructor.lua
self.vehicleOptions = {}
for _, v in ipairs(vehs) do
local passType = true
local starInfo, message = {}, nil
for _, key in ipairs(starKeys) do
local info = {
if baseFilter.whiteList then
for _, filter in ipairs(baseFilter.whiteList) do
local converted = self:convertFilterToConfigListFormat(filter)
if baseFilter.blackList then
for _, filter in ipairs(baseFilter.blackList) do
local converted = self:convertFilterToConfigListFormat(filter)
local filteredVehicles = {}
for _, vehicleInfo in ipairs(eligibleVehicles) do
if self:doesVehiclePassFilterList(vehicleInfo, baseFilterConverted, configListGenerator) then
for _, setting in ipairs(probabilitySettings) do
local settingWhiteList = {}
if setting.whiteList then
for _, filter in ipairs(setting.whiteList) do
local converted = self:convertFilterToConfigListFormat(filter)
if setting.blackList then
for _, filter in ipairs(setting.blackList) do
local converted = self:convertFilterToConfigListFormat(filter)
if #settingWhiteList > 0 or #settingBlackList > 0 then
for _, vehicleInfo in ipairs(eligibleVehicles) do
local vehicleKey = vehicleInfo.model_key .. "/" .. vehicleInfo.key
local passesWhiteList = false
for _, whiteListFilter in ipairs(filterConverted.whiteList) do
if configListGenerator.doesVehiclePassFilter(vehicleInfo, {whiteList = whiteListFilter}) then
if passes and filterConverted.blackList and #filterConverted.blackList > 0 then
for _, blackListFilter in ipairs(filterConverted.blackList) do
if configListGenerator.doesVehiclePassFilter(vehicleInfo, {whiteList = blackListFilter}) then
local vehicleByModelKey = {}
for _, v in ipairs(vehList.vehicles) do
vehicleByModelKey[v.model.key] = v
for _, vehicleInfo in ipairs(filteredVehicles) do
local model = vehicleInfo.model_key
local manualAdditions = filterSettings.manualAdditions or {}
for _, manualConfig in ipairs(manualAdditions) do
local model = manualConfig.model
@/lua/vehicle/electricsCustomValueParser.lua
local customValueUpdateStrings = {}
for _, customValue in ipairs(customValueData) do
local sanitizedExpression = sanitizeCustomExpression(customValue.electricsFunction)
@/lua/ge/extensions/freeroam/dragRace.lua
if #timeDisplayValue > 0 and #timeDisplayValue < 6 then
for i,v in ipairs(timeDisplayValue) do
timeDigits[i]:preApply()
for i,v in ipairs(speedDisplayValue) do
speedDigits[i]:preApply()
@/lua/ge/extensions/editor/dragRaceEditor/facilities.lua
-- Update the facility in the list
for i, f in ipairs(allFacilities) do
if f.id == facility.id then
for i, facility in ipairs(allFacilities) do
local isSelected = i == selectedFacilityIndex
for i, strip in ipairs(allStrips) do
table.insert(stripNames, strip.name or strip.id)
-- Find the strip ID for the selected name
for i, strip in ipairs(allStrips) do
if (strip.name or strip.id) == selectedStripName then
@/lua/ge/extensions/ui/liveryEditor.lua
for _, dependency in ipairs(M.dependencies) do
if string.startswith(dependency, "ui_liveryEditor_") then
@/lua/ge/extensions/gameplay/missions/missions.lua
att.valuesByKey = {}
for _, val in ipairs(att.valuesSorted) do
val.translationKey = val.translationKey or val.label
missionTypes = {}
for _,missionFile in ipairs(FS:findFiles(missionTypesDir, missionTypeConstructorFilename..'.lua', 1, false, true)) do
local dir,_,_ = path.splitWithoutExt(missionFile)
local found = false
for _, fn in ipairs(previewFilenames) do
if FS:fileExists(missionData.missionFolder..fn) then
local found = false
for _, fn in ipairs(thumbFilenames) do
if FS:fileExists(missionData.missionFolder..fn) then
if not mission.sortedStarKeys or mission.sortedStarKeys == {} then
for i, key in ipairs(tableKeysSorted(mission.starLabels or {})) do
starOrder[key] = i
else
for i, key in ipairs(mission.sortedStarKeys or {}) do
starOrder[key] = i
end
for _, key in ipairs(mission.careerSetup.defaultStarKeys) do
defaultStarKeysCache[key] = true
for _, key in ipairs(sortedStars) do
if defaultStarKeysCache[key] then
mission.careerSetup._activeStarCache.defaultStarKeysToIndex = {}
for k,v in ipairs(defaultKeysSorted) do
mission.careerSetup._activeStarCache.defaultStarKeysToIndex[v] = k
for key, list in pairs(mission.careerSetup.starRewards) do
for _, reward in ipairs(list) do
if not reward.rewardAmount then
local newList = {}
for _, reward in ipairs(list) do
local elem = {rewardAmount = reward.rewardAmount, icon = "star", attributeKey = reward.attributeKey}
if cond.type == 'multiAnd' or cond.type == 'multiOr' then
for _, n in ipairs(cond.nested) do
recursiveRemoveNestedFromCondition(mId, n)
for _, list in pairs(missionData.careerSetup.starRewards) do
for _, reward in ipairs(list) do
local oldName = reward.attributeKey
local sortedKeys, keyToReward = {}, {}
for _, elem in ipairs(list) do
table.insert(sortedKeys, elem.attributeKey)
-- re-order the list
for i, key in ipairs(sortedKeys) do
list[i] = keyToReward[key]
missionData.careerSetup.defaultStarKeys = {}
for _, elem in ipairs(defaultStarKeys) do
missionData.careerSetup.defaultStarKeys[elem[1]] = elem[2]
missionData.setupData = {stashedVehicles = {}}
for _, modName in ipairs({'vehicles', 'traffic', 'environment'}) do
missionData.setupModules[modName] = missionData.setupModules[modName] or {enabled = false}
local checkedPaths = {}
for _, layer in ipairs(missionData.layers or {}) do
if layer.isMissionFolderDir then
--missionData.recommendedAttributesKeyBasedCache = {}
--for _, v in ipairs(missionData.recommendedAttributes) do
-- missionData.recommendedAttributesKeyBasedCache[v] = true
for key, list in pairs(data.careerSetup.starRewards) do
for _, reward in ipairs(list) do
if reward._originalRewardAmount then
-- load filebased missions
for _,missionInfo in ipairs(FS:findFiles(missionsDir, 'info.json', -1, false, true)) do
--dump(missionInfo)
-- load procedural missions.
for _, generator in ipairs(proceduralMissionGenerators) do
local genData = generator.generate() or {}
for _, missionData in ipairs(genData) do
sanitizeMission(missionData, "proceduralMission")
missionsById = {}
for _, missionData in ipairs(getFilesData()) do
if mission.getUserSettingsData then
for _, d in ipairs(mission:getUserSettingsData() or {}) do
mission.defaultUserSettings[d.key] = d.value
local updateCount = 0
for _,mission in ipairs(missions) do
local saveData, updated = gameplay_missions_progress.loadMissionSaveData(mission)
local ret = {}
for _, mission in ipairs(missions) do
local passed = true
else
for _, loc in ipairs(locations) do
loc.mission = mission
local count = 0
for _, file in ipairs(files) do
local gen = require(file:sub(0,-5))
local locs = gameplay_missions_missions.getLocations(m)
for i, l in ipairs(locs) do
if l.type == 'coordinates' then
local missions = gameplay_missions_missions.get() or {}
for _, m in ipairs(missions) do
if m.id == 'west_coast_usa/arrive/005-ArriveTutorial' then
local careerActive = career_career.isActive()
for _, elem in ipairs(elemData) do
if elem.type == "mission" then
end
for _, additionalAttributeKey in ipairs(additionalAttributesSortedKeys) do
if m.additionalAttributes[additionalAttributeKey] then
end
for _, elem in ipairs(m.customAdditionalAttributes or {}) do
table.insert(props, {
local cIssues = gameplay_missions_missions.getMissionEditorForType(mission.missionType):checkContainer(mission)
for _, i in ipairs(cIssues) do
table.insert(issues, i)
if success then
for _, i in ipairs(customIssues) do
table.insert(issues, i)
}
for _, i in ipairs(issues) do
if i.severity == 'warning' or i.severity == 'error' then
log(severityToLog[mission._issueList.highestSeverity] or 'I', "", string.format("Mission %s has %d issues:", mission.id, #(mission._issueList.list or {})))
for _, i in ipairs(mission._issueList.list or {}) do
log(severityToLog[i.severity] or 'I', "", i.label)
@/lua/vehicle/powertrain.lua
if deviceData.clutchChildren then
for k, child in ipairs(deviceData.clutchChildren) do
deviceData.clutchChildren[k] = child.name
for _, deformGroupData in ipairs(device.deformGroups) do
device.deformGroupDamages[deformGroupData.groupType] = 0
device.deformGroupDamages[deformGroupData.groupType] = 0
for _, deformGroup in ipairs(deformGroupData.groupNames) do
if beamstate.deformGroupDamage[deformGroup] then
local keys = tableKeysSorted(t.children)
for _, k in ipairs(keys) do
local v = t.children[k]
if files then
for _, filePath in ipairs(files) do
local _, file, _ = path.split(filePath)
for _, deviceName in ipairs(devicesSorted) do
local device = deviceLookup[deviceName]
end
for _, name in ipairs(device.breakTriggerBeam) do
beamTriggers[name] = beamTriggers[name] or {}
local deviceJbeamDataKeysSorted = tableKeysSorted(deviceJbeamData[device.name] or {})
for _, k in ipairs(deviceJbeamDataKeysSorted) do
local v = deviceJbeamData[device.name][k]
local attachedWheels = M.getChildWheels(device)
for _, wheel in ipairs(attachedWheels) do
wheelPropulsionDevices[wheel.name] = device
if device.visualPositionRelativeChildren then
for childIndex, childRelativePosition in ipairs(device.visualPositionRelativeChildren) do
if tableSize(childRelativePosition) == 3 and device.children[childIndex] and device.children[childIndex].visualPosition then
for _, device in pairs(powertrainDevices) do
for _, groupData in ipairs(device.deformGroups) do
device.deformGroupDamages[groupData.groupType] = 0
for _, beamName in ipairs(device.breakTriggerBeam) do
obj:breakBeam(breakTriggerBeamLookup[beamName])
--dump(deviceNames)
for _, name in ipairs(deviceNames) do
local device = powertrainDevices[name]
local result = {}
for _, device in ipairs(parentDevice.children) do
if device.inputIndex == outputID or outputID < 0 then
local childWheels = getChildWheels(device, -1)
for _, childWheel in ipairs(childWheels) do
table.insert(result, childWheel)
local hydraulicPowerSources = getDevicesByCategory("hydraulicPowerSource")
for _, powerSource in ipairs(hydraulicPowerSources) do
if powerSource.connectedConsumers then
if powerSource.connectedConsumers then
for _, hydraulicConsumer in ipairs(powerSource.connectedConsumers) do
if hydraulicConsumer.name == consumerName then
for _, partType in ipairs(partTypeData or {}) do
local split = split(partType, ":")
local relevantDevices = getPartRelevantDevices(partTypeData)
for _, relevantDevice in ipairs(relevantDevices) do
--print("--> " .. dumps(relevantDevice))
local relevantDevices = getPartRelevantDevices(partTypeData)
for _, deviceData in ipairs(relevantDevices) do
local device = M.getDevice(deviceData.device)
@/gameplay/missionTypes/drift/customNodes/updateTaskListObjectivesNode.lua
for _, key in ipairs({'bronze','silver','gold', 'platinium'}) do
if self.activeStars[key] and self.activeStars[key].enabled then
@/lua/ge/extensions/ui/uiMods.lua
for _, filepath in ipairs(files) do
local segments = split(filepath, "/")
@/lua/ge/extensions/career/modules/milestones/generalMilestones/money.lua
local moneyValues = {}
for _, k in ipairs({1000, 10000, 100000}) do
for _, i in ipairs({1,2,5}) do
for _, k in ipairs({1000, 10000, 100000}) do
for _, i in ipairs({1,2,5}) do
table.insert(moneyValues, i*k)
for _, modeConfig in ipairs(modeConfigs) do
local mode = modeConfig.mode
local sum = 0
for _, tag in ipairs(tags) do
sum = sum + math.abs(career_modules_playerAttributes.getAttribute("money")[modeConfig.mode][tag] or 0)
M.onGeneralMilestonesSetupCallbacks = function()
for _, milestoneConfig in ipairs(moneyMilestones) do
M.setNotificationTarget(milestoneConfig)
if change.money then
for _, milestoneConfig in ipairs(moneyMilestones) do
local step = milestones.saveData.general[milestoneConfig.id].notificationStep +1
@/lua/ge/extensions/util/jbeamStats.lua
local partCount = 0
for _, filename in ipairs(jbeamFiles) do
local content = readFile(filename)
@/lua/ge/extensions/gameplay/markers/gasStationMarker.lua
iconRendererObj = scenetree.findObjectById(self.iconRendererId)
for idx, pair in ipairs(cluster.pumps or {}) do
local area = scenetree.findObject(pair[1])
local anyOverlap = false
for idx, area in ipairs(self.pumps or {}) do
--simpleDebugText3d(idx, area.iconPos, 0.25)
if iconRendererObj then
for idx, area in ipairs(self.pumps or {}) do
playModeColorI.alpha = 0
if iconRendererObj then
for idx, area in ipairs(self.pumps or {}) do
iconRendererObj:removeIconById(area.iconId)
if interactData.canInteract and self.anyOverlap then
for _, elem in ipairs(self.cluster.elemData) do
table.insert(interactableElements, elem)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
function C:drawOnMinimap(td)
for _, pump in ipairs(self.pumps or {}) do
ui_apps_minimap_utils.simpleCircle(pump.iconPos)
local function cluster(pois, allClusters)
for _, poi in ipairs(pois) do
local cluster = {
@/lua/ge/extensions/util/nodeStream.lua
for _, evt in ipairs(events) do
if evt.type == "D" and evt.msg ~= "" then
@/lua/ge/extensions/gameplay/rally/snaproad.lua
for _,point in ipairs(points) do
local pos = point.pos
for _,point in ipairs(points) do
local pos = point.pos
for i,partition in ipairs(points) do
self:_drawDebugPoints(partition, clr, nil, nil, nil, self.globalOpacity)
for i,partition in ipairs(points) do
self:_drawDebugPoints(partition, clr, nil, nil, nil, self.globalOpacity)
for _,point in ipairs(points) do
local pos = point.pos
-- local style_data = nil
-- for _,style in ipairs(corner_angles_data.pacenoteStyles) do
-- if style.name == cornerAnglesStyle then
local sortedAngles = {}
for i,angle in ipairs(self.styleData.angles) do
table.insert(sortedAngles, angle)
local gradientColors = createGradient(steps)
for i,angle in ipairs(sortedAngles) do
angle.color = gradientColors[i]
for _,point in ipairs(points) do
local subgroup_points = subgroups[#subgroups].points
for _,grp in ipairs(subgroups) do
local label_i = round(#grp.points / 2)
for _,grp in ipairs(groups) do
for _,cap in ipairs(grp.points) do
for _,grp in ipairs(groups) do
for _,cap in ipairs(grp.points) do
clr = cap.calc.angle_data.color
for _,point in ipairs(points) do
local pos = vec3(point.pos)
for _,limitPoint in ipairs(limitPoints) do
if prevPoint.id == limitPoint.id then
for _,lim in ipairs(limitPoints) do
if nextPoint.id == lim.id then
for _,lim in ipairs(limitPoints) do
if prevPoint.id == lim.id then
for _,lim in ipairs(limitPoints) do
if nextPoint.id == lim.id then
-- local point_cs = self:closestSnapPoint(wp_cs.pos)
-- for i,point in ipairs(self.partition.focus_points) do
-- if point_cs and point.id < point_cs.id then
function C:_clearPointCachedPartitions()
for _,point in ipairs(self:_allPoints()) do
point.partition = nil
for _,pn_curr in ipairs(notebook.pacenotes.sorted) do
local wp_cs = pn_curr:getCornerStartWaypoint()
-- print('partitions:')
-- for i,p in ipairs(partitions) do
-- local s = ''
-- local s = ''
-- for i,pt in ipairs(p) do
-- s = s..', '..tostring(pt.id)
for i,partition in ipairs(partitions) do
for i,point in ipairs(partition) do
for i,partition in ipairs(partitions) do
for i,point in ipairs(partition) do
table.insert(self.filter.points, point)
for i,point in ipairs(partition) do
table.insert(self.filter.points, point)
for _,point in ipairs(unfilteredPoints) do
if not hitBackPos then
@/lua/ge/extensions/gameplay/drag/debug.lua
im.Text("Phases: ")
for index, value in ipairs(dragData.phases or {}) do
im.SameLine()
im.Text("Vehicle Settings")
for k,v in ipairs(aviableLanes) do
if v then
for _, phase in ipairs(vehicleData.phases) do
im.Text(phase.name .. " - ")
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veCrashTester.lua
local vehsList = {}
for _, vehItem in ipairs(core_vehicles.getVehicleList().vehicles) do
if vehItem.model.Type == 'Car' or vehItem.model.Type == 'Truck' then
for _, vehData in ipairs(vehsData) do
vehData.veh:delete()
@/lua/ge/extensions/util/inputSystemUtils.lua
local usedActions = {}
for _, path in ipairs(FS:findFiles('/', '*.json', -1, false, false)) do
if path:find('inputmaps/') then
bindingCount = bindingCount + #m.bindings
for _, b in ipairs(m.bindings) do
if b.action then
local function resave()
for _, filepath in ipairs(FS:findFiles('/', '*.json', -1, false, false)) do
if filepath:find('inputmaps/') then
@/lua/ge/extensions/flowgraph/utils.lua
else
for i, value in ipairs(newValue) do
variable.mergeVal[i] = variable.mergeVal[i] + value
variable.value = {}
for i, value in ipairs(variable.mergeVal) do
variable.value[i] = variable.count > 0 and (variable.mergeVal[i] / variable.count) or 0
else
for i, value in ipairs(newValue) do
variable.mergeVal[i] = variable.mergeVal[i] + value
@/lua/ge/extensions/ui/fadeScreen.lua
if delayCounter <= 0 then
for _, state in ipairs(delayedData) do
extensions.hook("onScreenFadeState", state)
@/lua/ge/extensions/util/sortLines.lua
local handle = io.open(path, 'w')
for i, line in ipairs(lines) do
if string.len(line[2]) > 0 then
local targets = FS:findFiles(path, '*.json', 1, true, true)
for i, target in ipairs(targets) do
M.handleFile(target)
@/lua/ge/extensions/flowgraph/graph.lua
self.variables.variableChanges = {}
for _, child in ipairs(self:getChildren()) do
child:clearVariableChangesChildren()
for _, child in ipairs(self:getChildren()) do
if child.type == "instance" and child.macroID then
self.dirty = dirty
for _, child in ipairs(self:getChildren()) do
if child.type == self.type then
-- add custom links for integrated nodes
for _, iNode in ipairs(integratedNodes) do
interInfo[iNode] = { inLinks = {}, outLinks = {} }
--if self.children then
for _, child in ipairs(self:getChildren()) do
child:gatherNodesAndLinks(rNodes, rLinks, interInfo)
for pinName, lnkList in pairs(list.inLinks) do
for _, link in ipairs(lnkList) do
if link.sourceNode.nodeType ~= 'macro/integrated' and link.sourceNode.nodeType ~= 'macro/io' then
for pinName, lnkList in pairs(list) do
for _, link in ipairs(lnkList) do
if link.sourceNode.nodeType ~= 'macro/integrated' and link.sourceNode.nodeType ~= 'macro/io' then
-- create links for every integrated or regular node reached.
for _, sLink in ipairs(sourceLinks) do
local targets = {}
local successors = {}
for _, oPair in ipairs(open) do
local current = oPair[1]
if interInfo[current.targetNode.inputNode] then
for _, lnk in ipairs(interInfo[current.targetNode.inputNode][current.targetPin.name] or {}) do
table.insert(successors, { lnk, current.targetPin.name })
if interInfo[current.targetNode.integratedNode] then
for _, lnk in ipairs(interInfo[current.targetNode.integratedNode].outLinks[current.targetPin.name] or {}) do
table.insert(successors, { lnk, current.targetPin.name })
for _, tgt in ipairs(targets) do
table.insert(rLinks, {
for _, node in ipairs(allNodes) do
table.clear(node._mInFlow)
for _, mPin in pairs(node._mInFlow) do
for _, pin in ipairs(mPin) do
local parentNode = pin.node
colNotPropagated = true
for _, node in ipairs(uncolored) do
local sourceColor = node._flowColors
for _, mPin in pairs(n._mInFlow) do
for _, pin in ipairs(mPin) do
if rootWorkDict[color][pin.node] == 1 then
end
for _, mod in ipairs(self.mgr.moduleOrder) do
if self.mgr.modules[mod].preTrigger then
for _, mod in ipairs(self.mgr.moduleOrder) do
if self.mgr.modules[mod].afterTrigger then
local children = {}
for _, child in ipairs(self:getChildren()) do
table.insert(children, child)
end
for _, child in ipairs(children) do
self.mgr:deleteGraph(child)
if link.targetPin.type == 'flow' and mPin then
for i, pin in ipairs(mPin) do
if pin == link.sourcePin then
minId = math.min(nid, minId)
for _, p in ipairs(node.pinList) do
pinOrder[p] = pinC
local links = {}
for _, keyLink in ipairs(orderedLinks) do
table.insert(links, keyLink[2])
-- children
for _, child in ipairs(self:getChildren()) do
local csaveID = child.id
for _, nid in ipairs(nodeKeys) do
local nodeData = data.nodes[nid]
end
for lid, linkData in ipairs(data.links) do
local sourceNode = self.nodes[linkData[1] + self.mgr:getGraphNodeOffset()]
self.type = t
for _, child in ipairs(self:getChildren()) do
child:updateChildrenTypes(t, ignoreType)
local current = self
for _, i in ipairs(indexes) do
current = current.children[i]
table.insert(hooks, node)
for _, dep in ipairs(node.dependencies or {}) do
deps[dep] = true
print(s)
for _, c in ipairs(self:getChildren()) do
c:_printStructure(depth + 1)
if withIds then
for i, gr in ipairs(graphs) do
graphs[i] = gr .. "(" .. ids[i] .. ")"
@/lua/ge/extensions/editor/util/plotHelperUtil.lua
local multiData = {}
for _, d in ipairs(data) do
local row = {}
local format = self.seriesFormat or {}
for i, name in ipairs(names) do
format[i] = format[i] or {}
local format = self.seriesFormat or {}
for i, color in ipairs(colors) do
format[i] = format[i] or {}
for _, row in ipairs(self.data) do
for _, d in ipairs(row) do
for _, row in ipairs(self.data) do
for _, d in ipairs(row) do
local ptX = d[1]
local min, max = self:normToImSS(0,0), self:normToImSS(1,1)
for _, pair in ipairs(self.annotationX) do
local x, label = pair[1],pair[2]
local pos = self:normToImWS(0,1)
for i, line in ipairs(lines) do
im.SetCursorPos(im.ImVec2(pos.x + borderSize/3, pos.y +borderSize - im.GetTextLineHeight()/4 + im.GetTextLineHeight()*i ))
for r, row in ipairs(self.data) do
local cRow = {}
local rowCount = #self.catmullDataPoints
for r, row in ipairs(self.catmullDataPoints) do
local rowLength = #row
local count = tableSize(self.data)
for r, row in ipairs(self.data) do
local circleColor = nil
end
for i, d in ipairs(row) do
@/lua/ge/extensions/career/modules/delivery/progress.lua
for _, cargo in ipairs(cargoItems or {}) do
if cargo.materialType == nil then
local affectedFacilities = {}
for _, o in ipairs(offers or {}) do
local offer = o.offer
for lvl = unlockStatus.skillLevels[skill], career_branches.getBranchLevel(skill) do
for _, unlock in ipairs(skillUnlockDescriptions[skill][lvl] or {}) do
table.insert(results, unlock.unlocks)
local playerVehIds = {}
for _, con in ipairs(playerCargoContainers) do
playerVehIds[con.vehId] = true
playerVehIds[con.vehId] = true
for _, cargo in ipairs(con.rawCargo) do
local validCargo = false
elseif cargo.destination.type == "multi" then
for _, dest in ipairs(cargo.destination.destinations) do
validCargo = validCargo or dParcelManager.sameLocation(dest, dropOffDataStatus.location)
--table.sort(vehicleInfo.containers, function(a,b) return a.name < b.name end)
for _, id in ipairs(tableKeysSorted(vehicleInfo.containersById)) do
vehicleInfo.containersById[id].cargo = dParcelManager.addParcelRewardsSummary(deepcopy(vehicleInfo.containersById[id].cargo))
table.insert(automaticDropOffItems, cargo)
for _, id in ipairs(cargo.ids) do
table.insert(confirmedCargoIds, {id=id})
for _, vehData in ipairs(dropOffDataStatus.vehicleData or {}) do
table.insert(automaticDropOffItems, vehData)
local fac = dGenerator.getFacilityById(dropOffDataStatus.location.facId)
for _, item in ipairs(manualDropOffItems) do
unloadingMaterialInfoByKey[item.materialType] = unloadingMaterialInfoByKey[item.materialType] or {storage = fac.materialStorages[item.materialType], amountToUnload = 0, items = {}}
--dump(confirmedDropOffs)
for _, elem in ipairs(confirmedDropOffData.parcelIdElems) do
local cargo = dParcelManager.getCargoById(elem.id)
local cargoByGroupId = {}
for _, c in ipairs(confirmedDropOffData.cargo) do
local gId = string.format("%d-%d", c.groupId, c.loadedAtTimeStamp or -1)
for _, formattedOffer in ipairs(confirmedDropOffData.offers) do
table.insert(itemNames, string.format("%s %s",formattedOffer.offer.name, formattedOffer.offer.vehicle.name))
local rewardSum = {}
for _, reward in ipairs(rewards) do
for key, amount in pairs(reward) do
local aggregateChange = {}
for key, _ in ipairs(branchInfo) do
local branch = career_branches.getBranchById(key)
for i, levelInfo in ipairs(branchInfo[key].branchLevels) do
levelInfo.levelLabel = "Level " .. i
if next(showSystemPopup) then
for _, key in ipairs(showSystemPopup) do
career_modules_linearTutorial.introPopup(key.."Unlocked")
local count = 0
for _, facility in ipairs(dGenerator.getFacilities()) do
local c = 0
@/lua/ge/extensions/editor/rallyEditor.lua
local function updateWindowNotebooks()
for _, window in ipairs(windows) do
window:setPath(currentPath)
-- if im.BeginCombo('Rally Editor Preferred Snaproad Type##preferredSnaproadType', editor.getPreference("rallyEditor.editing.preferredSnaproadType")) then
-- for _, snaproadType in ipairs(RallyEnums.drivelineModeNames) do
-- if im.Selectable1(snaproadType, snaproadType == editor.getPreference("rallyEditor.editing.preferredSnaproadType")) then
if im.BeginTabBar("modes") then
for _, window in ipairs(windows) do
editor.clearObjectSelection()
for _, win in ipairs(windows) do
if win.onEditModeActivate then
local function onDeactivate()
for _, win in ipairs(windows) do
if win.onEditModeDeactivate then
@/lua/ge/extensions/flowgraph/nodes/career/careerVehicleSelect.lua
}
for _, i in ipairs({1,2,3}) do
local veh = {}
local veh = {}
for _, key in ipairs({"image","brand","name","desc"}) do
veh[key] = self.pinIn["veh"..i..key].value
@/lua/ge/extensions/editor/shapeEditor.lua
local matHover = nil
for k,v in ipairs(mname) do
if editor_materialEditor then
@/lua/common/libs/luamqtt/mqtt/protocol5.lua
-- fill the properties and property_make tables
for _, prop in ipairs(property_pairs) do
properties[prop[2]] = prop[1] -- name ==> identifier
tbl_sort(order, function(a, b) return a[1] < b[1] end)
for _, item in ipairs(order) do
local prop_id, name, value = unpack(item)
tbl_sort(order, function(a, b) if a[1] == b[1] then return a[3] < b[3] else return a[1] < b[1] end end)
for _, pair in ipairs(order) do
local name = pair[1]
local payload = combine()
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "table", "expecting .subscriptions["..i.."] to be a table")
local payload = combine()
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "string", "expecting .subscriptions["..i.."] to be a string")
local found = false
for _, pair in ipairs(uprops) do
if pair[1] == name and pair[2] == old_val then
@/lua/ge/extensions/freeroam/levelStats.lua
table.sort(result, function(a, b) if a.count == b.count then return a.lastUsed > b.lastUsed end return a.count > b.count end)
for i, data in ipairs(result) do
if lastUsed == data.levelName then
table.sort(result, function(a, b) if a.count == b.count then return a.lastUsed > b.lastUsed end return a.count > b.count end)
for i, data in ipairs(result) do
if lastUsed == data.spawnPointName then
local topSpawnPoints = {}
for _, level in ipairs(topLevels) do
local spawnPoints = M.getTopSpawnPoints(level.levelName)
local spawnPoints = M.getTopSpawnPoints(level.levelName)
for _, spawnPoint in ipairs(spawnPoints) do
table.insert(topSpawnPoints, spawnPoint)
@/lua/vehicle/controller/hydraulics/electricHydraulics.lua
local motorThrottle = 0
for _, electric in ipairs(electricsNames) do
if type(electrics.values[electric]) == "number" and abs(electrics.values[electric]) > 0 then
@/lua/common/libs/luasec/ssl.lua
local str = ""
for k, v in ipairs(array) do
if type(v) ~= "string" then return nil end
end
for _, certificate in ipairs(certificates) do
-- Load the key
@/lua/ge/extensions/editor/rendererComponents.lua
table.sort(sortedHDRsettings, sortFunc)
for _, pfxName in ipairs(sortedHDRsettings) do
if im.TreeNode1(pfxName) then
im.Columns(2)
for _, field in ipairs(data.fields) do
if field.name then im.TextUnformatted(field.name) end
table.sort(sortedHDRsettings, sortFunc)
for _, pfxName in ipairs(sortedHDRsettings) do
if im.TreeNode1(pfxName) then
im.Columns(2)
for _, field in ipairs(data.fields) do
if field.name then im.TextUnformatted(field.name) end
@/lua/common/libs/luasocket/socket/url.lua
local s = {}
for i,v in base.ipairs(t) do
s[t[i]] = 1
@/lua/common/jbeam/slotSystem.lua
keys added will be also be stored in a metatable to recall the insertion order
metakeys can be seen with for i,k in ( :ipairs() or ipairs( ._korder ) ) do
ipairs( ) is a bit faster
keys added will be also be stored in a metatable to recall the insertion order
metakeys can be seen with for i,k in ( :ipairs() or ipairs( ._korder ) ) do
ipairs( ) is a bit faster
metakeys can be seen with for i,k in ( :ipairs() or ipairs( ._korder ) ) do
ipairs( ) is a bit faster
-- traversal of table ordered: returning index, key
ipairs = function(self) return ipairs(self._korder) end,
-- traversal of table
self[key] = nil
for i, k in ipairs(self._korder) do
if k == key then
local allowListed = false
for _, slottype in ipairs(part.slotType) do
if tableContains(slot.allowTypes, slottype) then
local denyListed = false
for _, slottype in ipairs(part.slotType) do
if tableContains(slot.denyTypes, slottype) then
local slots = currentPart.slots2 or currentPart.slots
for _, slotDef in ipairs(slots) do
local slotOptions = deepcopy(_slotOptions) or {}
profilerPushEvent('jbeam/slotsystem.unifyParts')
for i, j in ipairs(unifyJournal) do
unifyParts(unpack(j))
@/lua/ge/extensions/scenario/busdriver.lua
nextStop = nil
for _,m in ipairs(markers) do
m:setField('instanceColor', 0, '1 1 1 0')
local lastDamage = initialDamage
for k,v in ipairs(stats) do
local damage = 0
--print("Building Bus route:")
--for _, task in ipairs(currentLine.tasklist) do
local task = currentLine.tasklist[1]
if currentLine.navhelp then
for _, help in ipairs(currentLine.navhelp[task[1]] or {}) do
table.insert(wps, help)
monitorMarker = false
for _,m in ipairs(markers) do
m:setField('instanceColor', 0, '0 1 0 1')
for k,v in pairs(currentLine.navhelp) do --reset passedWp because of navhelp
for i2,v2 in ipairs(v) do
if passedWp[v2] then
local wps = {}
for i, stop in ipairs(currentLine.tasklist) do
local vec3Destination = vec3(stop[3])
if currentLine.navhelp and currentLine.navhelp[stop[1]] then
for i, wp in ipairs(currentLine.navhelp[stop[1]]) do
table.insert(wps, wp)
if currentAlphaMarker < 0 then currentAlphaMarker = 0 elseif currentAlphaMarker > 1 then currentAlphaMarker=1 end
for _,m in ipairs(markers) do
m:setField('instanceColor', 0, (setpointAlphaMarker ==0 and '0 1 0 ' or '1 0 0 ')..tostring(currentAlphaMarker))
if currentLine.navhelp and currentLine.navhelp[nextStop[1] ] then
for i, wp in ipairs(currentLine.navhelp[nextStop[1] ]) do
if passedWp[wp] or distanceToWp(wp) < 15 then
-- end
for _,m in ipairs(markers) do
m:setField('instanceColor', 0, '0 1 0 1')
if currentLine.navhelp then
for _, help in ipairs(currentLine.navhelp[task[1]] or {}) do
table.insert(wps, help)
@/lua/ge/extensions/freeroam/specialTriggers.lua
if obj:getClassName() == 'SimGroup' then -- if object is a SimGroup, process all objects within it
for _, o in ipairs(obj:getObjects()) do
setState(tonumber(o) or scenetree.findObject(o):getID(), state)
v.isNested = true -- if nested SimGroup structure exists, process the children of the SimGroups, in parallel
for _, o in ipairs(obj:getObjects()) do
local obj = scenetree.findObjectById(tonumber(o) or scenetree.findObject(o):getID())
v.maxIdx = 0
for _, o in ipairs(obj:getObjects()) do
local obj = scenetree.findObjectById(tonumber(o) or scenetree.findObject(o):getID())
if data.triggers then -- creates aliases if there are multiple triggers assigned
for _, tName in ipairs(data.triggers) do
triggers[tName] = {alias = key, active = false}
if triggers[key].triggers then
for _, tName in ipairs(triggers[key].triggers) do
triggers[tName] = nil
for _, v in ipairs(trigger.triggers) do
if triggers[v] and triggers[v].active then -- state change is not valid if other grouped triggers are active
local data = {}
for _, veh in ipairs(getAllVehiclesByType()) do
local vehId = veh:getID()
if data.isNested then -- processes all nested objects, in parallel
for _, o1 in ipairs(innerObjects) do
local obj1 = scenetree.findObjectById(tonumber(o1) or scenetree.findObject(o1):getID())
local function onSerialize()
for k, _ in ipairs(triggers) do
setTriggerObjects(k)
@/lua/ge/extensions/ui/liveryEditor/layers/cursor.lua
else
for _, value in ipairs(params) do
if value == "position" or value == "transform" then
@/lua/ge/extensions/gameplay/missions/poiTest.lua
local function onGetRawPoiListForLevel(levelIdentifier, elements)
for _, ps in ipairs(gameplay_sites_sitesManager.loadSites("gameplay/parkingSpotTests.sites.json").parkingSpots.sorted) do
local id = string.format("Test-PS-%d", ps.id)
local poiName = false
for _, elem in ipairs(elemData) do
if elem.type == "poiTest" then
@/lua/ge/extensions/gameplay/garageMode.lua
local levelInfo = {}
for _, level in ipairs(core_levels.getList()) do
if string.lower(level.levelName) == string.lower(getCurrentLevelIdentifier()) then
@/lua/ge/extensions/editor/dynamicDecals/colorHistory.lua
-- Check whether there's a color in the history that matches this color and remove it
for k, c in ipairs(history) do
if c[1] == color.x and c[2] == color.y and c[3] == color.z and c[4] == color.w then
local uiIconSize = math.ceil(im.GetFontSize()) + 2 * im.GetStyle().FramePadding.y
for k, color in ipairs(data) do
im.ColorEdit4(string.format("##colorHistoryColorWidget_%s_%d", guiId, k), editor.getTempFloatArray4_TableTable(color), im.flags(im.ColorEditFlags_NoInputs, im.ColorEditFlags_AlphaPreview))
@/lua/ge/extensions/career/modules/speedTraps.lua
local function getFineFromSpeed(overSpeed)
for _, fineInfo in ipairs(fines) do
if overSpeed <= fineInfo.overSpeed then
@/lua/vehicle/material.lua
local varChanged = false
for _, f in ipairs(triggerList) do
local v = eVals[f]
table.clear(changedMats)
for _, va in ipairs(triggers) do
if brokenSwitches[va.msc] == nil then
@/lua/ge/extensions/editor/vehicleBridgeTest.lua
if im.BeginCombo("Select Vehicle...", vehId.."") then
for i, vname in ipairs(scenetree.findClassObjects('BeamNGVehicle')) do
if im.Selectable1(vname.."##"..i) then
@/lua/ge/extensions/editor/flowgraph/main.lua
else
for idx, file in ipairs(recentFiles) do
if FS:fileExists(file) then
end
for _, link in ipairs(hiddenLinks) do
link:draw()
local s = ""
for _, gr in ipairs(allGraphs) do s = s..gr.name.." " end
local focusGraphNow = self.mgr.focusGraph
drawnThisFrame = false
for _,gr in ipairs(allGraphs) do
--print(gr:getLocation())
local _, lNames, lIds = gr:getLocation()
for i, n in ipairs(lNames) do
local txt = n
if im.BeginPopup("FG_SiblingGraphs") then
for _, sib in ipairs(self._siblings or {}) do
if sib.isStateGraph then
end
for _, gr in ipairs(self.mgr.graphs) do
if ids[gr.id] then table.insert(duplicateIds,gr.id) end
print("-------------")
for _, duplicateId in ipairs(duplicateIds) do
for node in self.mgr:allNodes() do
end
for _, gr in ipairs(self.mgr.graphs) do
if gr.id == duplicateId then
if im.BeginCombo("##drawmode", drawmodeNames[drawmode]) then
for _, m in ipairs(drawmodesSorted) do
if im.Selectable1(drawmodeNames[m], m == drawmode) then
if editor.getPreference("flowgraph.debug.editorDebug") then
for _, map in ipairs({"FlowgraphMain","Flowgraph","NodeLibrary"}) do
im.Text("["..(self.fgEditor.isActionMapEnabled(map) and "Yes" or "No").."]".. map.." ")
table.sort(boxes)
for _, b in ipairs(boxes) do
table.sort(nIds[b])
end
for _, name in ipairs(self.quickConnectSortedNames) do
local cursor = im.GetCursorPos()
@/lua/ge/extensions/scenario/waypoints.lua
-- put all successors of the current wp in the list and show them
for i, s in ipairs(w.waypointConfig[w.cur].successors) do
local ret = {}
for i,p in ipairs(w.waypointConfig) do
ret[i] = p.cpName
local newLapConfig = {}
for _,wpName in ipairs(scenario.lapConfig) do
if not tableContains(data, wpName) then
elseif type(cur) == 'table' then
for i,b in ipairs(cur) do
local ends = getLastElementsFromBranch(b)
local ends = getLastElementsFromBranch(b)
for _,e in ipairs(ends) do
table.insert(ret, e)
to = {}
for i, branchName in ipairs(cur) do
to[i] = {
from = {}
for i, branchName in ipairs(cur) do
-- first elements of a branch must always be a singular waypoint
-- first elements of a branch must always be a singular waypoint
for _, f in ipairs(getLastElementsFromBranch(branchName)) do
table.insert(from, {branch = f.branch, index = f.index, cpName = f.cpName})
elseif type(cur) == 'table' then
for i, branchName in ipairs(cur) do
-- first elements of a branch must always be a singular waypoint
-- first elements of a branch must always be a singular waypoint
for _, f in ipairs(getLastElementsFromBranch(branchName)) do
table.insert(from, {branch = f.branch, index = f.index, cpName = f.cpName})
createFromToGraph(from, {{index = 1, branch = M.state.lapConfigName, cpName = scenario.BranchLapConfig[1]}})
for _, f in ipairs(from) do
M.state.branchGraph[f.branch][f.index].isFinalWaypoint = true
M.state.branchGraph[f.branch][f.index].isFinalWaypoint = true
for _, s in ipairs(M.state.branchGraph[f.branch][f.index].successors) do
s.insertBranch = false
M.state.waypointBranches[bName] = {}
for i, v in ipairs(branch) do
if type(v) == 'string' then
M.state.waypointBranches[bName] = {}
for i, v in ipairs(branch) do
if type(v) == 'string' then
local vRot = quatFromDir(vehicle:getDirectionVector(), vehicle:getDirectionVectorUp())
for i, corner in ipairs(vehWpData.wheelOffsets) do
vehWpData.previousCorners[i]:set(vehWpData.currentCorners[i])
@/lua/vehicle/electrics.lua
allowedIgnitionLevelsLookup = {}
for _, level in ipairs(newAllowedIgnitionLevels) do
allowedIgnitionLevelsLookup[level] = true
local customValueNames = {}
for _, value in ipairs(jbeamCustomValues) do
if not customValueNames[value.electricsName] then
for _, value in ipairs(defaultCustomValues) do
if not customValueNames[value.electricsName] then
@/lua/ge/extensions/editor/dynamicDecals/browser.lua
if im.BeginTabBar("BrowserTabBar") then
for k, tab in ipairs(tabs) do
textureBrowserCurrentTab = k
@/lua/ge/extensions/ui/gameplayAppContainers.lua
im.Text("App Controls:")
for _, appId in ipairs(tableKeysSorted(container.apps)) do
local app = container.apps[appId]
im.Text("Queued Messages:")
for i, msg in ipairs(flashMessageQueue) do
local text = (msg.data and msg.data[1] and msg.data[1][1]) or "Unknown"
im.Text("Currently Visible:")
for _, appId in ipairs(visibleApps) do
im.BulletText(appId)
@/lua/ge/extensions/editor/flowgraph/nodelibrary.lua
for n, d in ipairs(sorted) do
if self.filteredFolders[d] then
table.sort(exits)
for _, e in ipairs(exits) do
self:displaySimpleElement(menuPos, "State Exit -> " .. e, createStateExitNode, e)
for n, d in ipairs(sorted) do
if type(self.newNodeLinkPin.type) == "table" then
for _, t in ipairs(self.newNodeLinkPin.type) do
if t == var.type then return true end
local match = string.lower(ffi.string(self.searchText))
for _, t in ipairs(tableKeys(typeOrder)) do
if match:find(t..": ") ~= nil then
local matchedTags = {}
for _, tag in ipairs(elem.info.node.tags or {}) do
local tagScore = matchStringFunction(tag, match, true) * 0.75
local var = source:getFull(nm)
for _, d in ipairs(dirs) do
if self:variablePinFilter(var,d[3]) then
local matchedTags = {}
for i, tag in ipairs(elem.info.data.splitPath or {}) do
if i < #info.splitPath then
table.sort(exits)
for _, e in ipairs(exits) do
self.search:queryElement({
local debugEnabled = editor.getPreference("flowgraph.debug.editorDebug")
for i, result in ipairs(self.searchResults) do
local prePos = im.GetCursorPos()
local nodeAvailableTableTypes = {}
for _, p in ipairs(node.node.pinSchema or {}) do
if p.type == "table" then
end
for _, dName in ipairs(dirs) do
self:checkEmpty(dir[dName], mode)
dir.isEmpty = true
for _, dName in ipairs(dirs) do
if not dir[dName].isEmpty then
end
for _, p in ipairs(availablePins) do p.__matchScore = nil end
end
for _, p in ipairs(availablePins) do p.__matchScore = nil end
table.insert(libtxt, header)
for _, name in ipairs(pins.names) do
for _, node in ipairs(pins.pins[name]) do
for _, name in ipairs(pins.names) do
for _, node in ipairs(pins.pins[name]) do
table.insert(libtxt,name..'\t'..(#pins.pins[name])..'\t'..node.name..'\t'..(node.pin.description or "(NONE)"))
local pinNew = 0
for _, p in ipairs(node.node.pinSchema or {}) do
if p.dir or p.type then
table.insert(vals, '' .. d .. '')
--for _, tag in ipairs(tagIndex) do
-- if arrayFindValueIndex(node.node.tags or {}, tag) then
for _, p in ipairs(node.node.pinSchema or {}) do
local pin = p.name
@/lua/ge/extensions/flowgraph/nodes/gameplay/crash/trackMultipleVehiclesCrash.lua
function C:work()
for _, vehId in ipairs(self.pinIn.vehIds.value) do
gameplay_util_crashDetection.addTrackedVehicleById(vehId);
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
self.flags.freezeSignals = 1
for _, sequence in ipairs(core_trafficSignals.getSequences()) do
local freeze = true
self.flags.freezeSignals = nil
for _, sequence in ipairs(core_trafficSignals.getSequences()) do
if sequence._trafficFreeze then
@/lua/vehicle/powertrain/nitrousOxideInjection.lua
if purgeParticleTick > 0.02 then
for _, v in ipairs(purgeValveNodes) do
obj:addParticleByNodesRelative(v.cid1, v.cid2, -2, 70, 0, 1)
if not purgeSoundActive then
for k, v in ipairs(purgeValveNodes) do
purgeSounds[k] = purgeSounds[k] or obj:createSFXSource2(purgeEvent, "AudioDefaultLoop3D", "nitrousPurge", v.cid1, 0)
elseif purgeSoundActive then
for k, _ in ipairs(purgeValveNodes) do
obj:stopSFX(purgeSounds[k] or -1)
local function resetSounds()
for k, _ in ipairs(purgeValveNodes) do
obj:stopSFX(purgeSounds[k] or -1)
@/lua/ge/extensions/tech/partAnnotations.lua
local parts = veh:getMeshNames()
for idx, part in ipairs(parts) do
log('I', 'partAnnotations', part)
local parts = veh:getMeshNames()
for idx, part in ipairs(parts) do
veh:setMeshAnnotationColor(part, defaultAnnotation)
local parts = veh:getMeshNames()
for idx, part in ipairs(parts) do
local color = M.getPartAnnotation(part)
@/lua/ge/extensions/gameplay/race/race.lua
self.recoveryStates = {}
for _, id in ipairs(ids) do
self.states[id] = {}
function C:debugDraw(data)
for _, pos in ipairs(data.offTrackData.offTrackPath) do
debugDrawer:drawSphere(pos, 0.05, ColorF(1,1,1,0.5))
local prevPos = vec3(data.offTrackData.offPos)
for _, pos in ipairs(data.offTrackData.offTrackPath) do
local cutDepth = pos:distanceToLineSegment(data.offTrackData.offPos, data.frontPos)
data.isOnRoad = false
for _, corner in ipairs(data.currentCorners) do
if corner:squaredDistance(roadPos) <= square(rad) then
for i, v in ipairs(sorted) do
self.states[v.id].placement = i + completedCount
if not self.started then return end
for _, id in ipairs(self.vehIds) do
function C:changeRaceVehicle(lastId, newId)
for k, id in ipairs(self.vehIds) do
if id == lastId then
for _, id in ipairs(self.vehIds) do
local veh = getObjectByID(id)
for _, id in ipairs(self.vehIds) do
if self.states[id].isAiVeh then
}
for _, l in ipairs(state.historicTimes) do
table.insert(simpleInfo.lapTimes, l.duration)
local overNextIdMap = {}
for _, curId in ipairs(state.currentSegments) do
local elem = self.path.config.graph[curId]
local elem = self.path.config.graph[curId]
for _, n in ipairs(elem.nextVisibleSegments) do
local tn = self.path.config.graph[n].targetNode
if not (elem.overNextCrossesFinish and lastLap) then
for _, n in ipairs(elem.overNextVisibleSegments) do
local tn = self.path.config.graph[n].targetNode
if #state.nextPathnodes > 1 then
for _, pn in ipairs(state.nextPathnodes) do
pn[2] = 'branch'
table.clear(state.currentSegments)
for _, segId in ipairs(self.path.config.startSegments) do
local currentSegment = self.path.segments.objects[segId]
vehRot:setFromDir(vehDir, vehDirUp)
for i, corner in ipairs(state.wheelOffsets) do
state.previousCorners[i]:set(state.currentCorners[i])
-- go through all current segments. check if the segment is finished (reaching its end)
for _,currentId in ipairs(state.currentSegments) do
local currentSegment = self.path.config.graph[currentId]
-- if we have at least one successor, we continue
for _, segId in ipairs(self.path.config.graph[currentId].successors) do
local segment = self.path.segments.objects[segId]
for _, segId in ipairs(state.currentSegments) do
local pnIds = self.path.config.segmentToPacenotes[segId]
local pnIds = self.path.config.segmentToPacenotes[segId]
for _, pni in ipairs(pnIds) do
if not state.completedPacenotes[pni] then
local state = self.states[id]
for _, node in ipairs(state.nextPathnodes) do
node[1]:drawDebug('simple', {1,0.16,0.08,1}, dumps(node[2]))
end
for _, node in ipairs(state.overNextPathnodes) do
node[1]:drawDebug('simple', {0.91,0.64,0.1,1}, dumps(node[2]))
end
for _, segId in ipairs(state.currentSegments) do
local pnIds = self.path.config.segmentToPacenotes[segId]
local pnIds = self.path.config.segmentToPacenotes[segId]
for _, pni in ipairs(pnIds) do
if not state.completedPacenotes[pni] then
@/lua/vehicle/controller/drivingDynamics/CMU.lua
local function updateCalibrationCallback(dt)
for _, callback in ipairs(calibrationCallbacksUpdate) do
callback(dt)
local function updateFixedStepCalibrationCallback(dt)
for _, callback in ipairs(calibrationCallbacksUpdateFixedStep) do
callback(dt)
local function updateGFXCalibrationCallback(dt)
for _, callback in ipairs(calibrationCallbacksUpdateGFX) do
callback(dt)
local supervisors = M.getSupervisors()
for _, sub in ipairs(supervisors) do
sub.setParameters({isEnabled = false})
for _, sub in ipairs(subControllers) do
if sub.sendConfigData then
for _, sub in ipairs(subControllers) do
if sub.shutdown then
for _, sub in ipairs(subControllers) do
if sub.typeName ~= "drivingDynamics/CMU" then
for _, sub in ipairs(subControllers) do
if sub.typeName ~= "drivingDynamics/CMU" then
for _, sub in ipairs(subControllers) do
if sub.typeName == path then
for _, sub in ipairs(subControllers) do
if sub.typeName:startswith(path) then
@/lua/ge/extensions/editor/assetBrowser.lua
local function assetSimpleFileTypeCheck(asset)
for k, type in ipairs(var.simpleFileTypes) do
if type.active[0] == true and asset.simpleFileType == type.label then
local function createAssetDataForFilteredAssetsJob(job)
for _,asset in ipairs(var.filteredAssets) do
core_jobsystem.create(createAssetDataJob, 1, asset)
if job.args[1].files then
for _, file in ipairs(job.args[1].files) do
createAssetData(file, job.args[2])
local function createAssetDataOfFilteredAssetsJob(job)
for _, file in ipairs(job.args[1]) do
createAssetData(file)
if var.options.assetViewFilterType == var.assetViewFilterType_enum.current_folder_files then
for _, dir in ipairs(var.selectedDirectory.dirs) do
if directoryFilterCheck(dir) == true then
if(var.selectedDirectory.files) then
for _, asset in ipairs(var.selectedDirectory.files) do
if assetFilterCheck(asset) == true then
--[[
for k, file in ipairs(data) do
local simpleFileTypes = {}
for k,type in ipairs(var.simpleFileTypes) do
type.active[0] = true
local function disableAllFilterTypes()
for k,type in ipairs(var.simpleFileTypes) do
type.active[0] = false
local simpleFileTypes = {}
for _,type in ipairs(filter.fileTypes) do
for __, fileType in ipairs(var.simpleFileTypes) do
for _,type in ipairs(filter.fileTypes) do
for __, fileType in ipairs(var.simpleFileTypes) do
if fileType.label == type then
local function saveSearchFilter(label, filterInput)
for k,v in ipairs(var.options.savedFilter) do
if v.label == label then
end
for k,v in ipairs(var.defaultFilter) do
if v.label == label then
local fileTypes = {}
for k,type in ipairs(var.simpleFileTypes) do
if type.active[0] == true then
if im.BeginPopup("Popup_" .. dir.path) then
for _, entry in ipairs(var.directoryContextMenuEntries) do
if entry.filterFn then
if im.BeginPopup("Popup_" .. asset.path .. "_" .. asset.fullFileName) then
for _, entry in ipairs(var.assetContextMenuEntries) do
if entry.filterFn then
if im.BeginPopup("ContextMenu_Material_" .. tostring(material.id)) then
for _, entry in ipairs(var.assetContextMenuEntries) do
if entry.filterFn then
if im.BeginPopup("Popup_" .. set.dir.path .. "_" .. set.name) then
for _, entry in ipairs(var.textureSetContextMenuEntries) do
if entry.filterFn then
if item.fileTypes then
for _,type in ipairs(item.fileTypes) do
tooltip = tooltip .. "\n* " .. type
else
for _,type in ipairs(var.simpleFileTypes) do
tooltip = tooltip .. "\n* " .. type.label
im.Indent(editor.getPreference("assetBrowser.general.treeViewIndentationWidth"))
for _,dir in ipairs(dir.dirs) do
showDirectoryInTreeView(dir)
local function displayDirectories(directories, childSize)
for k, dir in ipairs(directories) do
-- Display assets in case it's in the visible area of the view panel.
local function displayTextureSets(textureSets, childSize)
for k, set in ipairs(textureSets) do
-- Display assets in case it's in the visible area of the view panel.
local function displayAssets(assets, childSize)
for k, asset in ipairs(assets) do
-- Display assets in case it's in the visible area of the view panel.
for _, group in ipairs(var.filteredAssetGroupsSorted) do
height = height + getGroupHeight(group, childSize)
for _, group in ipairs(var.filteredAssetGroupsSorted) do
height = height + getGroupHeight(group, childSize)
if var.options.filter_displayDirs == true and var.filteredDirs then
for _, item in ipairs(var.filteredDirs) do table.insert(filteredList, item) end
end
if var.options.filter_displayTextureSets == true and var.filteredTextureSets then
for _, item in ipairs(var.filteredTextureSets) do table.insert(filteredList, item) end
end
if var.options.filter_displayAssets == true and var.filteredAssets then
for _, item in ipairs(var.filteredAssets) do table.insert(filteredList, item) end
end
elseif var.options.assetGroupingType ~= var.assetGroupingTypes_enum.none then
for _, group in ipairs(var.filteredAssetGroupsSorted) do
var.itemPos = 0
local displayedItems = getDisplayedSelectedDirectoryFilteredList()
for i, file in ipairs(displayedItems) do
if file.selected then
if im.BeginPopup("childrenDirectoryPopup_" .. dir.path) then
for _, dir in ipairs(dir.dirs) do
im.PushStyleVar2(im.StyleVar_FramePadding, im.ImVec2(4,0))
-- Add buttons per directory.
for k, dir in ipairs(var.selectedDirectory.pathToRoot) do
if im.Button(dir.name .. "##breadcrump" .. tostring(dir.id)) then
local indentedPos = curX + var.fontSize + var.style.ItemSpacing.x
for k,type in ipairs(var.simpleFileTypes) do
if type.active[0] == true then
-- disabled all types except the double-clicked one
for _,typeD in ipairs(var.simpleFileTypes) do
typeD.active[0] = false
local simpleFileTypes = {}
for k, typeE in ipairs(var.simpleFileTypes) do
if typeE.active[0] == true then
local allDisabled = true
for _, typeA in ipairs(var.simpleFileTypes) do
if typeA.active[0] == true then allDisabled = false end
if allDisabled == true then
for _, typeB in ipairs(var.simpleFileTypes) do
typeB.active[0] = true
local simpleFileTypes = {}
for _, typeC in ipairs(var.simpleFileTypes) do
if typeC.active[0] == true then
if dir.files then
for _, file in ipairs(dir.files) do
removeFileIfExists(file)
if dir.dirs then
for _, dir in ipairs(dir.dirs) do
removeThumbnailCacheFiles(dir)
local tbl = FS:findFiles(parent.path, "*", 0, false, true)
for _, path in ipairs(tbl) do
local stat = FS:stat(path)
for _, dir in ipairs(parent.dirs) do
coroutine.yield()
local success = false
for _,set in ipairs(dir.textureSets) do
if set.name == textureName then
if dir.fileCount > 1 then
for _, file in ipairs(dir.files) do
if file.type == "image" then
local tbl = FS:findFiles(parent.path, "*", 0, false, true)
for _, path in ipairs(tbl) do
local stat = FS:stat(path)
for _, dir in ipairs(parent.dirs) do
coroutine.yield()
local tbl = {}
for _, type in ipairs(var.assetSortingTypes) do
table.insert(tbl, type.name)
var.assetGroupingTypes_enum = {}
for id, type in ipairs(var.assetGroupingTypes) do
var.assetGroupingTypes_enum[type.name] = id
local tbl = FS:findFiles(dir.path, "*", 0, false, true)
for _, path in ipairs(tbl) do
local stat = FS:stat(path)
local simpleFileTypes = {}
for k, type in ipairs(var.simpleFileTypes) do
if type.label == asset.simpleFileType then
if not simpleFileTypes then return end
for _, type in ipairs(var.simpleFileTypes) do
if simpleFileTypes[type.label] ~= nil then
if var.selectedDirectory and var.selectedDirectory.dirs then
for _,dir in ipairs(var.selectedDirectory.dirs) do
if name == dir.name then
if selDir and selDir.dirs then
for _,dir in ipairs(selDir.dirs) do
if string.lower(name) == string.lower(dir.name) then
if dir and dir.files then
for k, file in ipairs(dir.files) do
if filename == file.fileName or filename == file.fullFileName then
for _, dirName in ipairs(dirNames) do
selDir = getDirByName(dirName, selDir)
local dirNamesCount = table.getn(dirNames)
for k, dirName in ipairs(dirNames) do
local createNoCache = true
for _, folder in ipairs(directoriesToLoad) do
local newDir = newDirectory(folder.path, folder.name, true, true, false)
local filenameLowercase = string.lower(filename)
for k, file in ipairs(dir.files) do
if filenameLowercase == string.lower(file.fullFileName) then
if dir and dir.files then
for k, file in ipairs(dir.files) do
if string.lower(filename) == string.lower(file.fullFileName) then
for k, directory in ipairs(directoriesToLoadRef) do
if im.InputText("##DirName" .. tostring(k), editor.getTempCharPtr(directory.name)) then
if sortedTbl then
for _, typeName in ipairs(sortedTbl) do
im.TextUnformatted(typeName)
@/lua/ge/extensions/editor/sitesEditor/tags.lua
self.tags = {}
for _, elem in ipairs(self.sites[self.key].sorted) do
for _, t in ipairs(elem.customFields.sortedTags) do
for _, elem in ipairs(self.sites[self.key].sorted) do
for _, t in ipairs(elem.customFields.sortedTags) do
self.tags[t] = 1
self.noTag = {}
for _, elem in ipairs(self.sites[self.key].sorted) do
if elem.customFields.tags[tag] then
im.BeginChild1("Tags", im.ImVec2(125 * im.uiscale[0], 0 ), im.WindowFlags_ChildWindow)
for i, tag in ipairs(self.sortedTags) do
if im.Selectable1(tag..'##'..i, self.tag == tag) then
for i, elem in ipairs(self.hasTag) do
elem:drawDebug('highlight',{0,1,0,0.25})
local flip = nil
for i, elem in ipairs(self.hasTag) do
if im.Selectable1(elem.name..'##'..i) then
if im.Button(">") then
for _,elem in ipairs(self.hasTag) do
table.insert(self.noTag, elem)
if im.Button("<") then
for _,elem in ipairs(self.noTag) do
table.insert(self.hasTag, elem)
im.BeginChild1("NoTags", nil, im.WindowFlags_ChildWindow)
for i, elem in ipairs(self.noTag) do
if im.Selectable1(elem.name..'##'..i) then
@/lua/ge/extensions/flowgraph/nodes/gameplay/sites/parkingspot.lua
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("out", {'string','number'}, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
self.pinOut.scl.value[3] = 10
for _, o in ipairs(self.options) do
self.pinOut[o].value = self._spot.customFields.values[o]
@/lua/ge/extensions/career/modules/delivery/cargoCards.lua
local function resetFilterCounters()
for _, filter in ipairs(filterTags) do
filter.facilityCards = 0
if usePlayerCards and playerCargoContainers then
for _, con in ipairs(playerCargoContainers) do
local icon = "cardboardBox"
elseif card.cardType == "storage" then
for _, destination in ipairs(card.locations) do
groupTags['destination_'..destination.destinationName] = true
for _, label in ipairs(taskLabels) do
groupTags['task_'..label] = true
local containerGroups = {}
for _, con in ipairs(playerCargoContainers) do
table.insert(containerGroups, groupsByKey[string.format("container_%d_%d", con.vehId, con.containerId)])
end)
for i, card in ipairs(cards) do
card.sortValues.cardId = i
end)
for i, card in ipairs(cards) do
card.sortValues.rewardMoney = i
end)
for i, card in ipairs(cards) do
card.sortValues.weight = i
end)
for i, card in ipairs(cards) do
card.sortValues.distance = i
end)
for i, card in ipairs(cards) do
card.sortValues.availablilty = i
for _, groupSet in pairs(groupSets) do
for _, group in ipairs(groupSet.groups) do
group.sortValues = {}
group.sortValues = {}
for _, sortKey in ipairs({"cardId", "rewardMoney","weight","distance"}) do
local min = math.huge
local min = math.huge
for _, id in ipairs(group.cardIdsUnsorted) do
min = math.min(min, cardsById[id].sortValues[sortKey] or math.huge)
local filterSets = { }
for _, filter in ipairs(filterTags) do
local storageAmount = {parcel = 0, fluid = 0, dryBulk = 0}
for _, con in ipairs(playerCargoContainers) do
if con.cargoTypesLookup.parcel then
end
for _, filter in ipairs(filterSets) do
filter.noContainers = nil
@/lua/ge/extensions/career/modules/insurance/repairScreen.lua
for _, vehicleData in ipairs(menuData.vehiclesInGarage) do
local inventoryId = vehicleData.inventoryId
@/lua/ge/extensions/ui/liveryEditor/editMode.lua
-- if M.appliedLayers and #M.appliedLayers > 0 then
-- for k, v in ipairs(M.appliedLayers) do
-- M.setActiveLayer(v, true)
-- for k, v in ipairs(M.appliedLayers) do
-- api.moveLayer(lastPos, nil, index, group.uid)
-- for key, value in ipairs(M.appliedLayers) do
-- api.removeLayer(lastPos, nil)
-- local data = {}
-- for key, value in ipairs(M.appliedLayers) do
-- table.insert(data, uiLayers.getLayerByUid(value))
-- for k, v in ipairs(M.appliedLayers) do
-- if v == M.activeLayerUid then
-- local index = #M.appliedLayers
-- for k, v in ipairs(M.appliedLayers) do
-- if v == layerUid then
-- for k, v in ipairs(M.appliedLayers) do
-- if v == oldUid then
-- for k, v in ipairs(M.appliedLayers) do
-- if v == layerUid then
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/raceEndScreen.lua
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
end
for _, btn in ipairs(self.options) do
if self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
-- local points, max = 0,0
-- for k, v in ipairs(self.pinIn.stats.value or {}) do
-- points = points + v.points or 0
--[[scenario.highscores.singleScores = core_highscores.getScenarioHighscores(getCurrentLevelIdentifier(), self.mgr.activity.missionTypeData.trackName, getConfigKey(false,nil,0,race))
for _,v in ipairs(scenario.highscores.singleRound) do
if v <= #(scenario.highscores.singleScores) then
@/lua/ge/extensions/gameplay/markers/driftLineMarker.lua
function C:clearObjects()
for _, name in ipairs(self.cluster.markerObjects or {}) do
local obj = scenetree.findObject(name)
self._inside = nil
for _, name in ipairs(self.cluster.markerObjects or {}) do
local obj = scenetree.findObject(name)
local function cluster(pois, allClusters)
for _, poi in ipairs(pois) do
local cluster = {
@/lua/ge/extensions/flowgraph/nodes/ui/cornerTimer.lua
local temps = {}
for _, clr in ipairs({'white','red','green','blue'}) do
table.insert(temps, {label = clr, value = clr})
@/lua/vehicle/controller/drivingDynamics/supervisors/components/brakeControl.lua
if wheelGroupSettings then
for _, groupSetting in ipairs(wheelGroupSettings) do
wheelGroupSettingsLookup[groupSetting.motorName] = groupSetting
for _, wheelData in ipairs(tractionControl.tractionControlledWheels) do
local groupSetting = wheelGroupSettingsLookup[wheelData.wheelGroup.name]
@/lua/common/jit/p.lua
local ann = prof_ann
for _, file in ipairs(files) do
local f0 = file:byte()
@/lua/ge/setSpawnpoint.lua
local dataLevel = data.levels[levelName]
for k, v in ipairs(levelInfo.spawnPoints) do
if v.objectname == dataLevel.defaultSpawnPointName then
@/lua/ge/extensions/editor/missionPlaybook/attributeViewer.lua
if prevData then prevData = prevData.attributes end
for _, key in ipairs(sortedKeys) do
im.Text(key)
local names = {}
for keyIdx, key in ipairs(sortedKeys) do
local row = {}
@/gameplay/missionTypes/collection/customNodes/collectionNode.lua
function C:setupMarkerData(path)
for _, m in ipairs(self.mgr.markerData) do
m.collected = false
local collected = false
for _, p in ipairs(points) do
local dist = (p-marker.pos):squaredLength()
local collectedAny = false
for _, m in ipairs(self.mgr.markerData) do
collectedAny = self:checkMarkerAgainstPoints(m,pointsToTest, veh) or collectedAny
local count, max = 0,0
for _, m in ipairs(self.mgr.markerData or {}) do
max = max + 1
@/lua/ge/extensions/editor/audioEventsList.lua
for k, name in ipairs(keysSorted) do
local tbl = inTbl[name]
for j, dir in ipairs(pathSplit or {}) do
if #currPathStr == 0 then
-- Render folders and eventsTree
for k, v in ipairs(eventsDir) do
if v.dataType == "dir" then
if searchResults then
for _, res in ipairs(searchResults) do
renderSoundEventGui(eventsList[res.name])
@/lua/ge/main.lua
log('I', 'convertLevelPrefabs', 'Converting the following files: '..dumps(filenames or {}))
for _,file in ipairs(filenames) do
convertPrefabtoJson(file)
log('I', 'validateLevelPrefabs', 'Validating the following files: '..dumps(filenames or {}))
for _,file in ipairs(filenames) do
validatePrefabJson(file)
if PlatformSwitches.useEditor then
for _,v in ipairs(editorExtensions) do
if not tableContains(startupExtensions, v) then
if unloadMode == 'manual' then
for _, v in ipairs(manualUnloadExtensions) do
if v == extName then
elseif unloadMode == 'auto' then
for i, v in ipairs(manualUnloadExtensions) do
if v == extName then
for _, filename in ipairs(foundfiles) do
if string.find(filename, 'datablocks.json') then
-- load old CS materials first:
for _, filename in ipairs(csMaterialFiles) do
TorqueScriptLua.exec(filename)
-- then the new ones
for _, filename in ipairs(jsonMaterialFiles) do
loadJsonMaterialsFile(filename)
-- datablocks
for _, filename in ipairs(datablockFiles) do
loadJsonMaterialsFile(filename)
local objects_to_delete = {"thePlayer", "spawn_default", "ParticleEmitter"}
for i,v in ipairs(objects_to_delete) do
obj = scenetree.findObject(v)
local objects_to_delete = {"thePlayer", "spawn_default", "ParticleEmitter"}
for i,v in ipairs(objects_to_delete) do
local obj = scenetree.findObject(v)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/startScreenDial.lua
function C:onDialSetByDialPanel(dial)
for _, d in ipairs(self.panel.dials) do
if dial.label == d.label then
@/lua/vehicle/extensions/gameplayInterfaceModules/interactCargoContainers.lua
for _, nodeId in ipairs(container.nodes) do
local node = v.data.nodes[nodeId]
for _, beamId in ipairs(container.beams) do
local beam = v.data.beams[beamId]
for _, entry in ipairs(cargoContainerCache[1]) do
local container = cargoContainerById[entry.id]
@/lua/ge/extensions/gameplay/rally/recceApp.lua
cornerStartsIndex = {}
for _, pacenote in ipairs(rm:getNotebookPath().pacenotes.sorted) do
local wp = pacenote:getCornerStartWaypoint()
cornerStartsKdTree = kdTreeP3d.new(#cornerStartsIndex)
for _, wp in ipairs(cornerStartsIndex) do
cornerStartsKdTree:preLoad(wp:nameWithPacenote(), wp.pos.x, wp.pos.y, wp.pos.z)
for _, mission in ipairs(gameplay_missions_missions.getFilesData() or {}) do
-- if mission.startTrigger.level == level then
-- for _, mission in ipairs(self.missions or {}) do
@/lua/ge/extensions/ui/liveryEditor/selection.lua
local uiFormattedLayers = {}
for key, layerUid in ipairs(M.selectedLayers) do
local layer = uiLayersApi.getLayerByUid(layerUid)
if M.selectedLayers then
for i, selectedLayerUid in ipairs(M.selectedLayers) do
if selectedLayerUid == layerUid then
if M.selectedLayers and #M.selectedLayers > 0 then
for _, value in ipairs(M.selectedLayers) do
return value
for _, v in ipairs(M.selectedLayers) do
local layer = uiLayersApi.getLayerByUid(v)
if M.selectedLayers then
for _, value in ipairs(M.selectedLayers) do
if layerUid == value then
@/lua/ge/extensions/editor/dragRaceEditor/waypoints.lua
for i, waypoint in ipairs(allWaypoints) do
local isSelected = i == selectedWaypointIndex
@/lua/common/libs/xlsxlib/tests/TestManager.lua
local startTime = socket.gettime()
for _, name in ipairs(testNames) do
local func = tests[name]
@/lua/ge/extensions/editor/raceEditor/trackLayout.lua
for _, sp in ipairs(self.path.startPositions.sorted) do
if sp.name == "STOP_ZONE" or sp.name == "SS_stop_control" or sp.name == "TC_out" then
local splitCount = 1
for i, sp in ipairs(self.path.pathnodes.sorted) do
if sp.useAsSplit and i < #self.path.pathnodes.sorted then
end
for i, sp in ipairs(objects.sorted) do
if im.Selectable1('#'..i .. " - " .. sp.name, objects.objects[self.path[fieldName]].id == sp.id) then
@/gameplay/missionTypes/aiRace/customNodes/multiVehicleLuaNode.lua
local getAllVehsFunc = self.data.ignoreUndrivableVehicles and getAllVehiclesByType or getAllVehicles
for _, veh in ipairs(getAllVehsFunc()) do
if not self.data.ignorePlayerVehicle or not veh:isPlayerControlled() then
for _, id in ipairs(vehIds) do
getObjectByID(id):queueLuaCommand(self.pinIn.func.value or '')
@/lua/vehicle/partCondition.lua
local breakGroups = type(beam.breakGroup) == "table" and beam.breakGroup or {beam.breakGroup}
for _, breakGroup in ipairs(breakGroups) do
table.insert(partTypeTags[partId], string.format("jbeam:breakGroup:%s", breakGroup))
partTypeTags[partId] = partTypeTags[partId] or {}
for _, beamCid in ipairs(partData.beamCids) do
if v.data.beams[beamCid] and v.data.beams[beamCid].beamType ~= 7 then --exclude support beams (type 7 -> bdebug.lua)
for _, partType in ipairs(partTypeData[partId] or {}) do
local split = split(partType, ":")
local hasFlexbody = false
for _, partType in ipairs(partTypeData[partId] or {}) do
local split = split(partType, ":")
@/lua/ge/extensions/gameplay/markers/zoneMarker.lua
if interactData.vehPos2d:distance(self.pos2d) <= self.radius+2 then
for _, z in ipairs(self.zones) do
if ( z:containsPoint2D(interactData.bbPoints[1])
if interactData.canInteract and inside then
for _, elem in ipairs(self.cluster.elemData) do
table.insert(interactableElements, elem)
local function cluster(pois, allClusters)
for _, poi in ipairs(pois) do
@/gameplay/missionTypes/targetjump/customNodes/CalculateZonePointRewardNode.lua
if points and points > self.points then
for _, t in ipairs(testPositions) do
if z:containsPoint2D(t) and points > self.points then
@/lua/ge/extensions/career/career.lua
if imgui.BeginMenu("Modules") then
for _, mod in ipairs(debugModules) do
local active = debugSettings[mod.debugName] or false
if imgui.BeginMenu("Functions") then
for _, mod in ipairs(careerModules) do
if extensions[mod].drawDebugFunctions then
imgui.EndMenuBar()
for _, mod in ipairs(debugModules) do
local active = debugSettings[mod.debugName] or false
-- prevent these extensions from being unloaded when switching level
for _, extension in ipairs(extensionFiles) do
setExtensionUnloadMode(extensions.luaPathToExtName(extension), "manual")
for _, moduleName in ipairs(careerModules) do
if extensions[moduleName].onCareerActivated then
debugModules = {}
for _, moduleName in ipairs(careerModules) do
if extensions[moduleName].debugName then
else
for _, name in ipairs(careerModules) do
extensions.unload(name)
data.organizationInteraction = organizationInteraction or {}
for _, module in ipairs(debugModules) do
if module.getDebugMenuActive then
local curLvlProgress = -1
for i, lvl in ipairs(beamXPLevels) do
if xp >= lvl.requiredValue then
for _, br in ipairs(career_branches.getSortedBranches()) do
if br.isBranch and br.parentDomain == "apm" then
data.branches = {}
for _, br in ipairs(career_branches.getSortedBranches()) do
if br.isBranch and br.parentDomain == "apm" then
local res = {}
for _, saveSlot in ipairs(career_saveSystem.getAllSaveSlots()) do
local saveSlotData = formatSaveSlotForUi(saveSlot)
local res = {}
for _, saveData in ipairs(career_saveSystem.getAllAutosaves(saveSlot)) do
local data = jsonReadFile(career_saveSystem.getSaveRootDirectory() .. saveSlot .. "/" .. saveData.name .. "/career/playerAttributes.json")
@/lua/ge/extensions/editor/inspector.lua
if editor.getObjectSelection and not editor.dirty then
for k, v in ipairs(editor.getObjectSelection()) do
local obj = scenetree.findObjectById(v)
local function displayFields(fields)
for _, val in ipairs(fields) do
-- simple field
if imgui.CollapsingHeader1("[" .. tostring(i) .. "]", nodeFlags) then
for _, arrayField in ipairs(val.sortedFields) do
if not arrayField.hidden then
local function setHeaderMenu(groupName)
for _, headerMenu in ipairs(headerMenus) do
if string.lower(headerMenu.groupName) == string.lower(groupName) then
local function getFieldType(fieldName, fields)
for _, field in ipairs(fields) do
if string.lower(field.name) == string.lower(fieldName) then
local menuFound = false
for _, headerMenu in ipairs(headerMenus) do
if string.lower(headerMenu.groupName) == string.lower(groupName) then
local groupHeaderMenuFound = false
for _, val in ipairs(headerMenus) do
if string.lower(val.groupName) == string.lower(groupName) then
local passFilter = false
for _, val in ipairs(fields) do
if imgui.ImGuiTextFilter_PassFilter(inspectorInfo.fieldNameFilter, val.name) then
-- display the groups and their fields
for _, group in ipairs(groupedSortedFields) do
if group ~= general and group ~= xform then
local hoveredHandleSquare = nil
for index, val in ipairs(groundCoverUVHandles) do
if imgui.IsMouseHoveringRect(val[1], val[2]) then
for index, val in ipairs(groundCoverUVHandleColors) do
local p1_BG = imgui.ImVec2(coloredBG_StartPos_X, coloredBG_StartPos_Y + 4*imgui.GetStyle().ChildBorderSize)
for index, val in ipairs(groundCoverUVBgColors) do
local p1_BG = imgui.ImVec2(coloredBG_StartPos_X, coloredBG_StartPos_Y + 4*imgui.GetStyle().ChildBorderSize)
@/lua/vehicle/recovery.lua
for i, point in ipairs(aabb) do
oobb[i]:setRotate(rot, point)
@/lua/ge/extensions/ui/apps/minimap/topomap.lua
for i, segment in ipairs(contourSegments) do
-- Calculate bounding box for this segment
@/lua/ge/extensions/career/modules/delivery/vehicleOfferManager.lua
unlocks[tier] = unlocks[tier] or {}
for _, value in ipairs(list) do
table.insert(unlocks[tier], {type="text", label = value})
unlocks[tier] = unlocks[tier] or {}
for _, value in ipairs(list) do
table.insert(unlocks[tier], {type="text", label = value})
local ret = {}
for _, offer in ipairs(allOffers) do
if filter(offer, ...) then
local ret = {}
for _, offer in ipairs(allOffers) do
if offer.offerExpiresAt > dGeneral.time()
local ret = {}
for _, offer in ipairs(allOffers) do
if offer.origin.facId == facId
local function getOfferById(id)
for _, offer in ipairs(allOffers) do
if offer.id == id then
log("I","",string.format("Reached tier %d of vehicle delivery. Increasing money rewards from %0.2f to %0.2f", tier, prevMult, nextMult))
for _, offer in ipairs(allOffers) do
if offer.data.type == "vehicle" and offer.rewards and offer.rewards.money then
log("I","",string.format("Reached tier %d of delivery. Increasing money rewards from %0.2f to %0.2f", tier, prevMult, nextMult))
for _, offer in ipairs(allOffers) do
if offer.data.type == "trailer" and offer.rewards and offer.rewards.money then
@/lua/ge/extensions/editor/trafficManager.lua
for _, objName in ipairs(group:getObjects()) do -- automatically registers objects as session data, depending on class and dynamic fields
local obj = scenetree.findObject(objName)
for _, key in ipairs(windowsSorted) do
windows[key].active = false
local tempLights = {}
for _, id in ipairs(session.lightsSorted) do
table.insert(tempLights, session.lights[id])
for j, state in ipairs(controller.states) do
state.duration = defaultDurations[j]
local function deleteLights()
for _, id in ipairs(session.lightsSorted) do
if scenetree.objectExistsById(session.lights[id].spawnedObjectId or 0) then
if options.vehicleGroupRandomPaint[0] then
for _, group in ipairs(vehGroup) do
group.paintName = "(Random)"
for i, key in ipairs(vehiclesPropsSorted) do
local label = string.lower(key:gsub("Sorted", ""))
for _, nameId in ipairs(session[key]) do
local veh = scenetree.findObject(nameId)
if im.BeginCombo("AI Mode##trafficManager", label or "(None)") then
for _, t in ipairs(tableKeysSorted(aiModes)) do
for _, mode in ipairs(tableKeysSorted(aiModes[t])) do
for _, t in ipairs(tableKeysSorted(aiModes)) do
for _, mode in ipairs(tableKeysSorted(aiModes[t])) do
if im.Selectable1(aiModes[t][mode].."##trafficManagerAiMode", sessionData.aiMode == mode) then
if varArray then
for _, var in ipairs(varArray) do
if var == "currentId" then
if im.BeginCombo("Target Vehicle##trafficManagerAiMode", aiData.targetName) then
for _, veh in ipairs(getAllVehiclesByType()) do
local vehName = veh:getName()
local allAiActive = session.vehiclesSorted[1] and true or false
for _, name in ipairs(session.vehiclesSorted) do
if not session.vehicles[name] or not session.vehicles[name].aiActive then
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
im.BeginChild1("trafficLightsList##trafficManager", im.ImVec2(160 * im.uiscale[0], 440 * im.uiscale[0]), im.WindowFlags_ChildWindow)
for _, id in ipairs(session.lightsSorted) do
if session.lights[id].choiceIndex then
if im.BeginCombo("##trafficManagerSignalController", currInstance.description or "(None)") then
for i, ctrl in ipairs(session.signalControllers) do
local j = math.ceil(i * 0.5)
for i, state in ipairs(currController.states) do
im.TableSetupColumn("state"..i, nil, clamp(state.duration, 0.01, 1e6))
end
for i, state in ipairs(currController.states) do
im.TableNextColumn()
-- controller state durations
for i, state in ipairs(currController.states) do
local stateData = currController:getStateData(state.state)
for _, id in ipairs(currInstance.tempSignalObjects) do
if im.Button(tostring(id).."##signalObject", im.ImVec2(columnWidth - im.GetStyle().ItemSpacing.x, 20 * im.uiscale[0])) then
local modelKeys = tableKeysSorted(core_vehicles.getModelList().models)
for _, model in ipairs(modelKeys) do
if string.find(model, "signs") and core_vehicles.getModel(model).model.Type == "Prop" then
if im.BeginCombo("Road Signs##trafficManagerSigns", label or "(None)") then
for _, m in ipairs(signSelector.models) do
for _, c in ipairs(tableKeysSorted(core_vehicles.getModel(signSelector.model).configs)) do
for _, m in ipairs(signSelector.models) do
for _, c in ipairs(tableKeysSorted(core_vehicles.getModel(signSelector.model).configs)) do
label = core_vehicles.getModel(m).configs[c].Configuration.." ["..c.."]"
if data.vehicles then
for _, data in ipairs(data.vehicles) do
local veh = scenetree.findObject(data.name) -- vehicles need to be referenced by name instead of id when loading from prefab
for _, instance in ipairs(signalsData.instances or {}) do
instance.pos = vec3(instance.pos)
end
for _, ctrl in ipairs(signalsData.controllers or {}) do
local obj = core_trafficSignals.newController(ctrl)
end
for _, sequence in ipairs(signalsData.sequences or {}) do
local obj = core_trafficSignals.newSequence(sequence)
for _, key in ipairs(vehiclesPropsSorted) do
for i, nameId in ipairs(session[key]) do
for _, key in ipairs(vehiclesPropsSorted) do
for i, nameId in ipairs(session[key]) do
if scenetree.objectExists(nameId) then
if session.signalControllers then
for i, id in ipairs(session.lightsSorted) do
local processed = session.lights[id]:onSerialize()
end
for i, v in ipairs(session.signalControllers) do
local processed = v:onSerialize()
end
for i, v in ipairs(session.signalSequences) do
local processed = v:onSerialize()
if windows.lights.active and not session.lightsActive then
for _, id in ipairs(session.lightsSorted) do
session.lights[id]:drawDebug(true, id == currSelection.light, false, session.lights[id].choiceIndex and debugColors.controllers[session.lights[id].choiceIndex], 5, 2)
im.SetColumnWidth(0, 240)
for _, key in ipairs(windowsSorted) do
if editor.uiIconImageButton(editor.icons[windows[key].icon], imSizes.large, windows[key].active and imColors.inactive or imColors.active) then
if session.vehiclesTemp then -- adds newly spawned vehicles to the traffic session SimGroup
for _, id in ipairs(session.vehiclesTemp) do
local prefix = "obj"
data.stats.avgSpeed = 0
for _, v in ipairs(data.stats.tempSpeedTbl) do
data.stats.avgSpeed = data.stats.avgSpeed + v
editor.registerWindow(editModeName, windows.main.size)
for _, key in ipairs(windowsSorted) do
editor.registerWindow(windows[key].key, windows[key].size, imDefaultPos)
@/lua/ge/extensions/editor/terrainMaterialsEditor.lua
if type(actionData.oldValue) == "table" then
for k, prop in ipairs(actionData.property) do
setProperty(prop, actionData.oldValue[k], obj)
else
for k, prop in ipairs(actionData.property) do
setProperty(prop, actionData.oldValue, obj)
if type(actionData.newValue) == "table" then
for k, prop in ipairs(actionData.property) do
setProperty(prop, actionData.newValue[k], obj)
else
for k, prop in ipairs(actionData.property) do
setProperty(prop, actionData.newValue, obj)
oldValue = {}
for k,v in ipairs(property) do
table.insert(oldValue, obj:getField(v, 0))
local files = {}
for k,v in ipairs(filePaths) do
local name, map, ext = string.match(v, regexRule)
local properties = {}
for k,v in ipairs(v1MaterialTextureSetMaps) do
table.insert(properties, string.format(property, v.mapIdentifier))
if terrainMtlCopyProxy.internalName ~= newName then
for _, mtl in ipairs(editor_terrainEditor.getMaterialsInJson()) do
if mtl.internalName == newName then
else -- version 1.5 terrain material
for k, map in ipairs(v1MaterialTextureSetMaps) do
terrainMtlProxy.material:setField(string.format("%sBaseTex", map.mapIdentifier), 0, terrainMtlCopyProxy.material:getField(string.format("%sBaseTex", map.mapIdentifier), 0))
-- find the index if it exists in paint materials
for i, mtlProxy in ipairs(editor_terrainEditor.getPaintMaterialProxies()) do
if mtlProxy.internalName == oldMaterialName then
-- change the name in the paint materials also and find the index if it exists in there
for _, mtlProxy in ipairs(editor_terrainEditor.getPaintMaterialProxies()) do
if mtlProxy.internalName == oldMaterialName then
if im.BeginCombo("##groundModels", groundModelName) then
for _, gmName in ipairs(groundModelNamesSorted) do
if im.Selectable1(gmName) then
if im.BeginCombo("##groundModels", groundModelName) then
for _, gmName in ipairs(groundModelNamesSorted) do
if im.Selectable1(gmName) then
im.Separator()
for i, k in ipairs(v1MaterialTextureSetMaps) do
terrainMaterialPropertyTreeNode(k.title, k.mapIdentifier, k.defaultOpen)
local terrainMaterials = scenetree.findClassObjects('TerrainMaterial')
for k,v in ipairs(terrainMaterials) do
local terrainMaterial = scenetree.findObject(v)
im.TableNextColumn()
for k, v in ipairs(upgradeFileFormatMaterials.terrainMaterials) do
im.TextUnformatted(tostring(v.id))
if upgradeFileFormatMaterials and upgradeFileFormatMaterials.terrainMaterials then
for k,v in ipairs(upgradeFileFormatMaterials.terrainMaterials) do
local terrainMaterial = scenetree.findObject(v.id)
if obj then
for k,v in ipairs(terrainMaterialTextureSetProperties) do
widgetInt2(v.property, v.name, obj, v.tooltip)
@/lua/ge/extensions/tech/utils.lua
veh:setMeshAlpha(1, "", false)
for _,us in ipairs(M.ultrasonic) do
tech_sensors.removeSensor(us)
local z = 0.3
for _,x in ipairs({-3, 3}) do -- sideways
for _,y in ipairs({-3, 3}) do -- longitudinally
for _,x in ipairs({-3, 3}) do -- sideways
for _,y in ipairs({-3, 3}) do -- longitudinally
local posRef = vec3(0, sign(y)*(math.abs(y)-1.5), z)
@/lua/vehicle/powertrain/combustionEngine.lua
local dashes = {nil, {10, 4}, {8, 3, 4, 3}, {6, 3, 2, 3}, {5, 3}}
for k, v in ipairs(curves) do
v.dash = dashes[k]
local isFlooding = device.canFlood
for _, n in ipairs(device.waterDamageNodes) do
isFlooding = isFlooding and obj:inWater(n)
if device.children and #device.children > 0 then
for _, child in ipairs(device.children) do
if child.deviceCategories.clutchlike then
local childForPort
for _, child in ipairs(device.children or {}) do
if i == child.inputIndex then
for _, soundData in pairs(device.soundLocations) do
for _, nodeCid in ipairs(soundData.nodes) do
bdebug.setNodeDebugText("CombustionEngine " .. device.name, nodeCid, device.name .. ": " .. soundData.text)
@/lua/common/utils/httpJsonServer.lua
for _, c in ipairs(read) do
if write[c] == nil then
local newList = {}
for i, sinkData in ipairs(sinks) do
if write[sinkData[1]] then
@/lua/ge/ge_utils.lua
local separator = ""
for i,v in ipairs(arg) do
argsStr = argsStr..separator
local separator = ""
for i,v in ipairs(arg) do
argsStr = argsStr..separator
dump(files)
for i,v in ipairs(files) do
-- extractFile( pathInZIP [, pathDst ] )
print("Hash of files in testZIP/testZIP.zip ")
for i, v in ipairs( files ) do
print( ' '..zip:getFileEntryHashByIdx(i)..' '..v)
for _, veh in ipairs(getAllVehicles()) do
local model = core_vehicles.getModel(veh.jbeam).model
local audioChannels = scenetree.findClassObjects('SFXSourceChannel')
for k, name in ipairs(audioChannels) do
local channel = scenetree.findObject(name)
local countNumericEntries = 0
for _,v in ipairs(components) do
if type(tonumber(v)) == 'number' then
local objects = scenetree.findClassObjects(className)
for _, objName in ipairs(objects) do
local object = scenetree.findObject(objName)
local v = 0
for _, k in ipairs(resSorted) do
v = math.floor(res[k] / 1024 / 1024)
@/lua/ge/extensions/editor/dataBlockEditor.lua
if im.TreeNode1(className) then
for _, dataBlock in ipairs(dataBlocks) do
local flags = im.TreeNodeFlags_Leaf
if im.BeginCombo("##dataBlock", dataBlockToCopyName) then
for _, dataBlock in ipairs(dataBlockClasses[newDataBlockClass]) do
if im.Selectable1(dataBlock:__tostring()) then
@/lua/ge/extensions/tech/impactgen/crashOutput.lua
local path = outParts[part]
for i, p in ipairs(path) do
if i == table.getn(path) then
@/gameplay/missionTypes/evade/customNodes/multiVehicleLuaNode.lua
local getAllVehsFunc = self.data.ignoreUndrivableVehicles and getAllVehiclesByType or getAllVehicles
for _, veh in ipairs(getAllVehsFunc()) do
if not self.data.ignorePlayerVehicle or not veh:isPlayerControlled() then
for _, id in ipairs(vehIds) do
getObjectByID(id):queueLuaCommand(self.pinIn.func.value or '')
@/lua/ge/extensions/gameplay/rally/snaproad/geoPacenotes.lua
for _, entry in ipairs(cornerSeverityTable) do
local diameter = tonumber(entry.diameter)
for _, entry in ipairs(cornerSeverityTable) do
if not entry.hp then
for _, point in ipairs(points) do
-- Calculate 2D distance from point to center (matching how radius was calculated)
for _, point in ipairs(focusPoints) do
local dist = middlePos:distance(vec3(point.pos))
-- Test each intensity variation option
for _, opt in ipairs(M.intensityVariationOptions) do
-- Set the intensity variation
@/lua/ge/extensions/career/modules/delivery/tasklist.lua
local cargoGrouped = {}
for _, con in ipairs(containers) do
for _, cargo in ipairs(con.rawCargo) do
for _, con in ipairs(containers) do
for _, cargo in ipairs(con.rawCargo) do
local gId = string.format("%s-%s", dParcelManager.getLocationLabelShort(cargo.destination),
end
for _, gId in ipairs(tableKeysSorted(cargoGrouped)) do
local tasklistElement = {
tasklistElements[gId] = tasklistElement
for _, cId in ipairs(cargoGrouped[gId]) do
cargoIdToTasklistElementId[cId] = gId
local transientPickupLocationGrouped = {}
for _, con in ipairs(containers) do
for _, cargo in ipairs(con.transientCargo) do
for _, con in ipairs(containers) do
for _, cargo in ipairs(con.transientCargo) do
local dId = string.format("%s", dParcelManager.getLocationLabelLong(cargo.location))
end
for _, dId in ipairs(tableKeysSorted(transientPickupLocationGrouped)) do
local tasklistElement = {
tasklistElements[dId] = tasklistElement
for _, cId in ipairs(transientPickupLocationGrouped[dId]) do
cargoIdToTasklistElementId[cId] = dId
local vehicleTaskCount = 0
for _, taskData in ipairs(dVehicleTasks.getVehicleTasks()) do
local tasklistElement = {
table.clear(elementsToClearById)
for _, tasklistId in ipairs(tableKeysSorted(tasklistElements)) do
-- clearing of no longer used tasks.
for _, mod in ipairs(first.modifiers) do
if mod.type == "timed" then
@/lua/ge/extensions/editor/roadUtils.lua
if template.decorations then
for index, decorationSettings in ipairs(template.decorations) do
local decoID = roadDecorations.decorateProps(road:getID(), decorationSettings.shapeName, tonumber(decorationSettings.distance),
if template.decals then
for index, decalSettings in ipairs(template.decals) do
local minDecalLength = decalSettings.dynamicFields.minLength
local childIDsString = ""
for index, childRoadSettings in ipairs(template.roads) do
if index == 1 then
@/gameplay/missionTypes/targetjump/customNodes/CreateZoneStringNode.lua
for _, zone in pairs(zones.objects) do
for _, uniqueZone in ipairs(uniquePointZones) do
if zone.customFields:get('points')==uniqueZone.customFields:get('points') then
@/gameplay/missionTypes/evade/customNodes/pursuitReadyPoliceNode.lua
local traffic = gameplay_traffic.getTrafficData()
for _, vehId in ipairs(self.pinIn.vehicleIds.value) do
if traffic[vehId] then
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamTableVis.lua
-- Go through subtables
for k1, v1 in ipairs(v) do
if type(v1) == "table" then
local sortedResTable = {}
for _,k in ipairs(keys) do
table.insert(sortedResTable, {pathToData = k, data = resTable[k]})
if im.BeginCombo("##chooseDataToGraphCombobox", dataGraphingPath or "Choose data to graph...", im.ComboFlags_HeightLarge) then
for k, v in ipairs(graphableData) do
local pathToData = v.pathToData
@/lua/vehicle/controller/loggerTemplate.lua
local electricMotors = powertrain.getDevicesByType("electricMotor")
for _, motor in ipairs(electricMotors) do
-- Sum up output power of all motors ([W])
@/lua/ge/extensions/flowgraph/nodes/states/stateExit.lua
end
for _, tName in ipairs(target:getTransitionNames()) do
if im.Selectable1(tName, tName == self.transitionName) then
@/lua/ge/extensions/editor/rayCastTest.lua
for _, point in ipairs(points) do
local dist = point:distance(camPos)
@/lua/ge/extensions/core/multiseatCamera.lua
else
for k, v in ipairs(getAllVehicles()) do
local vid = v:getId()
@/gameplay/missionTypes/delivery/customNodes/VehicleInTargetAreaNode.lua
local center = vec3(self.pinIn.targetPos.value)
for _, id in ipairs(ids) do
local veh = getObjectByID(id)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
@/lua/ge/extensions/flowgraph/nodes/logic/select.lua
if im.BeginCombo("##", self.mode, 0) then
for _,fun in ipairs(fg_utils.sortedMergeFuns.any) do
if fun.name ~= 'readOnly' then
@/lua/ge/map.lua
for i, speed in ipairs(list) do
speed = speed / unit
manualWaypoints = {}
for _, nodeName in ipairs(scenetree.findClassObjects('BeamNGWaypoint')) do
local o = scenetree.findObject(nodeName)
local rnum = 1
for _, decalRoadName in ipairs(scenetree.findClassObjects('DecalRoad')) do
local road = scenetree.findObject(decalRoadName)
local nargs = split(v.nodes, ',')
for _, nv in ipairs(nargs) do
local nargs2 = split(nv, '-')
local checkTabNames = {'load', 'Merge_Nodes_1', 'T_Junctions', 'X_Junctions', 'mergeNodesToLines', 'Merge_Nodes_2', 'optimizeNodes', 'convertToSingleSided'}
for i, v in ipairs(checkTabNames) do
if graphHistory[1][v] and graphHistory[2][v] then
local bestDot = 0
for _, v in ipairs(currRoads) do
local dirDot = math.abs(dir:dot((mapNodes[v[1]].pos - mapNodes[v[2]].pos):normalized()))
@/lua/ge/extensions/gameplay/race/pathnode.lua
if editor and editor.getPreference and editor.getPreference("raceEditor.general.showCustomFields") then
for i, name in ipairs(self.customFields.names) do
if self.customFields.types[name] == 'number' then
@/lua/ge/extensions/flowgraph/nodes/util/loadLevel.lua
local ht = {}
for _, lvl in ipairs(levels) do
table.insert(ht, {value = lvl, name = "displayed name"})
@/lua/ge/extensions/gameplay/crawl/boundary.lua
local visibleLookup = {}
for _, objectId in ipairs(visibleObjects) do
visibleLookup[objectId] = true
-- Generate points along the boundary perimeter
for i, vertex in ipairs(boundary.vertices) do
local nextIdx = vertex.next or (i == #boundary.vertices and 1 or i + 1)
for i, point in ipairs(points) do
local name = Sim.getUniqueName("BoundaryFlag_" .. i)
for i, corner in ipairs(currentCorners) do
if not site:containsPoint2D(corner) then
@/lua/ge/extensions/c2/panelPlugins/tileManager.lua
for idx, objName in ipairs(allObjectNames or {}) do
local obj = scenetree.findObject(objName)
for i, name in ipairs(entry.objectNames) do
local obj = scenetree.findObject(name)
local forestCache = {}
for i, itemRef in ipairs(entry.forestItems) do
local objName, itemIdx = itemRef[1], itemRef[2]
for i, decalId in ipairs(entry.decals) do
local inst = editor.getDecalInstance(decalId)
for i, item in ipairs(entry.roadMarkings) do
local name = item.name
local mapNodes = map.getMap and map.getMap() and map.getMap().nodes
for i, nid in ipairs(entry.aiNodes) do
local pos = mapData.positions[nid]
for _, r in ipairs(tileData.roadMarkings) do
size = size + 0.1 + (#r.nodes * 0.032)
for _, n in ipairs(tileData.aiNodes) do
size = size + 0.1 + ((n.links and #n.links or 0) * 0.09)
if debugState.drawObjects then
for _, obj in ipairs(data.objects) do
local pos = vec3(worldX + obj.pos[1], worldY + obj.pos[2], obj.pos[3])
if debugState.drawForest then
for _, item in ipairs(data.forestItems) do
local pos = vec3(worldX + item.pos[1], worldY + item.pos[2], item.pos[3])
if debugState.drawDecals then
for _, decal in ipairs(data.decals) do
local pos = vec3(worldX + decal.pos[1], worldY + decal.pos[2], decal.pos[3])
if debugState.drawAIGraph then
for _, node in ipairs(data.aiNodes) do
-- Convert local to world
if node.links then
for _, link in ipairs(node.links) do
-- Reconstruct points from stored edge data (which is local to tile)
for _, road in ipairs(data.roadMarkings) do
local lastPos = nil
else
for _, node in ipairs(road.nodes) do
local pos = vec3(worldX + node.pos[1], worldY + node.pos[2], node.pos[3] + 0.2)
@/lua/ge/extensions/editor/api/object.lua
if editor.selection and editor.selection.object then
for i,id in ipairs(editor.selection.object) do
if id == objectId then
for _, objId in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(objId)
if objectIds then
for _, objId in ipairs(objectIds) do
local obj = scenetree.findObjectById(objId)
if dynamicFields then
for _, fieldName in ipairs(dynamicFields) do
local value = editor.getFieldValue(objectID, fieldName)
if fields.arrayElements then
for _, data in ipairs(fields.arrayElements) do
editor.setFieldValue(targetObjectID, data.fieldName, data.value, data.arrayIndex)
if fields.arrayElements then
for _, data in ipairs(fields.arrayElements) do
targetObject:setField(data.fieldName, data.arrayIndex, data.value)
for _, object in ipairs(objects) do
table.insert(idArray, object:getID())
local highestObject
for i, id in ipairs(objects) do
local object = scenetree.findObjectById(id)
log('I','','prefabs = '..dumps(prefabInstanceList))
for i,v in ipairs(prefabInstanceList) do
log('I','',' '..tostring(v:getName())..' or '..tostring(v:getInternalName()))
objectIds = {}
for _, id in ipairs(selection) do
if scenetree.findObjectById(id) then
@/lua/vehicle/beamstate.lua
-- local partBreakGroups = {}
-- for _, partType in ipairs(partTypeData) do
-- local split = split(partType, ":")
local damageableBeams = {}
for _, partType in ipairs(partTypeData) do
local split = split(partType, ":")
local deformedBeamCount = 0
for _, beamCid in ipairs(damageableBeams) do
local beamDamage = beamDamageTracker[beamCid] or 0
breakGroupCache[g] = nil
for _, bcid in ipairs(bg) do
obj:breakBeam(bcid)
couplerBreakGroupCache[g] = nil
for _, ccid in ipairs(bg) do
obj:detachCoupler(ccid, math.huge)
if bg then
for _, ctid in ipairs(bg) do
obj:breakCollisionTriangle(ctid)
if type(deformGroup) == "table" then
for _, g in ipairs(deformGroup) do
M.deformGroupsTriggerBeam[g] = M.deformGroupsTriggerBeam[g] or beam.cid
nodeTags = {}
for _, tag in ipairs(_nodetag) do
nodeTags[tag] = true
transmitCouplers[nodeid].exportElectrics = transmitCouplers[nodeid].exportElectrics or {}
for _, electric in ipairs(dataList.electrics or {}) do
table.insert(transmitCouplers[nodeid].exportElectrics, electric)
transmitCouplers[nodeid].exportInputs = transmitCouplers[nodeid].exportInputs or {}
for _, input in ipairs(dataList.inputs or {}) do
table.insert(transmitCouplers[nodeid].exportInputs, input)
if delayedPrecompBeams then
for _, b in ipairs(delayedPrecompBeams) do
local tratio = initTimer / b.beamPrecompressionTime
if delayedPrecompTorsionbar then
for _, t in ipairs(delayedPrecompTorsionbar) do
local tratio = initTimer / t.precompressionTime
local breakGroups = type(torsionbar.breakGroup) == "table" and torsionbar.breakGroup or {torsionbar.breakGroup}
for _, g in ipairs(breakGroups) do
if breakGroupCache[g] then
if beam.collTris and not beam.disableTriangleBreaking then --allow beams to disable triangle breaking
for _, ctid in ipairs(beam.collTris) do
if collTriState[ctid] then
local breakGroups = type(beam.breakGroup) == "table" and beam.breakGroup or {beam.breakGroup}
for _, g in ipairs(breakGroups) do
if breakGroupCache[g] then
if type(deformGroup) == "table" then
for _, g in ipairs(deformGroup) do
M.deformGroupsTriggerBeam[g] = M.deformGroupsTriggerBeam[g] or b.cid
@/lua/ge/extensions/editor/util/zoneSelectorUtil.lua
if sites.zones.sorted then
for _, zone in ipairs(sites.zones.sorted) do
if zone.name then
e._cachedInitialZonesSet = {}
for _, zoneName in ipairs(e.initialZones) do
e._cachedInitialZonesSet[zoneName] = true
e._cachedDestinationZonesSet = {}
for _, zoneName in ipairs(e.destinationZones) do
e._cachedDestinationZonesSet[zoneName] = true
if im.BeginCombo("Add Zone##initialAdd"..e._id, e.selectedInitialZone or "Select zone...") then
for _, zoneName in ipairs(e.loadedZones) do
-- Only show zones that aren't already selected
if im.Button("Select All##initialSelectAll"..e._id) then
for _, zoneName in ipairs(e.loadedZones) do
if not initialZonesSet[zoneName] then
im.BeginChild1("InitialZonesList"..e._id, im.ImVec2(0, initialZonesHeight), true)
for i, zoneName in ipairs(e.initialZones) do
im.Text(zoneName)
if im.BeginCombo("Add Zone##destinationAdd"..e._id, e.selectedDestinationZone or "Select zone...") then
for _, zoneName in ipairs(e.loadedZones) do
-- Only show zones that aren't already selected
if im.Button("Select All##destinationSelectAll"..e._id) then
for _, zoneName in ipairs(e.loadedZones) do
if not destinationZonesSet[zoneName] then
im.BeginChild1("DestinationZonesList"..e._id, im.ImVec2(0, destinationZonesHeight), true)
for i, zoneName in ipairs(e.destinationZones) do
im.Text(zoneName)
@/lua/ge/extensions/editor/flowgraph/events.lua
if im.BeginCombo("Time Format", timeFormat) then
for _, format in ipairs({'Project Time','Global Time','Frame'}) do
if im.Selectable1(format, format == timeFormat) then
im.SetColumnWidth(1, 30)
for i, e in ipairs(self.mgr.events) do
if hideDuplicates and e.isDuplicate then
@/lua/vehicle/controller/tech/cosimulationCoupling.lua
local sOut, sCtr = master[5][1], 1
for _, v in ipairs(vehSensors.IMUs) do -- Append all the IMU readings.
local d = v.ctrl.getLatest(v.id)
end
for _, v in ipairs(vehSensors.GPSs) do -- Append all the GPS readings.
local d = v.ctrl.getLatest(v.id)
end
for _, v in ipairs(vehSensors.idealRADARs) do -- Append the Ideal RADAR readings.
local d = v.ctrl.getLatest(v.id)
end
for _, v in ipairs(vehSensors.roads) do -- Append all the Roads Sensor readings.
local d = v.ctrl.getLatest(v.id)
-- [Only groups requested by the .csv will appear in the jump table].
for k, v in ipairs(jumpTable) do
v()
id = id + 1
for i, sig in ipairs(outMap) do
msgOut[i + 1] = master[sig.mId][sig.i1][sig.i2]
-- Cast all Boolean-valued elements of the incoming message (which are numbers 0 or 1 in the socket), to Boolean type.
for _, v in ipairs(inBools) do
msgIn[v] = num2BoolTable[sign(abs(msgIn[v]))]
-- Set the 'Driver' group controls from the incoming message signals.
for _, data in ipairs(inDMap) do
local iF = data.iFreeze -- The index to the freeze channel, if it exists (otherwise 1).
-- Set the 'Wheels' group controls from the incoming message signals.
for _, data in ipairs(inWMap) do
local iF = data.iFreeze -- The index to the freeze channel, if it exists (otherwise 1).
local sCtr = 1
for _, sensor in ipairs(vehSensors.IMUs) do -- First, search through the IMU sensors, in order.
if nSig == names.imuPositionX then return sCtr end
end
for _, sensor in ipairs(vehSensors.GPSs) do -- Second, search through the GPS sensors, in order.
if nSig == names.gpsXCoordinate then return sCtr end
end
for _, sensor in ipairs(vehSensors.idealRADARs) do -- Third, search through the Ideal RADAR sensor, if it exists.
if nSig == names.idealRADARVehicle1Distance then return sCtr end
end
for _, sensor in ipairs(vehSensors.roads) do -- Last, search through the Roads Sensor, if it exists.
if nSig == names.roadsRoadHalfWidth then return sCtr end
local names = {}
for i, signal in ipairs(signals) do
names[i] = signal.name -- Extract the actual signal name
@/lua/ge/extensions/flowgraph/nodes/input/blacklistAction.lua
self.list = {}
for _, e in ipairs(presets[2].list) do
table.insert(self.list, e)
if im.BeginCombo("##presets" .. self.id, "Presets...") then
for _, preset in ipairs(presets) do
im.Text(preset.name)
if im.Button("Add##addact" .. self.id) then
for _, a in ipairs(preset.list) do
listKeys[a] = true
if im.Button("Remove##rmact" .. self.id) then
for _, a in ipairs(preset.list) do
listKeys[a] = false
if self.search.matchString ~= "" then
for _, result in ipairs(self.results) do
im.BeginChild1(result.id, im.ImVec2(im.GetContentRegionAvailWidth(), 22 * editor.getPreference("ui.general.scale") + 2))
else
for i, cat in ipairs(sortedCategories or {}) do
local allSelected = true
local allSelected = true
for i, name in ipairs(allCategories[cat]) do
allSelected = allSelected and listKeys[name]
if im.Selectable1("----- Category: " .. cat .. " -----", allSelected, im.SelectableFlags_DontClosePopups) then
for i, name in ipairs(allCategories[cat]) do
listKeys[name] = not allSelected
table.sort(allCategories[cat], orderSort)
for i, name in ipairs(allCategories[cat]) do
im.BeginChild1(name, im.ImVec2(im.GetContentRegionAvailWidth(), 22 * editor.getPreference("ui.general.scale") + 2))
table.sort(self.list)
for i, e in ipairs(self.list) do
if (allActions[e] == nil) then
@/lua/ge/extensions/flowgraph/nodes/vehicle/hasCouplerTag.lua
}
for _, tag in ipairs(couplerTags) do
table.insert(C.pinSchema, { dir = 'out', type = 'bool', name = tag, description = 'True if the vehicle has the ' .. tag .. ' coupler tag.' })
function C:_executionStarted()
for _, tag in ipairs(couplerTags) do
self.pinOut[tag].value = false
@/lua/ge/extensions/flowgraph/nodes/gameplay/decalPath.lua
local pathCount = #path
for _, wp in ipairs(path) do
wp.distanceFromStart = totalPathLength - wp.distToTarget
for i, m in ipairs(markers) do
data = decals[i]
@/lua/ge/extensions/core/vehicle/partmgmt.lua
for k, partName in ipairs(partsSorted) do
partsHighlighted[partName] = true
if configData.format == 4 then
for _, vehData in ipairs(configData.vehicles) do
if vehData.linkedPCFile then
for _, child in ipairs(entry.children) do
calculateOffsetRec(child, entry)
vehIdMap[entry.vehId] = tableSize(vehIdMap) + 1
for _, child in ipairs(entry.children) do
createVehIdMapRec(child)
for _, child in ipairs(entry.children) do
convertVehIdToIdx(child, entry)
for k, partName in ipairs(partsSorted) do
if newHighlightedParts[partName] then
local partsSelected = {}
for _, idx in ipairs(state.partsHighlightedIdxs) do
partsSelected[state.partsSorted[idx]] = true
@/lua/vehicle/controller/gauges/customModules/combustionEngineData.lua
local currentTorque = 0
for _, motor in ipairs(engines) do
currentPower = currentPower + (motor.outputTorque1 * motor.outputAV1)
local JToLiterCoef = 0
for _, b in ipairs(fuelTanks) do
local storage = energyStorage.getStorage(b)
@/lua/ge/extensions/gameplay/crawl/saveSystem.lua
if path.nodes and #path.nodes > 0 then
for i, node in ipairs(path.nodes) do
table.insert(out.nodes, {
if data.nodes and type(data.nodes) == 'table' then
for i, n in ipairs(data.nodes) do
local node = {
-- Load trails using the new getter system
for i, trailId in ipairs(data.trails or {}) do
local trail = M.getTrailById(trailId)
-- Add trail IDs (file paths)
for _, trail in ipairs(saveData.trails or {}) do
if trail.id then
local trails = {}
for _, filePath in ipairs(trailFiles) do
local trail = M.getTrailById(filePath)
local boundaries = {}
for _, filePath in ipairs(boundaryFiles) do
local boundary = M.getBoundaryById(filePath)
local paths = {}
for _, filePath in ipairs(pathFiles) do
local path = M.getPathById(filePath)
local startingPositions = {}
for _, filePath in ipairs(startingPositionFiles) do
local startingPosition = M.getStartingPositionById(filePath)
for _, trail in ipairs(allTrails or {}) do
local trailId = trail._filePath or trail.id
@/lua/ge/extensions/ui/liveryEditor/layers.lua
elseif layer.type == api.layerTypes.linkedSet then
for k, property in ipairs(layer.properties) do
if property.id == "color" then
for key in ipairs(layersData) do
local layer = layersData[key]
local count = 0
for k, layer in ipairs(M.layerMap) do
if layer.parentUid == layerUid then
@/lua/vehicle/controller/vehicleController/shiftLogic/electricMotor.lua
for _, v in ipairs(motors) do
v.motorDirection = motorDirection
local motorTorque = 0
for _, v in ipairs(motors) do
M.rpm = max(M.rpm, abs(v.outputAV1) * constants.avToRPM)
for _, motor in ipairs(motors) do
local motorRPM = abs(motor.outputAV1 * constants.avToRPM)
local function sendTorqueData()
for _, v in ipairs(motors) do
v:sendTorqueData()
local function setIgnition(enabled)
for _, motor in ipairs(motors) do
motor:setIgnition(enabled and 1 or 0)
motorNames = type(motorNames) ~= "table" and {motorNames} or motorNames
for _, v in ipairs(motorNames) do
local motor = powertrain.getDevice(v)
@/lua/common/devUtils.lua
for _, k in ipairs(keys) do
local v = rawget(t, k)
local keys = tableKeysSorted(t)
for _, k in ipairs(keys) do
local v = rawget(t, k)
@/lua/ge/extensions/career/modules/branches/leagues.lua
local allConditionsMet = true
for _, condition in ipairs(league.unlock) do
if condition.type == "leagueStars" then
local otherLeague = M.getLeagueById(condition.leagueId)
for _, mId in ipairs(otherLeague.missions) do
local all, def, bon = gameplay_missions_progress.getUnlockedStarCountsForMissionById(mId)
for i, dsId in ipairs(otherLeague.driftSpots or {}) do
local spot = gameplay_drift_saveLoad.getDriftSpotById(dsId)
local defaultCount = 0
for _, obj in ipairs(spot.info.objectives) do
defaultCount = defaultCount + (spot.saveData.objectivesCompleted[obj.id] and 1 or 0)
league.totalStarsAvailable, league.totalStarsObtained = 0, 0
for _, mId in ipairs(league.missions) do
local mission = gameplay_missions_missions.getMissionById(mId)
for i, dsId in ipairs(league.driftSpots or {}) do
local spot = gameplay_drift_saveLoad.getDriftSpotById(dsId)
local defaultCount = 0
for _, obj in ipairs(spot.info.objectives) do
table.insert(defaults, spot.saveData.objectivesCompleted[obj.id] or false)
local regular = {}
for _, id in ipairs(skillLeagues) do
local league = leaguesById[id]
leaguesBySkill[skillId] = {}
for _, id in ipairs(highlighted) do
table.insert(leaguesBySkill[skillId], id)
end
for _, id in ipairs(regular) do
table.insert(leaguesBySkill[skillId], id)
for _, skillId in ipairs(skillIds) do
for _, leagueId in ipairs(leaguesBySkill[skillId]) do
for _, skillId in ipairs(skillIds) do
for _, leagueId in ipairs(leaguesBySkill[skillId]) do
leaguesById[leagueId]._order = orderIndex
local i = 1
for _, file in ipairs(files) do
local data = jsonReadFile(file)
if data then
for _, league in ipairs(data) do
-- todo sanitize
i = i+1
for _, prog in ipairs(league.unlock or {}) do
if prog.type == "skillStars" then
league._missionOrderByMissionId = {}
for i, id in ipairs(league.missions) do
league._missionOrderByMissionId[id] = i
league._missionOrderByMissionId = {}
for i, id in ipairs(league.missions) do
league._missionOrderByMissionId[id] = i
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.careerSetup and skillIds[m.careerSetup.skill] then
else
for _, n in ipairs(cond.nested or {}) do
if M.startConditionIncludesLeague(n, leagueId) then
else
for _, n in ipairs(cond.nested or {}) do
M.getStartConditionLeagueId(n, map)
local filesDataById = {}
for _, mission in ipairs(gameplay_missions_missions.getFilesData() or {}) do
filesDataById[mission.id] = mission
local validMissionIds = {}
for _, mId in ipairs(league.missions) do
local m = gameplay_missions_missions.getMissionById(mId)
for id, league in pairs(leaguesById) do
for _, dsId in ipairs(league.driftSpots) do
local spot = spotsById[dsId]
@/lua/ge/extensions/ui/gridSelectorUtils/filterModule.lua
-- Create a lookup table for common filters for efficient checking
for _, commonFilter in ipairs(commonFilters) do
local propName, option = commonFilter[1], commonFilter[2]
-- Go through filterList to maintain proper ordering
for _, filterItem in ipairs(filterList) do
local propName = filterItem.propName
-- Use the order from filterList if available
for _, option in ipairs(filterItem.options) do
local optionName = option.name or option
for _, option in ipairs(allOptions) do
if filterOptions[option] == true then
local hasNonCommonOption = false
for _, option in ipairs(enabledOptions) do
if not commonFiltersLookup[propName] or not commonFiltersLookup[propName][option] then
end
for _, option in ipairs(disabledOptions) do
if not commonFiltersLookup[propName] or not commonFiltersLookup[propName][option] then
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
local allEnabled = true
for _, opt in ipairs(filter.options) do
if filterByProp[propName][opt] ~= true then
-- If all items were enabled, enable only the clicked item and disable all others
for _, opt in ipairs(filter.options) do
-- Only modify if not locked
local allFalse = true
for _, opt in ipairs(filter.options) do
if filterByProp[propName][opt] ~= false then
if allFalse then
for _, opt in ipairs(filter.options) do
-- Only modify if not locked
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
for _, option in ipairs(filter.options) do
-- Only reset if not locked
local function clearAllFilters()
for _, filter in ipairs(filterList) do
if filter.type == 'range' then
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
-- Lock specific options
for _, option in ipairs(options) do
if filterByProp[propName] and filterByProp[propName][option] ~= nil then
-- Unlock specific options
for _, option in ipairs(options) do
lockedFiltersByProp[propName][option] = nil
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
-- First, set all options to false (disabled)
for _, option in ipairs(filter.options) do
filterByProp[propName][option] = false
local filter = nil
for _, f in ipairs(filterList) do
if f.propName == propName then
-- Set all options to false (disabled) and lock them
for _, option in ipairs(filter.options) do
filterByProp[propName][option] = false
if allowedOptions then
for _, option in ipairs(allowedOptions) do
if filterByProp[propName][option] ~= nil then
table.clear(validFilters)
for _, filterData in ipairs(filterList) do
local propFilter = filterByProp[filterData.propName]
else
for _, option in ipairs(filterData.options) do
if propFilter[option] == false then
@/lua/ge/extensions/ui/vehicleVicinityApp.lua
local vehPosition = veh:getPosition()
for nodeId, node in ipairs(couplerCache[vehId]) do
node.livePos = veh:getNodePosition(node.cid) + vehPosition
@/lua/ge/extensions/flowgraph/nodes/career/setFuelLevel.lua
local allowedTypes = {gasoline = true, diesel = true, electricEnergy = true}
for _, tank in ipairs(self.fuelData) do
core_vehicleBridge.executeAction(veh,'setEnergyStorageEnergy', tank.name, tank.maxEnergy * self.pinIn.mult.value)
@/lua/ge/extensions/gameplay/rally/util.lua
local function hasPunctuation(last_char)
for _,char in ipairs(validPunctuation) do
if last_char == char then
local absSteeringVal = math.abs(steering)
for i,angle in ipairs(angles) do
if absSteeringVal >= angle.fromAngleDegrees and absSteeringVal < angle.toAngleDegrees then
@/lua/ge/extensions/util/trackBuilder/basicBorders.lua
for _, faceList in ipairs(shape.faces) do
for vIndex = 2, #faceList -1 do
local vOff = 0
for _, faceList in ipairs(shape.faces) do
local vOff = 0
}
for i,face in ipairs(shape.cap) do
startCap.leftMesh[(i-1)*3 + 1] = { v = face[1]-1, n = 0, u = 0}
for _, faceList in ipairs(shape.faces) do
-- normal for the first point is always sharp
for i,p in ipairs(shape.crossPoints) do
tmpVec3:set(
end
for i,p in ipairs(shape.normals) do
tmpVec3:set(
if side == 1 then
for i, f in ipairs(shape.faceInfo.faces) do
faces[(shape.faceInfo.faceCount+1-i) + (cpIndex * shape.faceInfo.faceCount)] = {
else
for i, f in ipairs(shape.faceInfo.faces) do
faces[i + cpIndex * shape.faceInfo.faceCount] = {
if startCap then
for i, f in ipairs(shape.faceInfo.startCap[sideName]) do
faces[faceCount+i] = {v = f.v, n = normalCount-1, u = 0 }
if endCap then
for i, f in ipairs(shape.faceInfo.endCap[sideName]) do
faces[faceCount+i] = {v = vertexCount +f.v, n = normalCount, u = 0 }
@/lua/ge/extensions/tech/openDriveExporter.lua
local isFound = false
for i, testTan in ipairs(cachedTangents[key]) do
local testTanNorm = testTan:normalized()
@/lua/ge/extensions/ui/policeInfo.lua
pd.info = info
for _, v in ipairs(pd.info) do
if type(v) == 'table' then
@/lua/ge/extensions/flowgraph/nodes/debug/comment.lua
if im.BeginCombo("##moveMode" .. self.id, moveModesPrettyNames[self.moveMode]) then
for _, mode in ipairs(self.moveModes) do
if im.Selectable1(moveModesPrettyNames[mode], mode == self.moveMode) then
@/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
if not self.tracking.signal and mapNodeSignals[n1] and mapNodeSignals[n1][n2] then
for _, signal in ipairs(mapNodeSignals[n1][n2]) do -- get best signal from current road segment
-- TODO: this can be problematic if the navgraph network is complex or overlapping
@/lua/ge/extensions/editor/assemblySpline/populate.lua
table.clear(neededMeshes)
for _, rigidMap in ipairs(rigidMaps) do
for _, meshPath in ipairs(rigidMap) do
for _, rigidMap in ipairs(rigidMaps) do
for _, meshPath in ipairs(rigidMap) do
if meshPath then -- Only count non-nil entries.
end
for _, bridgeMap in ipairs(bridgeMaps) do
for _, meshPath in ipairs(bridgeMap) do
for _, bridgeMap in ipairs(bridgeMaps) do
for _, meshPath in ipairs(bridgeMap) do
if meshPath then -- Only count non-nil entries.
@/lua/ge/extensions/editor/scriptAIEditor.lua
local firstPos = vec3(nodes[1].x, nodes[1].y, nodes[1].z)
for i, n in ipairs(nodes) do
if i > 1 then
@/lua/ge/extensions/editor/multiSpawnManager.lua
valid = true
for _, v in ipairs(commonGroups) do
if name == v.name and prevName ~= v then
vehSelector.config = currGroupData.config
for _, v in ipairs(paintKeysTable) do
vehSelector[v[1]] = currGroupData[v[1]]
for i, data in ipairs(groupData.data) do
for _, p in ipairs(paintKeysTable) do
for i, data in ipairs(groupData.data) do
for _, p in ipairs(paintKeysTable) do
if data[p[1]] == "custom" then
if processedGroup.data then -- this can be nil for generator groups
for i, data in ipairs(processedGroup.data) do
data.type = nil
data.type = nil
for _, p in ipairs(paintKeysTable) do
if data[p[1]] ~= "(Custom)" then -- if paint is not custom, clear the paint table
local commonFiles = {}
for _, v in ipairs(M.filePaths) do
local files = FS:findFiles(v, "*.vehGroup.json", -1, true, true)
end
for _, f in ipairs(commonFiles) do
local temp = jsonReadFile(f)
local oldIdx
for i, v in ipairs(commonGroups) do
if v.file == filePath then
else
for i, v in ipairs(currGroup.tags) do
im.TextUnformatted(v)
if im.BeginCombo("Country", generator.country or "(Default)") then
for _, v in ipairs(options.countries) do
if im.Selectable1(v, v == generator.country) then
for i, v in ipairs(options.generatedGroup) do
im.TextUnformatted(tostring(i))
for i, data in ipairs(currGroup.data) do
local isCurrent = i == options.vehIdx
if im.BeginCombo("Spawn Mode##multiSpawn", options.spawnModeValue) then
for _, v in ipairs(options.spawnModesSorted) do
local selected = options.spawnModeValue == v
if im.BeginCombo("##commonGroups", currName) then
for i, v in ipairs(commonGroups) do
if im.Selectable1(v.name.."##groupListIdx"..i, currName == v.name) then
@/lua/ge/extensions/gameplay/markers/walkingMarker.lua
iconRendererObj = scenetree.findObjectById(self.iconRendererId)
for idx, ntuple in ipairs(cluster.doors or {}) do
local area = scenetree.findObject(ntuple[1])
local anyOverlap = false
for idx, area in ipairs(self.doors or {}) do
--simpleDebugText3d(idx, area.iconPos, 0.25)
if iconRendererObj then
for idx, area in ipairs(self.doors or {}) do
playModeColorI.alpha = 0
end
for idx, area in ipairs(self.doors or {}) do
if area.screenObjId then
if iconRendererObj then
for idx, area in ipairs(self.doors or {}) do
iconRendererObj:removeIconById(area.iconId)
end
for idx, area in ipairs(self.doors or {}) do
if area.screenObjId then
if interactData.canInteract and self.anyOverlap then
for _, elem in ipairs(self.cluster.elemData) do
table.insert(interactableElements, elem)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
function C:drawOnMinimap(td)
for _, door in ipairs(self.doors or {}) do
ui_apps_minimap_utils.simpleCircle(door.iconPos)
local poisByObjectNames = {}
for _, poi in ipairs(pois) do
local name = {}
local name = {}
for _, door in ipairs(poi.markerInfo.walkingMarker.doors) do
table.insert(name, door[1]..door[2])
}
for _, poi in ipairs(poisInCluster) do
table.insert(cluster.elemData, poi.data)
@/lua/ge/extensions/gameplay/drift/freeroam/driftSpots.lua
})
for _, obj in ipairs(spot.info.objectives or {}) do
local completed = spot.saveData.objectivesCompleted[obj.id]
local rewards = {}
for _, obj in ipairs(spot.info.objectives) do
if not spot.saveData.objectivesCompleted[obj.id] then
local spot = gameplay_drift_saveLoad.getDriftSpotById(activeLine.spotName)
for _, obj in ipairs(spot.info.objectives or {}) do
local completed = spot.saveData.objectivesCompleted[obj.id]
for _, spotData in ipairs(gameplay_drift_saveLoad.loadAndSanitizeDriftFreeroamSpotsCurrMap()) do
for lineName, lineData in pairs(spotData.spatialInfo.lines) do
for _, data in ipairs(spot.saveData.scores) do
im.Text(tostring(data.score))
local spot = gameplay_drift_saveLoad.getDriftSpotById(activeLine.spotName)
for _, obj in ipairs(spot.info.objectives or {}) do
local completed = spot.saveData.objectivesCompleted[obj.id] or gameplay_drift_scoring.getScore().score >= obj.score
@/lua/vehicle/controller/drivingDynamics/supervisors/components/motorTorqueControl.lua
if not controlParameters.yawControl.isEnabled then
for _, motorName in ipairs(controlledMotors) do
throttleFactors[motorName].yawControl = 1
for _, motorName in ipairs(controlledMotors) do
throttleFactors[motorName].yawControl = throttleFactor
if wheelGroupSettings then
for _, groupSetting in ipairs(wheelGroupSettings) do
local kP = groupSetting.kP or 0
@/gameplay/missionTypes/timeTrial/constructor.lua
for _, key in ipairs({"bronze1Laps", "bronze2Laps", "bronze3Laps", "silver1Laps", "silver2Laps", "silver3Laps", "gold1Laps", "gold2Laps", "gold3Laps"} ) do
if self.missionTypeData[key] == nil or self.missionTypeData[key] == -1 then self.missionTypeData[key] = self.missionTypeData.defaultLaps end
self._defaultUserSettings = {}
for _, elem in ipairs(self:getUserSettingsData()) do
self._defaultUserSettings[elem.key] = elem.value
if not closed then
for _, star in ipairs({"bronzeTime", "bronzeTime2", "bronzeTime3", "silverTime", "silverTime2", "silverTime3", "goldTime", "goldTime2", "goldTime3"}) do
--self.starLabels[star] = "missions.timeTrials.stars."..star
local laps = ((userSettings or self.lastUserSettings).laps or self._defaultUserSettings.laps)
for _, reward in ipairs(baseList) do
if reward.attributeKey == "money" then
for _, reward in ipairs(baseList) do
if reward.attributeKey == "money" then
if flattendedUserSettings.reverse then
for _, key in ipairs(starKeys) do
local info = {
for _, key in ipairs({"justFinish", "justFinishPenalty", "bronzePenalty", "silverPenalty", "goldPenalty", }) do
starInfo[key] = {
for _, p in ipairs({
{"bronze1Laps","bronzeTime"},{"bronze2Laps","bronzeTime2"},{"bronze3Laps","bronzeTime3"},
-- simple full-time stars
for _, p in ipairs({
{"bronze1Laps","bronzeTime"},{"bronze2Laps","bronzeTime2"},{"bronze3Laps","bronzeTime3"},
unlockedStars.justFinishPenalty = pinData.penalty <= self.fgVariables.justFinishPenalty
for _, medal in ipairs({'bronze','silver','gold'}) do
unlockedStars[medal..'Penalty'] = finalTime <= self.fgVariables[medal..'TimeTotal'] and pinData.penalty <= self.fgVariables[medal .. 'TimePenalty']
local ret = {}
for i, nId in ipairs(path.config.linearSegments or {}) do
local node = path.pathnodes.objects[nId]
self.cachedWorldPreviewRoute = {}
for _, p in ipairs(ret) do
table.insert(self.cachedWorldPreviewRoute, {pos = p})
@/lua/ge/extensions/flowgraph/nodes/gameplay/vehiclePool/addGroup.lua
if self.pinIn.vehPool.value and self.pinIn.vehGroup.value then
for _, id in ipairs(self.pinIn.vehGroup.value) do
self.pinIn.vehPool.value:insertVeh(id)
@/lua/ge/extensions/gameplay/rally/loop/rallyAttempts.lua
local stageTimes = eventLog:getStageTimes()
for i, item in ipairs(stageTimes) do
-- Store individual stage times as timeSS1, timeSS2, etc.
@/lua/vehicle/controller/4wd.lua
if driveModesDifferentials then
for _, c in ipairs(driveModesDifferentials) do
c.nextDriveMode()
if driveModesRange then
for _, c in ipairs(driveModesRange) do
c.nextDriveMode()
if driveModesTransfercase then
for _, c in ipairs(driveModesTransfercase) do
c.nextDriveMode()
driveModesDifferentials = nil
for _, name in ipairs(driveModesDifferentialNames) do
local c = controller.getController(name)
driveModesTransfercase = nil
for _, name in ipairs(driveModesTransfercaseNames) do
local c = controller.getController(name)
driveModesRange = nil
for _, name in ipairs(driveModesRangeNames) do
local c = controller.getController(name)
@/lua/ge/extensions/gameplay/route/raceRoute.lua
local pathLen = #self.path
for j, pwp in ipairs(path) do
if not self.path[pathLen] or self.path[pathLen].wp ~= pwp then
local positionsWithMetadata = {}
for i, pos in ipairs(positions) do
positionsWithMetadata[i] = { pos = pos }
local lastIdx = #self.path
for i, p in ipairs(path) do
-- Check if the waypoint ID starts with "DR"
-- local newPoints = {}
-- for i, point in ipairs(points) do
-- table.insert(newPoints, {
if self.callbacks.onPointProcessed then
for i, point in ipairs(self.path) do
self.callbacks.onPointProcessed(point)
self.originalFixedPositions = {}
for i, point in ipairs(self.path) do
if point.fixed then
function C:getNextFixedWP()
for _, wp in ipairs(self.path) do
if wp.fixed then return wp.pos end
table.insert(fixedWps, { pos = startPos })
for _, wp in ipairs(self.path) do
if wp.fixed then
local callbackResult = nil
for i, wp in ipairs(self.originalFixedPositions) do
if self.callbacks.shouldPointBeFixedForRecalc then
@/lua/ge/extensions/util/trackBuilder/materialUtil.lua
local function getMaterials()
for _,l in ipairs(letters) do
loadMaterial(l)
@/lua/ge/extensions/telemetry/core.lua
for _, filePath in ipairs(trackerFiles) do
-- Get relative path from trackers folder and convert to extension name format
-- Load in priority order
for _, tracker in ipairs(trackersToLoad) do
local extName = 'telemetry_trackers_' .. tracker.name
-- Unload in reverse priority order
for _, tracker in ipairs(trackersToUnload) do
local extName = 'telemetry_trackers_' .. tracker.name
@/lua/ge/extensions/util/autoAnnotation.lua
node = Sim.upcast(node)
for i, item in ipairs(node:getData():getItems()) do
local itemData = item:getData()
@/lua/ge/extensions/gameplay/missions/unlocks/conditions/missionConditions.lua
local met = false
for _, key in ipairs(pKeys) do
if mission.saveData.progress[key] and mission.saveData.progress[key].aggregate then
@/lua/ge/extensions/editor/rallyEditor/pacenotes.lua
-- figure out which waypoints are available to select.
for i, pacenote in ipairs(self.path.pacenotes.sorted) do
-- if a pacenote is selected, then we can only select it's waypoints.
selected_pacenote_i = i
for _,waypoint in ipairs(pacenote.pacenoteWaypoints.sorted) do
if (waypoint:isCs() or waypoint:isCe()) and not waypoint:isLocked() then
local pn_prev = self.path.pacenotes.sorted[prev_i]
for _,waypoint in ipairs(pn_prev.pacenoteWaypoints.sorted) do
if not waypoint:isLocked() then
local pn_next = self.path.pacenotes.sorted[next_i]
for _,waypoint in ipairs(pn_next.pacenoteWaypoints.sorted) do
if not waypoint:isLocked() then
-- of the available waypoints, figure out the closest one.
for _, waypoint in ipairs(waypoints) do
local distNoteToCam = (waypoint.pos - self.mouseInfo.camPos):length()
for _,note in ipairs(self.path.pacenotes.sorted) do
note:validate()
local prev = nil
for _,curr in ipairs(self.path.pacenotes.sorted) do
if prev ~= nil then
local issues = ""
for _, issue in ipairs(self.validation_issues) do
issues = issues..'- '..issue..'\n'
-- im.BeginChild1("pacenotes", nil, im.WindowFlags_ChildWindow)
for i, note in ipairs(notebook.pacenotes.sorted) do
if not note:is_valid() then
for i,pn in ipairs(self.path.pacenotes.sorted) do
if pn.id == note.id then
@/lua/ge/extensions/editor/gen/terrain.lua
local amat = trn:getMaterials()
for _, m in ipairs(amat) do -- get all existing materials from terrain
lo('??^^^^^^^^^^^^^^^^^^^^^^^^^ for_MAT:'..tostring(m:getInternalName())..':'..tostring(m.baseColorBaseTex))
--[[
for j,d in ipairs(reg.arad) do
if d.isline then
local materials = {'m_plaster_worn_01_bat'}
-- for _,map in ipairs(terrainImpExp.textureMaps) do
-- table.insert(materials, map.material)
@/lua/ge/extensions/core/vehicleBridge.lua
local params = {}
for k, p in ipairs({...}) do
params[k] = serialize(p)
local params = {}
for k, p in ipairs({...}) do
params[k] = serialize(p)
@/lua/ge/extensions/editor/missionPlaybook/missionTreeViewer.lua
local id = 0
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.careerSetup.showInCareer then
if data and data.unlockedStars then
for i, key in ipairs(mission.careerSetup._activeStarCache.sortedStars) do
if i ~= 1 then im.SameLine() end
local ownPinIn, ownPinOut = pinIds(node.id)
for _, fId in ipairs(mission.unlocks.forward) do
local otherNode = M.nodesByMId[fId]
--ui_flowgraph_editor.NavigateToContent(0.01)
for _, node in ipairs(M.nodes) do
drawNode(node)
linkIds = 0
for _, node in ipairs(M.nodes) do
drawNodeLinks(node)
local unlocksById = {}
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.careerSetup.showInCareer then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/trafficParams.lua
local template = {}
for _, v in ipairs(aiModes) do
table.insert(template, {value = v})
@/lua/common/libs/luasec/options.lua
for k, option in ipairs(options) do
local name = string.lower(string.sub(option, 8))
options = loadoptions(file)
for k, option in ipairs(options) do
print(option)
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/trafficMoveGroup.lua
local t = {}
for _, v in ipairs(spawnModes) do
table.insert(t, {value = v})
@/lua/ge/extensions/editor/api/objectHistoryActions.lua
editor.history:beginTransaction("DeleteSelectedObjects")
for _, objId in ipairs(editor.selection.object) do
editor.history:commitAction("DeleteObject", {objectId = objId}, deleteObjectUndo, deleteObjectRedo)
local oldFieldValues = {}
for i, id in ipairs(objIds) do
local obj = Sim.findObjectById(id)
local oldFieldValues = {}
for i, id in ipairs(objIds) do
local obj = Sim.findObjectById(id)
local oldFieldValues = {}
for i, id in ipairs(objIds) do
local obj = Sim.findObjectById(id)
@/lua/ge/extensions/scenario/scenarios.lua
scenario.multiseatDeletedVehicles = {}
for _, assignment in ipairs(scenario.multiseatInput) do
local vehicleName = assignment.vehicleName
local assignedPlayers = extensions.core_input_bindings.getAssignedPlayers()
for _,assignment in ipairs(scenario.multiseatInput) do
local devName = assignment.device
if scenario and scenario.extensions then
for _, e in ipairs(scenario.extensions) do
if type(e) == 'table' and e.loaded then
if fullStats then
for index, entry in ipairs(fullStats) do
local needed = false
local playerVehicleFound = false
for k, vecName in ipairs(vehicles) do
local to = scenetree.findObject(vecName)
scenario.nodes = {}
for k, nodeName in ipairs(scenetree.findClassObjects('BeamNGWaypoint')) do
--log('D', logTag, tostring(k) .. ' = ' .. tostring(nodeName))
local aiRadFac = (scenario.radiusMultiplierAI or 1)
for _, wp in ipairs(scenario.lapConfig) do
if wp:sub(1,12) ~= '__generated_' then -- only process non-generated WPs
if type(scenario.blackListActions) == 'table' then
for i, action in ipairs( scenario.blackListActions ) do
--log('D', logTag, 'add action to blackList: ' .. tostring(action))
if type(scenario.whiteListActions) == 'table' then
for i, action in ipairs( scenario.whiteListActions ) do
--log('D', logTag, 'add action to whiteList: ' .. tostring(action))
local waypoints = scenetree.findClassObjects('BeamNGWaypoint') or {}
for _,entry in ipairs(scenario.lapConfig or {}) do
if type(entry) == 'string' then
log('D', logTag, 'spawning prefabs ...')
for i, filename in ipairs(scenario.prefabs) do
local _, objNameNew, _ = path.splitWithoutExt(filename, ".prefab.json")
if scenario and scenario.extensions then
for _, e in ipairs(scenario.extensions) do
if type(e) == 'table' then
local vehicleDeviceCount = {}
for _, assignment in ipairs(scenario.multiseatInput) do
local devName = assignment.device
data.vehicles[0] = allowUnassigned and 'Unassigned' or "" -- empty string tells UI to hide that column
for index, vehicleName in ipairs(scenario.playerUsableVehicles) do
data.vehicles[index] = vehicleName
local assignedInput = nil
for _,assignment in ipairs(scenario.multiseatInput) do
if assignment.device == devName then
for _,assignment in ipairs(scenario.multiseatInput) do
if assignment.device == '' and assignment.vehicleIndex == assignedInput.vehicleIndex and assignment.vehicleName == assignedInput.vehicleName then
for k, vecName in ipairs(vehicles) do
local vehicle = scenetree.findObject(vecName)
if scenario.extensions then
for _, e in ipairs(scenario.extensions) do
local extName = nil
-- dump(scenario.pooledResults)
for i, result in ipairs(scenario.pooledResults) do
if result.failed and not firstFail then
if type(scenario.blackListActions) == 'table' then
for i, action in ipairs( scenario.blackListActions ) do
--log('D', logTag, 'add action to blackList: ' .. tostring(action))
if type(scenario.whiteListActions) == 'table' then
for i, action in ipairs( scenario.whiteListActions ) do
--log('D', logTag, 'add action to whiteList: ' .. tostring(action))
local triggers = scenetree.findClassObjects('BeamNGTrigger')
for _,name in ipairs(triggers) do
local trigger = scenetree.findObject(name)
local allVehicles = scenetree.findClassObjects('BeamNGVehicle')
for k, vehicleName in ipairs(allVehicles) do
local vehicle = scenetree.findObject(vehicleName)
local readyVehicles = 0
for k, vehicleName in ipairs(vehicles) do
local vehicle = scenetree.findObject(vehicleName)
@/lua/ge/extensions/core/settings/audio.lua
end
for k, v in ipairs(entries) do
local record = split( v, '\t')
@/lua/ge/extensions/editor/perfProfiler.lua
local settingNames = {}
for _, e in ipairs(settingNamesRaw) do
settingNames[table.concat(e[1],"/")] = e[2]
if im.BeginCombo("Data Key##"..chart.chartWindowName, chart.currentDataKey) then
for _, key in ipairs(dataKeys) do
if im.Selectable1(key, key == chart.currentDataKey) then
local annotation = nil
for f, file in ipairs(allFiles) do
local startIdx = file.samples[1].idx
local row = {}
for i, sample in ipairs(file.samples) do
row[i] = {sample.idx - startIdx, sample[chart.currentDataKey]}
local enabledCount = 0
for f, file in ipairs(allFiles) do
local startIdx = file.samples[1].idx
local lines = {enabledFile.meta.name}
for _, col in ipairs(columns or {}) do
if col.enabled then
local val = enabledFile
for _, key in ipairs(col.keys) do
val = val[key]
local vehs = deepcopy(getAllVehicles())
for _, obj in ipairs(vehs) do
if obj then obj:delete() end
end
for _, file in ipairs(camPathFiles) do
local dir, fn, ext = path.split(file)
local keys = {}
for _, col in ipairs(preset.cols) do
keys[table.concat(col)] = true
end
for _, col in ipairs(columns) do
col.enabled = keys[table.concat(col.keys)] or false
if search.matchString ~= "" and search.matchString then
for _, result in ipairs(results) do
im.BeginChild1(result.id.."child", im.ImVec2(im.GetContentRegionAvailWidth(), 22 * editor.getPreference("ui.general.scale") + 2))
else
for i, column in ipairs(columns) do
im.BeginChild1(i.."child", im.ImVec2(im.GetContentRegionAvailWidth(), 22 * editor.getPreference("ui.general.scale") + 2))
end
for _, preset in ipairs(presets) do
im.SameLine()
table.insert(columns, {keys = {'renderAdapterType'}, enabled = false})
for _, group in ipairs({"osInfo","cpuInfo","gpuInfo","buildInfo","settingsInfo"}) do
for key, _ in pairs(allFiles[1][group]) do
local cols = {}
for _, col in ipairs(columns) do
if col.enabled then activeKeys = activeKeys + 1 table.insert(cols, col) end
im.TableSetupColumn("File", nil, 60)
for i, col in ipairs(cols) do
local label = settingNames[table.concat(col.keys, "/")] or table.concat(col.keys, " / ")
im.TableNextColumn()
for i, file in ipairs(allFiles) do
if im.Checkbox('##'..file.meta.name.."enable"..i, im.BoolPtr(file.enabled)) then
for _, col in ipairs(cols) do
local val = file
local val = file
for _, key in ipairs(col.keys) do
val = val[key]
fileData.enabled = true
for _, s in ipairs(fileData.samples) do
s.pos = vec3(s.pos)
im.TableNextColumn()
for i, file in ipairs(allFiles) do
if im.Checkbox('##'..file.meta.name.."enable"..i, im.BoolPtr(file.enabled)) then
globalNames, globalColors = {}, {}
for f, file in ipairs(allFiles) do
if file.enabled then
@/lua/vehicle/controller/vehicleController/shiftLogic/cvtGearbox2.lua
for i, v in ipairs(jbeamData.cvtSportGearRatios) do
if type(v) ~= "number" then
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaController.lua
else
-- for _, messageId in ipairs(messageIdsToIgnore) do
-- if msg.ID == messageId then
@/lua/ge/extensions/flowgraph/nodes/mission/selectGarageSpots.lua
table.clear(possibleStartingSpots)
for _, name in ipairs(tmp) do
if not usedSpotsByName[name] then
@/lua/ge/extensions/career/modules/fuel.lua
-- if the vehicle has one of these types, use this as default
for i, energyType in ipairs(energyTypes) do
if energyType == "gasoline" or energyType == "diesel" or energyType == "kerosine" then
if not defaultTypeCandidate then
for i, energyType in ipairs(energyTypes) do
if energyType == "electricEnergy" then
uiUpdateData.fuelData = {}
for i, tank in ipairs(fuelData) do
local tankData = {}
uiUpdateData.overallPrice = overallPrice
for i, tank in ipairs(fuelData) do
local tankData = {}
fuelData = {}
for _, tank in ipairs(data[1]) do
-- only add the tank to the fuelData if it has a valid fuel type
showUI = true
for i, data in ipairs(fuelData) do
table.insert(fuelingData, {price = 0, fueledEnergy = 0})
table.clear(energyTypes)
for index, tankData in ipairs(fuelData) do
if not tableContains(energyTypes, tankData.energyType) then
veh = veh or getPlayerVehicle(0)
for index, tankData in ipairs(data or fuelData) do
core_vehicleBridge.executeAction(veh, 'setEnergyStorageEnergy', tankData.name, tankData.currentEnergy)
local currentVolume = 0
for index, data in ipairs(fuelData) do
if data.energyType == "gasoline" or data.energyType == "diesel" or data.energyType == "kerosine" then
table.clear(energyTypeFuelingActive)
for i, data in ipairs(fuelingActive) do
if fuelingActive[i] then
local function startFuelingType(energyType)
for index, data in ipairs(fuelData) do
if data.energyType == energyType then
local function stopFuelingType(energyType)
for index, data in ipairs(fuelData) do
if not energyType or (data.energyType == energyType) then
if fuelData then
for index, data in ipairs(fuelData) do
if fuelingActive[index] then
overallPrice = 0
for _, data in ipairs(fuelingData) do
overallPrice = overallPrice + data.price
local applyAndSendToUI = false
for index, data in ipairs(fuelData) do
if fuelingActive[index] then
for index, tankData in ipairs(fuelData) do
if imgui.BeginChild1("Tank " .. index, imgui.ImVec2(0, 150), true) then
for i, energyType in ipairs(energyTypes) do
if imgui.Button(string.format("Start Fueling %s ##%d", energyType, i)) then
local tanksData = data[1]
for i, tank in ipairs(tanksData) do
-- refuel the car if it is electric or nearly empty
@/lua/ge/extensions/freeroam/vueBigMap.lua
local function toggleFiltersByIds(filterIds)
for _, filterId in ipairs(filterIds) do
filterVisibilityState[filterId] = not filterVisibilityState[filterId]
local function toggleFilterSectionById(sectionId)
for _, filterSection in ipairs(filterStructureCache) do
if filterSection.key == sectionId then
local onGroupCount, offGroupCount = 0, 0
for _, group in ipairs(filterSection.groups) do
if group.visible then
end
for _, group in ipairs(filterSection.groups) do
group.visible = allVisible
for _, branch in ipairs(career_branches.getSortedBranches()) do
if branch and not branch.isDomain then
local groupData = buildGroupData()
for _, poi in ipairs(gameplay_rawPois.getRawPoiListByLevel(level)) do
if poi.markerInfo.bigmapMarker then
local elementsAsPois = {}
for i, id in ipairs(gr.elements) do elementsAsPois[i] = poiData[id] end
table.sort(elementsAsPois,gameplay_missions_unlocks.depthIdSort)
table.sort(elementsAsPois,gameplay_missions_unlocks.depthIdSort)
for i, poi in ipairs(elementsAsPois) do gr.elements[i] = elementsAsPois[i].id end
gr.key = key
local sortedGroupIds = tableKeysSorted(groupsById)
for _, groupId in ipairs(sortedGroupIds) do
if string.startswith(groupId, 'missionType_') then
local branchOrdered = career_branches.orderBranchNamesKeysByBranchOrder()
for _, domainId in ipairs(branchOrdered) do
local domain = career_branches.getBranchById(domainId)
for _, branchId in ipairs(branchOrdered) do
local branch = career_branches.getBranchById(branchId)
local filters = {}
for _, section in ipairs(groupStructure) do
local filterSection = {
}
for _, group in ipairs(section.groups) do
if filterVisibilityState[group.key] == nil then
}
for _, lvl in ipairs(core_levels.getList()) do
if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
end
for _, section in ipairs(filterStructureCache) do
for _, group in ipairs(section.groups) do
for _, section in ipairs(filterStructureCache) do
for _, group in ipairs(section.groups) do
group.visible = filterVisibilityState[group.key]
local groups = {}
for _, section in ipairs(groupStructureCache) do
local validSection = false
}
for _, group in ipairs(section.groups) do
local visible = filterVisibilityState[group.key]
local validPoiIds = {}
for _, poiId in ipairs(group.elements) do
if validIds == nil or validIds[poiId] then
local visibleIds = {}
for _, groupSection in ipairs(groupStructureCache) do
for _, group in ipairs(groupSection.groups) do
for _, groupSection in ipairs(groupStructureCache) do
for _, group in ipairs(groupSection.groups) do
if filterVisibilityState[group.key] then
if filterVisibilityState[group.key] then
for _, poiId in ipairs(group.elements) do
visibleIds[poiId] = true
@/lua/vehicle/controller/hydraulics/closedLoopLinearControl.lua
--iterate over cylinders and track extend percentage
for _, cylinder in ipairs(cylinders) do
currentExtendPercent = currentExtendPercent + cylinder.currentExtendPercent
for _, cylinderName in ipairs(jbeamData.cylinders or {}) do
local cylinder = powertrain.getHydraulicConsumer(cylinderName)
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/brushStroke.lua
for i, point in ipairs(layer.dataPoints) do
layerDataCopy.cursorPosScreenUv = {
for k, data in ipairs(layer.dataPoints) do
im.TextUnformatted(tostring(k))
im.TableHeadersRow()
for _, property in ipairs(api.properties["Brush Stroke Layer"]) do
im.TableNextColumn()
@/lua/ge/extensions/core/ropeVisualTest.lua
local minMass, maxMass = math.huge, 0
for _, node in ipairs(nodes) do
if node.mass then
local allRopes = getAllRopeVisuals()
for _, entry in ipairs(allRopes) do
local rope = getRopeVisual(entry.id)
local nodes = rope:getNodes()
for i, node in ipairs(nodes) do
if rayIntersectsSphere(rayOrigin, rayDir, node.pos, 0.1) then
local simSum = 0
for _, t in ipairs(perfStats.totalSimTimes) do
simSum = simSum + t
local renderSum = 0
for _, t in ipairs(perfStats.totalRenderTimes) do
renderSum = renderSum + t
for _, entry in ipairs(allRopes) do
local ropeId = entry.id
simStats.max = 0
for _, t in ipairs(simStats.times) do
sum = sum + t
simStats.spikes = 0
for _, t in ipairs(simStats.times) do
if t > perfStats.spikeThreshold * simStats.avg then
local activeRopeIds = {}
for _, entry in ipairs(allRopes) do
activeRopeIds[entry.id] = true
local allRopes = getAllRopeVisuals()
for _, entry in ipairs(allRopes) do
local ropeId = entry.id
local allRopes = getAllRopeVisuals()
for _, entry in ipairs(allRopes) do
local rope = getRopeVisual(entry.id)
local currentItem = 0
for i, entry in ipairs(allRopes) do
if selectedRope and entry.rope.id == selectedRope.id then
local items = {}
for _, entry in ipairs(allRopes) do
table.insert(items, "Rope " .. entry.rope.id)
for _, entry in ipairs(allRopes) do
local ropeStats = getRopePerfStats(entry.id)
-- Load existing ropes into our tracking system
for _, entry in ipairs(allRopes) do
local ropeId = entry.id
@/lua/vehicle/powertrain/hydraulicAccumulator.lua
for _, consumer in ipairs(device.connectedConsumers) do
local consumerFlow, tankFlow = consumer:update(device.accumulatorPressure, dt)
local function updateGFX(device, dt)
for _, consumer in ipairs(device.connectedConsumers) do
consumer:updateGFX(device.accumulatorPressure, dt)
local function updateSounds(device, dt)
for _, consumer in ipairs(device.connectedConsumers) do
consumer:updateSounds(dt)
local function initSounds(device, jbeamData)
for _, consumer in ipairs(device.connectedConsumers) do
if consumer.initSounds then
local function resetSounds(device, jbeamData)
for _, consumer in ipairs(device.connectedConsumers) do
if consumer.resetSounds then
for _, consumer in ipairs(device.connectedConsumers) do
consumer:reset(device.consumerJbeamData[consumer.name])
@/lua/ge/extensions/util/testJSONFilesSyntax.lua
end
for _, warning in ipairs(warnings) do
log('W', 'jsonDecode', warning)
local filePaths = FS:findFiles('/', "*.jbeam\t*.pc\t*.json", -1, true, false)
for _, filePath in ipairs(filePaths) do
local dir, fileName, _ = path.splitWithoutExt(filePath)
@/lua/ge/extensions/editor/missionEditor/layers.lua
self.inputs = {}
for i, layer in ipairs(self.mission.layers) do
self.inputs[i] = {
local addElem = nil
for i, layer in ipairs(self.mission.layers) do
--im.Text('#'..i)
@/lua/ge/extensions/gameplay/rally/recceSettings.lua
local styleNames = {}
for _,style in ipairs(self.corner_angles_data.pacenoteStyles) do
table.insert(styleNames, style.name)
function C:getCornerCallStyle()
for _,style in ipairs(self.corner_angles_data.pacenoteStyles) do
if style.name == self:getCornerCallStyleName() then
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua
if backend.backendName == "gameplaySelector" then
for _, campaign in ipairs(campaign_campaignsLoader.getList()) do
local item = {
@/lua/vehicle/extensions/tech/techCore.lua
local speedList = {}
for idx, n in ipairs(nodes) do
local pos = vec3(n['pos'][1], n['pos'][2], 10000)
if cling then
for i, v in ipairs(script) do
v.z = techUtils.getSurfaceHeight(v)
if cling then
for i, v in ipairs(script) do
v.z = techUtils.getSurfaceHeight(v)
@/lua/vehicle/controller/drivingDynamics/actuators/activeDiffBias.lua
turningCircleRatioOutput1 = 0
for _, wheel in ipairs(relevantWheels[-1].wheels) do
turningCircleRatioOutput1 = turningCircleRatioOutput1 + turningCircleSpeedRatios[wheel.name]
turningCircleRatioOutput2 = 0
for _, wheel in ipairs(relevantWheels[1].wheels) do
turningCircleRatioOutput2 = turningCircleRatioOutput2 + turningCircleSpeedRatios[wheel.name]
for wheelSideIndex, wheelSide in pairs(relevantWheels) do
for _, wheel in ipairs(wheelSide.wheels) do
avgWheelPositions[wheelSideIndex] = avgWheelPositions[wheelSideIndex] + vec3(v.data.nodes[wheel.node1].pos)
@/lua/ge/extensions/util/configListGenerator.lua
local filtered = {}
for _, element in ipairs(list) do
if filterFunction(element) then
local passed = false
for _, value in ipairs(parameters) do
if type(vehicleValueDict) == 'table' then
local passed = false
for _, value in ipairs(parameters) do
if vehicleInfo[filterName] == value or (vehicleInfo.aggregates[filterName] and vehicleInfo.aggregates[filterName][value]) then
local totalPop = 0
for _, element in ipairs(list) do
totalPop = totalPop + (element[popKey] or 1)
local popCounter = 0
for _, element in ipairs(list) do
popCounter = popCounter + (element[popKey] or 1)
local modelPops = {}
for index, config in ipairs(configs) do
if not modelPops[config.model_key] then
-- Add index to each filter
for index, filter in ipairs(filters) do
filter.index = index
-- Add index to each config
for index, config in ipairs(configs) do
config.index = index
if seller.subFilters and not tableIsEmpty(seller.subFilters) then
for _, subFilter in ipairs(seller.subFilters) do
local aggregateFilter = deepcopy(seller.filter)
@/lua/vehicle/controller/propAnimation/googlyEyes.lua
eyeBeamData = {}
for _, cid in ipairs(eyeBeamIds) do
eyeBeamData[cid] = {defaultLength = obj:getBeamRestLength(cid)}
eyeLimiterData = {}
for _, cid in ipairs(eyeLimiterBeamIds) do
eyeLimiterData[cid] = {defaultLongBound = v.data.beams[cid].beamLongBound}
eyeAttachmentData = {}
for _, cid in ipairs(eyeAttachmentBeamIds) do
eyeAttachmentData[cid] = {defaultLength = obj:getBeamRestLength(cid)}
@/lua/ge/extensions/ui/console.lua
local i = 0
for _,v in ipairs(t) do
tmp = tmp + v
local function parseLog(data)
for _,f in ipairs(data) do
parseLogLine(f)
for _,i in ipairs(logFiltered) do
local l = logs[i]
else
for _,i in ipairs(rangeOrList) do
local l = logs[i]
local i = 1
for k,l in ipairs(logs) do
-- if type(l) == "table" then
local function setVehicleControlActive(b)
for _, mapName in ipairs(vehicleActionMaps) do
local map = scenetree.findObject(mapName)
if flog and #flog then
for _,l in ipairs(flog) do
onConsoleLog(l[1],l[2],l[3],l[4])
-- for _,l in ipairs(logs) do
-- if type(l) == "string" then
-- if f or (f==nil and levelFilter.A) then
-- for i,v in ipairs(l) do
-- im.TextColored(lcol,"%s",tostring(v) )
--------------------------------------------------------------------------------
-- for _,l in ipairs(logFiltered) do
-- if type(l) == "string" then
-- local lcol = colors[l[2]] or im.ImVec4(1,1,1,1)
-- for i,v in ipairs(l) do
-- if (i == 1 and not viewColumn.time[0])
-- local lcol = colors[l[2]] or im.ImVec4(1,1,1,1)
-- for i,v in ipairs(l) do
-- if (i == 1 and not viewColumn.time[0])
local lcol = colors[l[2]] or im.ImVec4(1,1,1,1)
for i,v in ipairs(l) do
-- if (i == 1 and not viewColumn.time[0])
if out and #out > 0 then
for _, le in ipairs(out) do
--table.insert(console_log_buffer, {'o', tostring(le)})
@/lua/ge/extensions/ui/freeroamSelector/general.lua
-- Check filters
for _, filter in ipairs(validFilters) do
local propVal = item[filter.propName:lower()]
if details and details.buttonInfo then
for _, button in ipairs(details.buttonInfo) do
if button.isDoubleClickAction or #details.buttonInfo == 1 then
@/lua/ge/extensions/editor/dynamicDecals/widgets.lua
if baseProp.options then
for _, option in ipairs(baseProp.options) do
options = options .. option .. "\0"
local i = 0
for k, col in ipairs(data) do
i = i + 1
if baseProp.fileTypes then
for _, type in ipairs(baseProp.fileTypes) do
table.insert(fileTypes, type)
if baseProp.fileTypes then
for _, type in ipairs(baseProp.fileTypes) do
table.insert(fileTypes, type)
if baseProp.fileTypes then
for _, type in ipairs(baseProp.fileTypes) do
table.insert(fileTypes, type)
if baseProp.fileTypes then
for _, type in ipairs(baseProp.fileTypes) do
table.insert(fileTypes, type)
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/setupPursuitGameplay.lua
traffic[suspectId].ignoreForceTeleport = true
for _, id in ipairs(policeIds) do
traffic[id].ignoreForceTeleport = true
@/lua/ge/extensions/career/modules/permissions.lua
local result
for _, permissionData in ipairs(permissions) do
if not result or permissionPriorities[permissionData.permission] > permissionPriorities[result.permission] then
@/lua/ge/extensions/editor/flowgraph/legend.lua
local itms = {}
for _, item in ipairs(self.items) do
local cp = im.GetCursorPosX()
@/lua/vehicle/powertrain/shaft.lua
local isValidMode = false
for _, availableMode in ipairs(device.availableModes) do
if mode == availableMode then
@/lua/ge/extensions/gameplay/sites/parkingSpot.lua
for _, tag in ipairs(self.customFields.sortedTags) do
newSpot.customFields:addTag(tag)
for _,fieldName in ipairs(self.customFields.names) do
local fieldValue, fieldType = self.customFields:get(fieldName)
local bbPoints = getBBPoints(bbCenter, bbAxis0, bbAxis1, bbAxis2)
for i, pointId in ipairs(pointIds) do
if self:containsPoint(linePointFromXnorm(bbCenter, bbPoints[pointId], precision)) then
for _, veh in ipairs(getAllVehicles()) do
local vehId = veh:getID()
local bbPoints = getBBPoints(bbCenter, bbAxis0, bbAxis1, bbAxis2)
for i, pointId in ipairs(bbPointIds) do
local nextId = bbPointIds[i + 1] or bbPointIds[1]
@/lua/ge/extensions/editor/flowgraph/overview.lua
-- Check if any child passed the filter
for _,child in ipairs(graph:getChildren()) do
if self.passedGraphIds[child.id] then
-- Check childs recursively
for _,child in ipairs(graph:getChildren()) do
if not self:skipDrawing(child) then
if treeNodeOpen then
for _,child in ipairs(graph:getChildren()) do
self:drawGraph(child)
for _, id in ipairs(sortedNodeIds) do
local node = graph.nodes[id]
-- GRAPHS
for _, index in ipairs(rootGraphIDs) do
local graph = self.mgr.graphs[index]
if self:drawGraph(macro) then
--[[for _,instanceID in ipairs(macroList.sortedInstanceIDs) do
self:drawGraph(self.mgr.graphs[instanceID])
@/gameplay/missionTypes/crawl/constructor.lua
for _, medal in ipairs({'bronze','silver','gold', 'no'}) do
if medal == 'no' then
local ret = {}
for _, node in ipairs(pathnodes) do
if node.pos then
@/lua/ge/extensions/core/levels.lua
if type(info.minimap) == 'table' then
for _, elem in ipairs(info.minimap) do
elem.file = l.dir..'/' .. elem.file
local res = {}
for _, level in ipairs(getList()) do
table.insert(res, level.levelName)
local res = {}
for _, level in ipairs(getList()) do
table.insert(res, level.dir.."/")
levelName = string.lower(levelName)
for _, l in ipairs(getList()) do
if string.lower(l.levelName) == levelName then
local defaultOptions = core_environment.getDefaultTimeOfDayOptions()
for _, option in ipairs(defaultOptions) do
table.insert(timeOfDayOptions, {
if level.timeOfDayPresets then
for _, preset in ipairs(level.timeOfDayPresets) do
-- Check if this key already exists in our options
local existingIndex = nil
for i, option in ipairs(timeOfDayOptions) do
if option.key == preset.key then
local function onClientPostStartMission()
for _, name in ipairs(scenetree.findClassObjects('DecalRoad')) do
local road = scenetree.findObject(name)
for i, spawnPoint in ipairs(levelInfo.spawnPoints or {}) do
if spawnPoint.objectname then
@/lua/ge/extensions/editor/flowgraph/properties.lua
im.Columns(2)
for _, k in ipairs(orderedKeys) do
if keysEditable then
im.SetColumnWidth(0, 70 * im.uiscale[0])
for pid, pin in ipairs(item.pinList) do
if pin.direction == 'in' then
if im.BeginCombo("##pinTemplateAdder", "From Template...") then
for _,p in ipairs(item._pinTemplates._in or {}) do
if not item.pinInLocal[p.name] then
for pid, pin in ipairs(item.pinList) do
if pin.direction == 'out' then
if im.BeginCombo("##pinTemplateAdder", "From Template...") then
for _,p in ipairs(item._pinTemplates._out or {}) do
if not item.pinOut[p.name] then
end
for _, file in ipairs(relativeFiles) do
local dir, filename, ext = path.split(file, true)
local validExt = false
for _, ft in ipairs(pin.allowFiles) do if file:find(ft[2]) or ft[2] == "*" then validExt = true break end end
if validExt then
end
for i, ht in ipairs(pin.hardTemplates or {}) do
if im.Selectable1(ht.label or dumps(ht.value)) then
if node then
for _,p in ipairs(node.pinList) do
p:highlightLinks()
for i, c in ipairs(graph:getChildren()) do
im.Text(c.name)
@/lua/ge/extensions/gameplay/sites/sitesManager.lua
local fileCount = 0
for _, info in ipairs(core_levels.getList()) do
local level = string.lower(info.levelName)
for _, sitePath in ipairs(sites) do
table.insert(sitesByLevel[level], sitePath)
--if currentLevel and sitesByLevel[currentLevel] then
--for _, file in ipairs(sitesByLevel[currentLevel]) do
--if sitesCache[file] then
M.getCurrentLevelSitesFileByName = function(name)
for _, site in ipairs(M.getCurrentLevelSitesFiles()) do
local _, siteName = path.split(site)
for _, spot in ipairs(parkingSpots) do
if spot:vehicleFits(vehId) and not spot:hasAnyVehicles(vehId) then
@/lua/ge/extensions/core/replay.lua
local result = {}
for i,file in ipairs(FS:findFiles('replays', '*.rpl', 1, false, false)) do
file = string.gsub(file, "/(.*)", "%1") -- strip leading /
local speedId = -1
for i,speed in ipairs(speeds) do
if speed == M.state.speed then
if speedId == -1 and val > 0 then
for i,speed in ipairs(speeds) do
if speed >= M.state.speed then
-- add all the missions replays that have been automatically recorded
for i, file in ipairs(FS:findFiles(M.getMissionReplaysPath(), '*.rpl', 0, false, false)) do
table.insert(filesWithUserSaved, {file = file})
-- add all the user saved replays that correspong to the current environment. Ie freeroam or career, save slot
for i, file in ipairs(FS:findFiles(getCurrentUserSavedReplayFilesPath(), '*.rpl', 0, false, false)) do
table.insert(filesWithUserSaved, {file = file, userSaved = true})
local ret = {}
for _, file in ipairs(filesWithUserSaved) do
local dir, fn, ext = path.split(file.file)
@/lua/ge/extensions/flowgraph/nodes/environment/planet.lua
if self.objs then
for _, obj in ipairs(self.objs) do
if editor and editor.onRemoveSceneTreeObjects then
self.objs = {}
for _, side in ipairs(rots) do
--print("Doing side " .. side.id)
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/signals/instanceByName.lua
if self.pinIn.signalsData.value and self.pinIn.name.value then
for _, instance in ipairs(self.pinIn.signalsData.value.instances) do
if instance.name == self.pinIn.name.value then
@/lua/ge/extensions/editor/toolUtilities/skeleton.lua
for _, pt in ipairs(controlPoints) do
local x, y = pt.x, pt.y
local nbs = getBlackUnvisitedNeighbours(x, y, mask, visited, width, height)
for _, nb in ipairs(nbs) do
local toIdx = idx(nb.x, nb.y)
-- Reverse prepend (back to control point, then rest of forward)
for _, p in ipairs(forward) do table.insert(backPath, p) end
end
for _, case in ipairs(cases) do
local d, name = case[1], case[2]
local filtered = {}
for _, path in ipairs(paths) do
local len = 0
table.clear(tangents)
for i, path in ipairs(paths) do
local t = {}
for i, path in ipairs(paths) do
local widthsInner = {}
for j, p in ipairs(path) do
local pX, pY = p.x, p.y
local function taperWidths(widths, taperLength)
for _, wList in ipairs(widths) do
local len = #wList
local function smoothWidths(widths, radius)
for _, wList in ipairs(widths) do
local len = #wList
local function clampEndpointWidths(widths, maxWidth)
for _, wList in ipairs(widths) do
wList[1] = min(wList[1], maxWidth)
local function fillZeroWidths(widths)
for _, wList in ipairs(widths) do
local len = #wList
@/lua/ge/extensions/gameplay/missions/unlocks/conditions/genericConditions.lua
local met = true
for _, cond in ipairs(c.nested or {}) do
local cMet = gameplay_missions_unlocks.conditionMet(cond)
end
for _, cond in ipairs(c.nested or {}) do
local cMet = gameplay_missions_unlocks.conditionMet(cond)
@/lua/ge/extensions/flowgraph/nodes/gameplay/removeOtherVehicles.lua
if self.onlyDrivableVehs then
for _, v in ipairs(getAllVehiclesByType()) do
table.insert(vehIds, v:getId())
else
for _, v in ipairs(getAllVehicles()) do
table.insert(vehIds, v:getId())
local idKeys = tableValuesAsLookupDict(vehIds)
for _, v in ipairs(self.mgr.modules.vehicle:getSpawnedVehicles()) do
if idKeys[v] then
for _, id in ipairs(vehIds) do
local delete = true
@/lua/ge/extensions/gameplay/race/segment.lua
local isPrev = false
for _, id in ipairs(state.currentSegments) do
if id == self.id then
local capsules = {}
for _, c in ipairs(self.capsulePoints) do
table.insert(capsules,{ name = c.name, radius = c.radius, pos = c.pos:toTable()})
self:setMode(data.mode)
for _, c in ipairs(data.capsules or {}) do
self:addCapsule(c.pos, c.radius, c.name)
@/lua/ge/extensions/core/audioRibbon.lua
for _, ribbon in ipairs(ribbons) do
local nodesSer = {}
ribbon.depths = {}
for _, nd in ipairs(ribbonData.nodes) do
table.insert(ribbon.nodes, vec3(nd.x, nd.y, nd.z))
@/lua/ge/extensions/gameplay/statistic.lua
local function removeSchedule(fn)
for i in ipairs(statSchedule) do
if statSchedule[i] == fn then
if moduleFiles then
for _, filePath in ipairs(moduleFiles) do
local _, file, _ = path.split(filePath)
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/pathStored.lua
local clr = ColorF(1, 0, 1, 0.2)
for i, p in ipairs(self.aiPath) do
dbgPt:set(p.x, p.y, p.z)
@/lua/ge/extensions/gameplay/markers/inspectVehicleMarker.lua
local function cluster(pois, allClusters)
for _, poi in ipairs(pois) do
local cluster = {
@/lua/ge/extensions/util/trackBuilder/obstaclePlacer.lua
local objects = {}
for _,oType in ipairs(obstacleTypes) do objects[oType] = {} end
if segment.obstacles then
for i,o in ipairs(segment.obstacles) do
if shapeNames[o.value..o.variant] == nil then
procCount = 0
for _,o in ipairs(segment.obstacles) do
if shapeNames[o.value..o.variant] == nil then
local data = {}
for _,oType in ipairs(obstacleTypes) do data[oType] = {} end
for _,piece in ipairs(track) do
for _,oType in ipairs(obstacleTypes) do data[oType] = {} end
for _,piece in ipairs(track) do
if piece.obstacles then
if piece.obstacles then
for _,o in ipairs(piece.obstacles) do
if shapeNames[o.value..o.variant] ~= nil then
expandTruncateList(name,#list)
for i,o in ipairs(list) do
objects[name][i]:setPosition(o.position)
end
for _,segment in ipairs(track) do
placeProceduralObstacles(segment)
local function clearReferences()
for _,oType in ipairs(obstacleTypes) do objects[oType] = {} end
end
@/lua/vehicle/controller/gauges/customModules/electricMotorData.lua
local currentTorque = 0
for _, motor in ipairs(motors) do
powerDisplay = powerDisplay + (motor.throttle or 0)
local energyLeft = 0
for _, b in ipairs(batteries) do
local storage = energyStorage.getStorage(b)
@/lua/ge/extensions/career/branches.lua
local skipFolders = {domains = true, branches = true, skills = true}
for _, folder in ipairs(folders) do
if not skipFolders[folder] then
local maxReachableLevel = 0
for i, level in ipairs(branch.levels) do
if not level.isInDevelopment then
--expand automatic unlocks for skills
for i, level in ipairs(branch.levels) do
if level.unlocks then
local allBranches = {}
for _, filePath in ipairs(FS:findFiles(branchesDir, 'info.json', -1, false, true)) do
local fileInfo = jsonReadFile(filePath)
local domains = {}
for _, branch in ipairs(allBranches) do
if branch.isDomain then
local remaining = {}
for _, branch in ipairs(allBranches) do
if not branch.isDomain then
local children = getChildren(parent.id)
for _, child in ipairs(children) do
table.insert(sortedList, child)
-- Process domains
for _, domain in ipairs(domains) do
table.insert(sortedList, domain)
-- Add to lookup tables preserving hierarchical order
for i, fileInfo in ipairs(sortedList) do
branchesById[fileInfo.id] = fileInfo
table.sort(keysSorted, sortBranchNames)
for _, key in ipairs(keysSorted) do
table.insert(sortedBranches, branchesByPath[key])
local levels = branch.levels or {}
for i, lvl in ipairs(levels) do
if lvl.requiredValue and val >= lvl.requiredValue then
local newUnlocks = {}
for _, unlock in ipairs(unlocks) do
if unlock.type == "automaticMission" then
local missions = {}
for i, mission in ipairs(gameplay_missions_missions.get()) do
if mission.careerSetup.showInCareer then
saveData[id] = {}
for _, field in ipairs(savedFields) do
saveData[id][field] = branch[field]
local met = 0
for _, flag in ipairs(flags) do
if career_modules_unlockFlags.getFlag(flag) then
table.insert(unlockFlags, branch.id.."-level-"..lvl)
for _, flag in ipairs(unlockFlags) do
flagDefinitions[flag] = {
-- for certifications
for _, certification in ipairs(branch.certifications or {}) do
local mission = gameplay_missions_missions.getMissionById(certification.requiredMissionsToPass)
local met = false
for _, key in ipairs(pKeys) do
if mission.saveData.progress[key] and mission.saveData.progress[key].aggregate then
local skipFolders = {domains = true, branches = true, skills = true}
for _, folder in ipairs(folders) do
if not skipFolders[folder] then
@/lua/ge/extensions/gameplay/drag/saveSystem.lua
if stripData.lanes then
for _, lane in ipairs(stripData.lanes) do
if lane.waypoints then
for _, waypoint in ipairs(lane.waypoints) do
local rot = quat(waypoint.transform.rotation.x, waypoint.transform.rotation.y, waypoint.transform.rotation.z, waypoint.transform.rotation.w)
if legacyData.strip and legacyData.strip.lanes then
for i, lane in ipairs(legacyData.strip.lanes) do
local convertedLane = {
if historyEntry.racerInfos and dragData.racers then
for i, racerInfo in ipairs(historyEntry.racerInfos) do
for rVehId, rRacer in pairs(dragData.racers) do
if data.history then
for _, entry in ipairs(data.history) do
table.insert(allHistory, entry)
local facilityFiles = FS:findFiles(levelPath, "*.facility.json", -1, true, false)
for _, file in ipairs(facilityFiles) do
local f = jsonReadFile(file)
-- This is a facility ID, get all strip IDs from the facility's strips
for _, stripFilePath in ipairs(facility.stripIds) do
-- Try the path as-is first
if #stripIdsToMatch == 0 then
for _, entry in ipairs(allHistory) do
if entry.stripId and string.find(entry.stripId, "^" .. id) then
local found = false
for _, existingId in ipairs(stripIdsToMatch) do
if existingId == entry.stripId then
-- Facility not found - try matching ID as prefix (e.g., "alderStrip" matches "alderStrip_main")
for _, entry in ipairs(allHistory) do
if entry.stripId and string.find(entry.stripId, "^" .. id) then
local found = false
for _, existingId in ipairs(stripIdsToMatch) do
if existingId == entry.stripId then
local filteredHistory = {}
for _, entry in ipairs(allHistory) do
if entry.stripId then
if entry.stripId then
for _, stripId in ipairs(stripIdsToMatch) do
if entry.stripId == stripId then
local historyArray = {}
for i, entry in ipairs(filteredHistory) do
historyArray[i] = entry
local historyArray = {}
for i, entry in ipairs(allHistory) do
historyArray[i] = entry
local facilityFiles = FS:findFiles(levelPath, "*.facility.json", -1, true, false)
for _, file in ipairs(facilityFiles) do
local facility = jsonReadFile(file)
local stripFiles = FS:findFiles(levelPath, "*.strip.json", -1, true, false)
for _, file in ipairs(stripFiles) do
local strip = jsonReadFile(file)
local strips = M.getAllStrips()
for _, strip in ipairs(strips) do
if strip.lanes then
if strip.lanes then
for _, lane in ipairs(strip.lanes) do
lane._stripId = strip.id
local lanes = M.getAllLanes()
for _, lane in ipairs(lanes) do
if lane.waypoints then
if lane.waypoints then
for _, waypoint in ipairs(lane.waypoints) do
waypoint._laneId = lane.id
@/lua/ge/extensions/flowgraph/nodes/scene/camera/setCameraRotation.lua
if im.BeginCombo("##cameraToMode" .. self.id, self.mode) then
for _, m in ipairs(self.modes) do
if im.Selectable1(m, m == self.mode) then
@/lua/ge/extensions/util/trackBuilder/splineTrack.lua
subPieces[index] = {}
for _,s in ipairs(subTracks[index]) do
if not s.noPoints then
if subTracks[i] ~= nil then
for s, seg in ipairs(subTracks[i]) do
seg.index = s
local connected = false
for _,s in ipairs(intersections[i].segments) do
connected = connected or s.sub == index
else
for _,s in ipairs(intersections[i].segments) do
if s.sub == index then
local centerP = vec3()
for _,seg in ipairs(segments) do
centerP = centerP +
local name = "procMerger"
for _, seg in ipairs(segments) do
name = name.."-"..(seg.reverse and 'r' or '')..seg.index.."x"..seg.sub
local function getIntersectionIndexByName(name)
for i,inter in ipairs(intersections) do
if inter.name == name then return i end
local ret = {}
for i, segment in ipairs(subTracks[subTrackIndex]) do
if segment.hasCheckPoint then
pieces[1].hdg = trackPosition.hdg
for i, p in ipairs(pieces) do
M.invalidatePiece(i)
for i = 1, #subTracks do
for _, segment in ipairs(subTracks[i]) do
if segment.quality ~= quality then
for sub = 1, #subTracks do
for i, segment in ipairs(subTracks[sub]) do
if segment.selected then
if not dontRefresMaterial then
for i, segment in ipairs(subTracks[subTrackIndex]) do
if segment.mesh then
else
for _, name in ipairs(markers.names) do
markers.hideMarkers(name)
for _, name in ipairs(markers.names) do
markers.transformMarkers(name, subTracks)
local function setAllPiecesHighQuality()
for i, segment in ipairs(subTracks[subTrackIndex]) do
if segment.quality ~= 1 then
local segmentsToMake = {}
for i, segment in ipairs(subTracks[subTrackIndex]) do
if segment.timer and segment.timer > 0 and segment.quality ~= 1 then
for _, segment in ipairs(segmentsToMake) do
if segment.points then
for i = 1, #subTracks do
for _, segment in ipairs(subTracks[i]) do
if segment.materialChanged then
if instantHighQuality then
for i, segment in ipairs(track) do
M.invalidatePiece(i)
-- interpolate fields
for _, name in ipairs(markers.names) do
markers.interpolate(name, track)
-- calculate texture position, final rotation for new points, also calculate position and rotation for markers
for index, segment in ipairs(track) do
segment.index = index
if segment.points and segment.refreshMesh then
for i, point in ipairs(segment.points) do
point.uvY = point.length
local timer = 0.25
for i, segment in ipairs(track) do
if segment.refreshMesh or (segment.quality ~= 1 and instantHighQuality) then
-- go through all segments that are invalid and update them.
for i, segment in ipairs(track) do
if segment.invalid then
local points = {}
for i, p in ipairs(piece.customPoints) do
local newP = {
-- start actually measuring the length
for i, segment in ipairs(track) do
if segment.invalid then
end
for _, t in ipairs(types) do
markers.addMarkerChange(t, index)
if track[i].procObstacles then
for _,o in ipairs(track[i].procObstacles) do
o:delete()
local tip
for i, p in ipairs(pieces) do
if p.invalid or track[i] == nil then
}
for _, name in ipairs(markers.names) do
track[i].markerInfo[name] = p[name]
end
for _, name in ipairs(markers.names) do
track[i][name] = p[name]
M.showMarkers(false)
for s,track in ipairs(subTracks) do
if track then
if track then
for _, segment in ipairs(track) do
if segment.mesh then
if segment.procObstacles then
for _,o in ipairs(segment.procObstacles) do
o:delete()
end
for _, name in ipairs(markers.names) do
markers.clearMarkers(name)
end
for _,i in ipairs(intersections) do
i.obj:delete()
for i = index, #pieces do
for _, name in ipairs(markers.names) do
if pieces[i][name] ~= nil then
for _, name in ipairs(markers.names) do
if pieces[index][name] ~= nil then
pieces[i] = pieces[i + 1]
for _, name in ipairs(markers.names) do
if existingMarkers[name] then
if track[#track].procObstacles then
for _,o in ipairs(track[#track].procObstacles) do
o:delete()
for i = index, #pieces do
for _, name in ipairs(markers.names) do
if pieces[i][name] ~= nil then
tmp.rightMesh = pieces[index].rightMesh
for _, name in ipairs(markers.names) do
tmp[name] = pieces[index][name]
if replace then
for _, name in ipairs(markers.names) do
pieces[index][name] = tmp[name]
pieces[index].invalid = true
--[[for _,name in ipairs(markers.names) do
if pieces[index][name] then
pieces[#subTracks[subTrackIndex]].invalid = true
for _, name in ipairs(markers.names) do
if pieces[index][name] ~= nil then
for i = index, #pieces do
for _, name in ipairs(markers.names) do
if pieces[i][name] ~= nil then
for i = index, #pieces do
for _, name in ipairs(markers.names) do
if existingMarkers[name] then
}
for i,tp in ipairs(subTrackPositions) do
export.subTrackPositions[i] = {
end
for s, pieces in ipairs(subPieces) do
export.subPieces[s] = {}
export.subPieces[s] = {}
for i, p in ipairs(pieces) do
export.subPieces[s][i] = {
}
for _, name in ipairs(markers.names) do
export.subPieces[s][i][name] = p[name]
local obstacles = {}
for _, o in ipairs(p.obstacles) do
local e = {
end
for i,s in ipairs(intersections) do
local segs = {}
local segs = {}
for j,seg in ipairs(s.segments) do
segs[j] = {index = seg.index, sub = seg.sub, reverse = seg.reverse}
local function upgradeObstacles(obstacles)
for i, o in ipairs(obstacles) do
if not o.extra then o.extra = {x=1,y=1,z=1} end
for s, tp in ipairs(import.subTrackPositions) do
subTrackPositions[s] = {}
end
for s,pieces in ipairs(subPieces) do
subTracks[s] = {}
subTracks[s] = {}
for _, p in ipairs(pieces) do
if not p.materialInfo then p.materialInfo = {} end
end
for i, o in ipairs(p.obstacles) do
if not o.extra then o.extra = {x=1,y=1,z=1} end
if import.materials then
for s,subMats in ipairs(import.materials) do
for field, mats in pairs(subMats) do
for s,pieces in ipairs(subPieces) do
for _, p in ipairs(pieces) do
for s,pieces in ipairs(subPieces) do
for _, p in ipairs(pieces) do
p.invalid = true
M.switchSubTrack(i)
for i, p in ipairs(subPieces[subTrackIndex]) do
for _, m in ipairs(markers.names) do
for i, p in ipairs(subPieces[subTrackIndex]) do
for _, m in ipairs(markers.names) do
markers.addMarkerChange(m, i)
for _,inter in ipairs(read.intersections or {}) do
for _,s in ipairs(inter.segments) do
for _,inter in ipairs(read.intersections or {}) do
for _,s in ipairs(inter.segments) do
if s.index == 1 then s.index = 2 end
local previews = {}
for i, file in ipairs(FS:findFiles('trackEditor/', '*.json', -1, true, false)) do
local _, fn, e = path.split(file)
local previews = {}
for i, file in ipairs(FS:findFiles('trackEditor/', '*.png', -1, true, false)) do
local _, fn, e = path.split(file)
end
for i, file in ipairs(FS:findFiles('trackEditor/', '*.jpg', -1, true, false)) do
local _, fn, e = path.split(file)
@/lua/ge/extensions/scenario/quickRace.lua
config.branches = config.branches or {}
for _, succ in ipairs(graphData.successors) do
table.insert(split, '__b'..succ)
sc.generatedNodes = {}
for _, node in ipairs(path.pathnodes.sorted) do
local nodeName = '__generated_from_path__' .. node.id
local lc = {}
for _, e in ipairs(config.lapConfig) do
if type(e) == 'string' then
local incIndexes = {}
for k,v in ipairs(scenario.highscores.singleRound) do
if place <= v then
--dump(incIndexes)
for k,v in ipairs(incIndexes) do
scenario.highscores.singleRound[k] = scenario.highscores.singleRound[k]+1
scenario.highscores.singleScores = core_highscores.getScenarioHighscores(scenario.levelName, scenario.scenarioName, M.getConfigKey(false,nil,0))
for _,v in ipairs(scenario.highscores.singleRound) do
if v <= #(scenario.highscores.singleScores) then
@/lua/ge/extensions/flowgraph/nodes/logic/sequencer.lua
if im.BeginCombo("##imode", self.incMode) then
for _, m in ipairs({ 'auto', 'manual', 'select' }) do
if im.Selectable1(m) then
if im.BeginCombo("##mode", self.mode) then
for _, m in ipairs(sortedModes) do
if im.Selectable1(m) then
@/lua/vehicle/controller/esc.lua
local actionedWheelLookup = {}
for _, wheelName in ipairs(escConfigs.actionedWheels) do
actionedWheelLookup[wheelName] = true
for _, wheelName in ipairs(escConfigs.actionedWheels) do
if wheelNameCache[wheelName] == nil then
--iterate over all wheels that should be included in the esc
for _, wheelName in ipairs(escConfigs.actionedWheels) do
local wheelNodePos = vec3(v.data.nodes[wheelCache[wheelNameCache[wheelName]].node1].pos) --find the wheel position
throttleFactorAssingment = {}
for _, wheelName in ipairs(escConfigs.actionedWheels) do
table.insert(throttleFactorAssingment, {wheelName = wheelName, throttleFactorName = "throttleFactor"})
@/lua/ge/extensions/editor/roadSpline/import.lua
local nodeData = {}
for _, node in ipairs(editor.getNodes(road)) do
table.insert(nodeData, { pos = node.pos, width = node.width })
if entry.nodes then
for j, node in ipairs(entry.nodes) do
editor.addRoadNode(obj:getID(), { pos = node.pos, width = node.width or 10, index = j - 1 })
local layers, numRefNodes = {}, #refNodes
for _, road in ipairs(decalRoads) do -- Iterate over each decal road in the selection.
local rawNodes = editor.getNodes(road)
local isTrackWidth = true
for _, node in ipairs(rawNodes) do
local nodePos, minDist, closestNodeIdx = node.pos, huge, 1
@/gameplay/missionTypes/aiRace/customNodes/collisionTrackingNode.lua
if math.abs(centerA.z - centerB.z) <= bbA:getHalfExtents().z + bbB:getHalfExtents().z then
for _, a in ipairs(bbPoints) do
inside = true
inside = true
for i, b in ipairs(bbPoints) do
local p = i < 4 and i + 1 or 1
@/lua/ge/extensions/flowgraph/basenode.lua
im.Separator()
for _, b in ipairs(behaviourOrder) do
if self.behaviour[b] then
local off = im.GetWindowPos()
for _, b in ipairs(behaviourOrder) do
if self.behaviour[b] then
if im.MenuItem1("Show all pins", nil, false, true) then
for _, pin in ipairs(self.pinList) do
pin.hidden = false
if im.MenuItem1("Hide unused pins", nil, false, true) then
for _, pin in ipairs(self.pinList) do
pin.hidden = pin.hidden or not pin:isUsed()
res.pins = {}
for _, pin in ipairs(self.pinList) do
table.insert(res.pins, {pin.direction, pin.type, pin.name, pin.default or nil, pin.description, pin.fixed, pin.tableType or nil})
table.clear(self.pinList)
for _, pinData in ipairs(nodeData.pins) do
local pin = self:createPin(
@/gameplay/missionTypes/timeTrial/editor.lua
function C:customFunctionSetStarsDynamic(mission, missionEditor)
for _, medal in ipairs({'bronze','silver','gold'}) do
local normalKey = medal.."Time"
mission.careerSetup.starRewards[dynamicKey] = deepcopy(mission.careerSetup.starRewards[normalKey])
for _, r in ipairs(mission.careerSetup.starRewards[dynamicKey]) do
r.rewardAmount = math.ceil(r.rewardAmount / laps)
local origIdx = -1
for i, k in ipairs(mission.careerSetup.defaultStarKeys) do
if k == normalKey then
@/lua/ge/extensions/core/vehicles.lua
if type(value) == 'table' then
for _, value2 in ipairs(value) do
destination[key][value2] = true
local filesJson, filesPC, filesImages, filesParsed, filesPaints = {}, {}, {}, {}, {}
for _, filename in ipairs(jfiles) do
if string.lower(filename:sub(-18)) == '.paintlibrary.json' then
if p then p:add("classify") end
for _, fn in ipairs(filesJson) do
local data = readFile(fn)
end
for _, fn in ipairs(filesPaints) do
local data = readFile(fn)
end
for _, fn in ipairs(filesPC) do
local data = readFile(fn)
local filesJson, filesPC, filesImages, filesParsed, filesPaints, filesAll = {}, {}, {}, {}, {}, {}
for _, filename in ipairs(jfiles) do
if string.lower(filename:sub(-18)) == '.paintlibrary.json' then
if p then p:add("classify") end
for _, fn in ipairs(filesJson) do
local data = contents[fn]
end
for _, fn in ipairs(filesPaints) do
local data = contents[fn]
end
for _, fn in ipairs(filesPC) do
local data = contents[fn]
-- Get the models. They are the directories one level under vehicles folder
for _, path in ipairs(getFilesJson()) do
-- name of a file or directory can have alphanumerics, hyphens and underscores.
for _, path in ipairs(getFilesPC()) do
local model, configName = string.match(path, modelRegexPC)
local vehicleDirs = FS:directoryList('/vehicles/', false, true)
for _, path in ipairs(vehicleDirs) do
local model = string.match(path, modelRegexDir)
local mainPartFound = false
for _, fn in ipairs(jbeamFiles) do
local fileData = jsonReadFile(fn)
end
for _, key in ipairs(default_color_keys) do
if info[key] and type(info[key]) == 'table' and #info[key] == 4 then
local function _imageExistsDefault(...)
for _, path in ipairs({...}) do
if getFilesImages()[path] then
visited[vehicle] = true
for _, cdata in ipairs(M.attachedCouplers) do
if cdata[1] == vehicle and not visited[cdata[2]] then
for _, coupler in ipairs(M.attachedCouplers) do
-- objId1, objId2, obj1nodeId, obj2nodeId
-- build the dependency tree
for id, vehData in ipairs(initVehsData) do
vehData = getFirstVehData(vehData)
-- spawn the main vehicle and all its vehicles
for i, config in ipairs(configs.vehicles) do
if level > 1 and i > 1 then
if type(newVeh) == 'table' then
for _, veh in ipairs(newVeh) do
table.insert(vehs, veh)
-- remove remaining vehicles
for _, vehId in ipairs(state.vehsToReuse) do
M.vehCollections[vehId] = nil
end
for _,v in ipairs(formats)do
if designData.format[v] and designData.format[v].gen then
allVehDirsExist = true
for vehIdx, vehData in ipairs(data.vehicles) do
local modelName
allVehDirsExist = true
for vehIdx, vehData in ipairs(data.vehicles) do
local modelName
local function onVehicleDestroyed(vid)
for i, coupler in ipairs(M.attachedCouplers) do
if coupler[1] == vid then
local function onCouplerDetached(obj1id, obj2id, nodeId, obj2nodeId)
for i, coupler in ipairs(M.attachedCouplers) do
if coupler[1] == obj1id and coupler[2] == obj2id and coupler[3] == nodeId and coupler[4] == obj2nodeId then
@/lua/ge/extensions/campaign/rewards.lua
-- local result = {}
-- for _,v in ipairs(eventData.rewards) do
-- table.insert(result, v)
@/lua/ge/extensions/gameplay/crawl/utils.lua
local function unloadPrefabs()
for _, id in ipairs(spawnedPrefabIds) do
local obj = scenetree.findObjectById(id)
for _, filePath in ipairs(prefabFileList or {}) do
local _, fn = path.splitWithoutExt(filePath)
local prefabDynamicObjects = getDynamicObjectsFromPrefab(prefabId, "crawlDynamic")
for _, objId in ipairs(prefabDynamicObjects) do
table.insert(dynamicObjects, objId)
local radiusMax = 0.33
for _, pos in ipairs(dottedPath) do
if dottedPathTimer*100 > pos.distanceFromStart then
local markerModes = {}
for i, pn in ipairs(path.nodes or {}) do
if pn.pos then
local pathPositions = { be:getPlayerVehicle(0):getPosition()}
for i, pn in ipairs(pathnodes) do
if pn.pos then
-- Initialize all markers as inactive
for i, _ in ipairs(pathnodes) do
markerModes[tostring(i)] = 'inactive'
local lastEndTime = 0
for _, idx in ipairs(sortedPathnodeIndices) do
local segmentTime = state.pathnodeTimings[idx]
-- Copy segment times
for _, seg in ipairs(raceState.currentTimes) do
table.insert(lapInfo.segmentTimes, seg)
-- Use squared distance to avoid expensive sqrt
for j, corner in ipairs(currentCorners) do
local distVec = corner - pathnode.pos
for i, corner in ipairs(state.crawlerData.dynamicData.wheelOffsets) do
state.crawlerData.dynamicData.currentCorners[i]:setRotate(vehRot, corner)
local objectCollisions = vehicleData.objectCollisions
for _, objId in ipairs(dynamicObjects) do
local collisionData = dynamicObjectCollisionData[objId]
for i, pn in ipairs(pathnodes) do
if pathReversed then
@/lua/ge/extensions/flowgraph/nodes/vehicle/customPartsConfigProvider.lua
local rem = nil
for i, key in ipairs(self.sortedKeys[field]) do
local keyText = im.ArrayChar(128, key)
@/lua/ge/extensions/campaign/exploration.lua
-- Spawn the prefab for the triggers
for _,prefabPath in ipairs(triggers) do
local prefabName = string.gsub(prefabPath, "(.*/)(.*)%.prefab", "%2")
uiParams.logPoints = missionLogOnly
for i, poi in ipairs(info) do
-- TODO(AK): State needs to come from result of scenario, if it has been played.
@/gameplay/missions/gridmap_v2/collection/002-blenderbowl/script.lua
for _, v in ipairs(getAllVehicles()) do
if v.jbeam == "ball" then
-- Loop through all balls and check if they are out of bounds
for _, id in ipairs(ballIds) do
local ball = scenetree.findObjectById(id)
@/lua/ge/extensions/freeroam/configuratorOptions/freeroamOptions.lua
for _, option in ipairs(timeOfDayOptions) do
table.insert(timeOption.options, { label = translate(option.label), value = option.key, style = "active" })
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/linkedSet.lua
for _, child in ipairs(layer.children) do
for _, property in pairs(properties) do
table.sort(props, function(a, b) return a.name < b.name end)
for _, property in ipairs(props) do
if not layer.properties[property.id] then
for _, id in ipairs(sortedKeys) do
local property = layer.properties[id]
@/lua/ge/extensions/career/modules/milestones/generalMilestones/statistic.lua
}
for _, milestone in ipairs(statisticMilestonesConfig) do
table.insert(milestonesList, milestone)
M.onGeneralMilestonesSetupCallbacks = function(milestone)
for _, milestone in ipairs(statisticMilestonesConfig) do
M.registerStastisticCallback(milestone)
@/lua/ge/extensions/flowgraph/nodes/debug/log.lua
local type = {}
for _, tmp in ipairs(log_types) do
table.insert(type, { value = tmp[1], label = tmp[2] })
@/lua/ge/extensions/gameplay/markers/parkingMarker.lua
if interactData.canInteract and self.parked then
for _, elem in ipairs(self.cluster.elemData) do
table.insert(interactableElements, elem)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
local iconExistence = {}
for _, poi in ipairs(pois) do
local path = poi.markerInfo.parkingMarker.path or "noPath"
}
for _, poi in ipairs(poisInCluster) do
table.insert(cluster.elemData, poi.data)
@/lua/ge/extensions/core/paths.lua
local foundId
for _, path in ipairs(paths) do
if path.id == id then
local names = {}
for _, path in ipairs(paths) do
names[path.name] = true
local deletionIndex
for i, p in ipairs(paths) do
if p.name == path.name then
local pathCopy = deepcopy(cameraPath)
for index, marker in ipairs(pathCopy.markers) do
marker.pos = {x = marker.pos.x, y = marker.pos.y, z = marker.pos.z}
end
for _, path in ipairs(paths) do
if path.filename == pathFileName then
-- extract all its markers
for i, markerData in ipairs(pathJsonObj.markers) do
local marker = {
@/lua/ge/extensions/editor/flowgraph/stateView.lua
im.NextColumn()
for _, state in ipairs(states) do
local running = false
table.sort(children, function(a,b) return a.id
@/lua/ge/extensions/editor/particleEditor.lua
if im.BeginCombo("##emitter", string.format("%s (%s)", currentEmitter:getName(), currentEmitter:getField("particles", ""))) then
for _, emitter in ipairs(particleEmitters) do
if im.Selectable1(string.format("%s (%s)", emitter:getName(), emitter:getField("particles", ""))) then
if im.BeginCombo("##particles" .. i, particleNames[i] or "") then
for _, particleData in ipairs(particleDatas) do
if im.Selectable1(particleData:getName()) then
@/lua/ge/extensions/editor/crawlEditor.lua
for _, trail in ipairs(allTrails) do
local updated = false
if objectType == "trail" then
for _, trail in ipairs(allTrails) do
if trail._filePath == oldFilePath then
elseif objectType == "path" then
for _, pathh in ipairs(allPaths) do
if pathh._filePath == oldFilePath then
elseif objectType == "boundary" then
for _, boundary in ipairs(allBoundaries) do
if boundary._filePath == oldFilePath then
elseif objectType == "startingPosition" then
for _, startingPosition in ipairs(allStartingPositions) do
if startingPosition._filePath == oldFilePath then
for _, filePath in ipairs(trailFiles) do
local trail = gameplay_crawl_saveSystem.getTrailById(filePath)
for _, missionDir in ipairs(missionDirs) do
local stat = FS:stat(missionDir)
for _, filePath in ipairs(pathFiles) do
local path = gameplay_crawl_saveSystem.getPathById(filePath)
for _, filePath in ipairs(boundaryFiles) do
local boundary = gameplay_crawl_saveSystem.getBoundaryById(filePath)
for _, filePath in ipairs(startingPositionFiles) do
local startingPosition = gameplay_crawl_saveSystem.getStartingPositionById(filePath)
local missionDirs = FS:findFiles(missionsPath, "*", 0, false, true)
for _, missionDir in ipairs(missionDirs) do
local stat = FS:stat(missionDir)
for _, missionName in ipairs(missions) do
local number = tonumber(string.match(missionName, "^(%d+)"))
for i, missionTrail in ipairs(missionTrails) do
if missionTrail == trail then
if type == "trail" then
for i, trail in ipairs(allTrails) do
if trail._filePath == filePath then
elseif type == "path" then
for i, path in ipairs(allPaths) do
if path._filePath == filePath then
elseif type == "boundary" then
for i, boundary in ipairs(allBoundaries) do
if boundary._filePath == filePath then
elseif type == "startingPosition" then
for i, startingPosition in ipairs(allStartingPositions) do
if startingPosition._filePath == filePath then
for _, path in ipairs(allPaths) do
if path._dirty then
for _, path in ipairs(missionPaths) do
if path._dirty then
for _, boundary in ipairs(allBoundaries) do
if boundary._dirty then
for _, boundary in ipairs(missionBoundaries) do
if boundary._dirty then
for _, startingPosition in ipairs(allStartingPositions) do
if startingPosition._dirty then
end
for idx, trail in ipairs(allTrails) do
im.PushID1("trail_" .. idx)
for idx, trail in ipairs(missionTrails) do
im.PushID1("mission_trail_" .. idx)
end
for idx, path in ipairs(allPaths) do
im.PushID1("path_" .. idx)
for idx, path in ipairs(missionPaths) do
im.PushID1("mission_path_" .. idx)
end
for idx, boundary in ipairs(allBoundaries) do
im.PushID1("boundary_" .. idx)
for idx, boundary in ipairs(missionBoundaries) do
im.PushID1("mission_boundary_" .. idx)
end
for idx, startingPosition in ipairs(allStartingPositions) do
im.PushID1("starting_position_" .. idx)
if selectedPath then
for _, trail in ipairs(allTrails) do
if trail.pathId == selectedPath._filePath then
if selectedBoundary then
for _, trail in ipairs(allTrails) do
if trail.boundaryId == selectedBoundary._filePath then
if selectedStartingPosition then
for _, trail in ipairs(allTrails) do
if trail.startingPositionId == selectedStartingPosition._filePath then
@/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/flowgraph/nodes/ui/endStats.lua
for i = old, new+1, -1 do
for _, p in ipairs(pinsPerStat) do
for _, lnk in pairs(self.graph.links) do
for i = old+1, new do
for _, p in ipairs(pinsPerStat) do
--direction, type, name, default, description, autoNumber
local stat = {}
for _, p in ipairs(pinsPerStat) do
stat[p[1]] = self.pinIn[p[1]..'_'..i].value
@/lua/ge/extensions/gameplay/rally/tools/rallyToolbox.lua
-- for some reason, have to copy the pos to a new vec3
for i, item in ipairs(aiDetailedPath) do
self.racePathAiPath[i] = vec3(item.pos)
-- -- for some reason, have to copy the pos to a new vec3
-- for i, pacenote in ipairs(pacenotes) do
-- local wpCs = pacenote:getCornerStartWaypoint()
for i, item in ipairs(route.path) do
self.routeWaypointsIndex[i] = item
if segments and segments[1] and not segments[1].missing and not segments[1]._rallyDebugColor then
for i, seg in ipairs(segments) do
-- Alternate debug color for each segment: orange for even, yellow for odd
-- if im.BeginCombo("Driveline Mode Override##drivelineMode", drivelineMode) then
-- for _, mode in ipairs(RallyEnums.drivelineModeNames) do
-- if im.Selectable1(mode, mode == drivelineMode) then
local pathnodes = rm:getRacePath().pathnodes.sorted
for i, pathnode in ipairs(pathnodes) do
local point = pathnode:getStaticRoutePoint()
local currSegs = race.states[rm.vehicleTracker:getVehicleId()].currentSegments
for i, segId in ipairs(currSegs) do
local seg = race.path.segments.objects[segId]
local spStopZone = nil
for _, sp in ipairs(rp.startPositions.sorted) do
if sp.name == "STOP_ZONE" or sp.name == "SS_stop_control" or sp.name == "TC_out" then
for i, pacenote in ipairs(dr:getPacenotes()) do
local pacenoteText = ''
-- if preRoutePoints then
-- for i, point in ipairs(preRoutePoints) do
-- local clr = rainbowColor(#preRoutePoints, i, 1)
-- local clr = cc.snaproads_clr_recce
-- for i, point in ipairs(reccePoints) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,2), 0.3, ColorF(clr[1],clr[2],clr[3],0.8))
-- local finalPreRouteInput = dr.finalPreRouteInput
-- for i, point in ipairs(finalPreRouteInput) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,2), 0.1, ColorF(0.5,0,0.5,0.8))
-- local debugPreMergePath = dr.routeStatic.debugPath
-- for i, point in ipairs(debugPreMergePath) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,1.5), 0.2, ColorF(1,0.5,0.5,0.8))
-- local debugPostMergePath = dr.routeStatic.debugPostMergePath
-- for i, point in ipairs(debugPostMergePath) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,2), 0.1, ColorF(0,0.5,0.5,0.8))
-- local debugMergePathSample = dr.routeStatic.debugMergePathSample
-- for i, point in ipairs(debugMergePathSample) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,2), 0.1, ColorF(0,1,0.5,0.8))
-- local debugPostFixStartEnd1 = dr.routeStatic.debugPostFixStartEnd1
-- for i, point in ipairs(debugPostFixStartEnd1) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,2.5), 0.05, ColorF(1,1,0.5,0.8))
-- local debugPostFixStartEnd2 = dr.routeStatic.debugPostFixStartEnd2
-- for i, point in ipairs(debugPostFixStartEnd2) do
-- debugDrawer:drawCylinder(point.pos, point.pos + vec3(0,0,3.0), 0.025, ColorF(0.75,1,0.5,0.8))
@/lua/ge/extensions/util/screenshotCreator.lua
table.sort(modelKeys)
for _,k in ipairs(modelKeys) do
local v = models[k]
if playerVehicle then
for _,v in ipairs(vehList) do
v[2][0] = v[1] == playerVehicle.JBeam
local s = ""
for _, r in ipairs(presetOutputDestinations) do
s = s .. r .. '\0'
local s = 'custom\0'
for _, r in ipairs(presetResolutions) do
s = s .. r[1] .. ' - ' .. r[2] .. ' x ' .. r[3] .. '\0'
-- check if custom resolution matches one of the presets, otherwise use custom
for i, r in ipairs(presetResolutions) do
if ctrls.currResolutionsPtr and ctrls.imageResolution[0] == r[2] and ctrls.imageResolution[1] == r[3] then
if im.SmallButton("Select All") then
for _,v in ipairs(vehList) do
v[2][0] = true
if im.SmallButton("Unselect All") then
for _,v in ipairs(vehList) do
v[2][0] = false
if im.SmallButton("Invert Selection") then
for _,v in ipairs(vehList) do
v[2][0] = not v[2][0]
if vehList then
for _,v in ipairs(vehList) do
if not v[2][0] then
if vehList then
for _,v in ipairs(vehList) do
if v[2][0] then
for _, mapName in ipairs(vehicleActionMaps) do
local map = scenetree.findObject(mapName)
im.TableNextColumn()
for _, data in ipairs(reviewData.configs) do
im.Text(data.vehName)
@/lua/ge/extensions/core/quickAccess.lua
tree.items = sortedItems
for _, value in ipairs(tree.items) do
if value.items then
if not menuTreeCopy or not menuTreeCopy[level] then return nil end
for _, actionInfo in ipairs(menuTreeCopy[level]) do
if actionInfo.uniqueID == uniqueID then return actionInfo end
end
for _, item in ipairs(menuTreeCopyForUI.items) do
table.insert(rootItems, item)
-- break out root menus
for _, item in ipairs(menuTreeCopyForUI.items[1].items) do
if validRoots[item.path] then
table.sort(recentActions, function(a, b) return a.timestamp > b.timestamp end)
for _, action in ipairs(recentActions) do
if filter and not string.find(action.level, filter) then
for i, category in ipairs(input_list) do
category.categoryOrder = category.categoryOrder or (1000 + i)
if not menuTreeCopy[prevLevel] then return false end
for _, item in ipairs(menuTreeCopy[prevLevel]) do
if item["goto"] == gotoLevel then return true end
-- find the first valid waypoint
for _, marker in ipairs(path) do
if marker.wp then
if not firstWpAdded then
for _, marker in ipairs(path) do
if marker.wp and startDist - marker.distToTarget > 25 then
for _, category in ipairs(sandboxCategories) do
local res = tableMerge(category, {level = '/root/sandbox/'})
-- if there are triggers by multiple vehicles nearby, add the name of the vehicle as well
for _, triggerEntry in ipairs(triggerEntries) do
if tableSize(vehIds) > 1 then
local positionedItems = {}
for _, item in ipairs(currentMenuItems) do
if item.position then
local occupiedSlots = {} -- Track occupied slots
for _, e in ipairs(currentMenuItems) do
if e.enabled == nil then e.enabled = true end
if tableIsEmpty(gaps) then
for _, e in ipairs(currentMenuItems) do
e.position = nil
local gapButtonSizes = {}
for i, gap in ipairs(gaps) do
gapButtonSizes[i] = slotSize
local buttonsToBePlaced = 0
for _, item in ipairs(currentMenuItems) do
if not item.position then
-- calculate how many buttons can be placed in each gap
for i, gap in ipairs(gaps) do
local maxButtonsInGap = math.floor(gap.size / gapButtonSizes[i])
-- find gap where adding a button causes smallest change to button sizes
for i, gap in ipairs(gaps) do
local newButtonSize = gap.size / (gap.fittingButtonsAmount + 1)
-- try to find the first fitting empty space for each leftover button
for _, e in ipairs(currentMenuItems) do
if not e.position then
-- Find first gap that can fit another button
for gapIndex, gap in ipairs(gaps) do
if gap.fittingButtonsAmount > 0 then
for _, item in ipairs(categoryItems or {}) do
local id = item["goto"]:match("^/[^/]+/" .. currentSecondLevelId .. "/([^/]+)/")
local breadcrumbs = {}
for _, path in ipairs(levelPaths) do
-- remove the last level from path to get parent path
if menuItems then
for _, item in ipairs(menuItems) do
if (path == "/root/playerVehicle/" and item["goto"] == playerVehicleDefaultPath) or
local rootItems = menuTreeCopy["/root/"] or {}
for _, item in ipairs(rootItems) do
if item["goto"] and item["goto"]:match("^/root/" .. firstSegment .. "/") then
for _, e in ipairs(entries) do
if type(e) == 'table' then
for _, menuItem in ipairs(menuItems) do
if not (menuItem["goto"] or menuItem.generator) then
for _, menuItem in ipairs(menuItems) do
if menuItem["goto"] and not isMenuEmpty(menuItem["goto"]) then
for path, items in pairs(menuTreeCopy) do
for _, e in ipairs(items) do
if type(e) == "table" then
local isEmpty = true
for _, item in ipairs(items) do
if not item.ignoreForCheckingIfMenuIsEmpty then
local skipActions = {}
for _, item in ipairs(dynamicItems or {}) do
if item.dynamicSlotSetting.mode == "uniqueAction" then
local actions = {}
for i, action in ipairs(recentActions[category] or {}) do
action._sortIdx = i
local result = {}
for _, action in ipairs(actions) do
-- Check if action is available (exists in menuTreeCopy)
local skip = false
for _, skipAction in ipairs(skipActions) do
if (skipAction.uniqueID == compare.uniqueID and skipAction.level == compare.level) then
if menuTreeCopy[k] then
for _, item in ipairs(vehicleLevel) do
table.insert(menuTreeCopy[k], item)
local allLevels = getAllLevels(levelPath)
for i, subLevel in ipairs(allLevels) do
if i > 1 then
local recentActionItems = 0
for _, item in ipairs(tree or {}) do
if item.dynamicSlot then
for _, item in ipairs(dynamicItems) do
item.marking = "invisible"
for _, item in ipairs(menuTreeCopy[currentLevel] or {}) do
table.insert(currentMenuItems, item)
for _, category in ipairs(recentActionCategories) do
local categoryActions = recentActions[category]
dump("All")
for i, item in ipairs(recent) do
local actionInfo = getActionInfo(item.level, item.uniqueID)
@/lua/common/jbeam/variables.lua
if not tableIsEmpty(slotVars) then
for k, v in ipairs(slotVars) do
succeed[k] = expressionParser.parseSafe(v, vars)
local destEnd = #dest
for _, v in ipairs(src) do
if dict[v.name] then
@/lua/common/introspection.lua
local built_in_modules = { "table", "math", "string", "coroutine", "os", "io", "debug", "package" }
for _, module_name in ipairs(built_in_modules) do
local module = _G[module_name]
@/lua/ge/extensions/editor/api/roadRiver.lua
for index, node in ipairs(nodes) do
addRoadNode(road:getID(), {pos = node.pos, width = node.width, index = index-1})
for index, node in ipairs(nodes) do
addMeshNode(mesh:getID(), {pos = node.pos, width = node.width, depth = node.depth, normal = node.normal, index = index-1})
-- Initialize the road vertices
for _, name in ipairs(scenetree.findClassObjects('DecalRoad')) do
local road = scenetree.findObject(name)
@/lua/ge/extensions/editor/util/vehicleFilterUtil.lua
local cleaned = {}
for _, filter in ipairs(filterArray) do
local cleanedFilter = cleanFilter(filter)
local cleaned = {}
for _, setting in ipairs(probabilitySettings) do
local cleanedSetting = deepcopy(setting)
for _, vehicleInfo in ipairs(vehicleInfos) do
local modelKey = vehicleInfo.model_key
local passesWhiteList = false
for _, whiteListFilter in ipairs(filterObj.whiteList) do
if configListGenerator.doesVehiclePassFilter(vehicleInfo, {whiteList = whiteListFilter}) then
if filterObj.blackList and #filterObj.blackList > 0 then
for _, blackListFilter in ipairs(filterObj.blackList) do
if configListGenerator.doesVehiclePassFilter(vehicleInfo, {whiteList = blackListFilter}) then
if baseFilter.whiteList then
for _, filter in ipairs(baseFilter.whiteList) do
local configListFilter = convertSingleFilterToConfigListFormat(filter, filterByProp)
if baseFilter.blackList then
for _, filter in ipairs(baseFilter.blackList) do
local configListFilter = convertSingleFilterToConfigListFormat(filter, filterByProp)
local filteredVehicles = {}
for _, vehicle in ipairs(eligibleVehicles) do
if doesVehiclePassFilterObject(vehicle, baseFilterObj) then
local subFilters = {}
for _, setting in ipairs(probabilitySettings) do
-- Convert filters in this setting to whiteList/blackList arrays
if setting.whiteList then
for _, filter in ipairs(setting.whiteList) do
local configListFilter = convertSingleFilterToConfigListFormat(filter, filterByProp)
if setting.blackList then
for _, filter in ipairs(setting.blackList) do
local configListFilter = convertSingleFilterToConfigListFormat(filter, filterByProp)
local filteredVehicles = {}
for _, vehicle in ipairs(eligibleVehicles) do
if doesVehiclePassFilterObject(vehicle, baseFilterObj) then
local totalWeight = 0
for _, subFilter in ipairs(subFilters) do
totalWeight = totalWeight + (subFilter.probability or 1.0)
for i, subFilterData in ipairs(subFilters) do
local weight = subFilterData.probability or 1.0
if baseFilterConverted.whiteList then
for _, filterObj in ipairs(baseFilterConverted.whiteList) do
table.insert(mergedWhiteList, filterObj)
if baseFilterConverted.blackList then
for _, filterObj in ipairs(baseFilterConverted.blackList) do
table.insert(mergedBlackList, filterObj)
if subFilterData.filter.whiteList then
for _, filterObj in ipairs(subFilterData.filter.whiteList) do
table.insert(mergedWhiteList, filterObj)
if subFilterData.filter.blackList then
for _, filterObj in ipairs(subFilterData.filter.blackList) do
table.insert(mergedBlackList, filterObj)
local filteredVehicles = {}
for _, vehicle in ipairs(eligibleVehicles) do
if doesVehiclePassFilterObject(vehicle, mergedFilterObj) then
local totalPop = 0
for _, veh in ipairs(available) do
totalPop = totalPop + (veh[popAttribute] or 1)
local popCounter = 0
for idx, veh in ipairs(available) do
popCounter = popCounter + (veh[popAttribute] or 1)
-- Add to the combined list
for _, vehicle in ipairs(selectedVehicles) do
table.insert(allRandomVehicles, vehicle)
-- Scan models first (for model-level properties like Country, Brand, Body Style, etc.)
for _, model in ipairs(modelList) do
for _, propName in pairs(filtersWhiteList) do
else
for _, key in ipairs(tableKeysSorted(filterByProp[propName])) do
table.insert(filterData.options, key)
im.Text(" WhiteList:")
for filterIdx, filter in ipairs(e.baseFilter.whiteList) do
im.PushID1("baseFilter"..filterIdx..e._id)
local filterUiInfo = nil
for _, uiInfo in ipairs(e.filterUiData) do
if uiInfo.propName == filter.propName then
filter.values = {}
for _, option in ipairs(filterUiInfo.options) do
filter.values[option] = false
if im.BeginCombo("##combo", displayText) then
for _, option in ipairs(filterUiInfo.options) do
local selected = filter.values[option] or false
if im.BeginCombo("+ Add to WhiteList##addBaseWhiteList"..e._id, "Add Filter...") then
for _, filterUiInfo in ipairs(e.filterUiData) do
if im.Selectable1(filterUiInfo.propName) then
else
for _, option in ipairs(filterUiInfo.options) do
newFilter.values[option] = false
im.Text(" BlackList:")
for filterIdx, filter in ipairs(e.baseFilter.blackList) do
im.PushID1("baseBlackFilter"..filterIdx..e._id)
local filterUiInfo = nil
for _, uiInfo in ipairs(e.filterUiData) do
if uiInfo.propName == filter.propName then
filter.values = {}
for _, option in ipairs(filterUiInfo.options) do
filter.values[option] = false
if im.BeginCombo("##combo", displayText) then
for _, option in ipairs(filterUiInfo.options) do
local selected = filter.values[option] or false
if im.BeginCombo("+ Add to BlackList##addBaseBlackList"..e._id, "Add Filter...") then
for _, filterUiInfo in ipairs(e.filterUiData) do
if im.Selectable1(filterUiInfo.propName) then
else
for _, option in ipairs(filterUiInfo.options) do
newFilter.values[option] = false
-- Display each probability setting
for settingIdx, setting in ipairs(e.probabilitySettings) do
im.Separator()
im.Text(" WhiteList:")
for filterIdx, filter in ipairs(setting.whiteList) do
im.PushID1("filter"..filterIdx)
local filterUiInfo = nil
for _, uiInfo in ipairs(e.filterUiData) do
if uiInfo.propName == filter.propName then
filter.values = {}
for _, option in ipairs(filterUiInfo.options) do
filter.values[option] = false
if im.BeginCombo("##combo", displayText) then
for _, option in ipairs(filterUiInfo.options) do
local selected = filter.values[option] or false
if im.BeginCombo("+ Add to WhiteList##addWhiteList"..settingIdx, "Add Filter...") then
for _, filterUiInfo in ipairs(e.filterUiData) do
if im.Selectable1(filterUiInfo.propName) then
else
for _, option in ipairs(filterUiInfo.options) do
newFilter.values[option] = false
im.Text(" BlackList:")
for filterIdx, filter in ipairs(setting.blackList) do
im.PushID1("blackFilter"..filterIdx)
local filterUiInfo = nil
for _, uiInfo in ipairs(e.filterUiData) do
if uiInfo.propName == filter.propName then
filter.values = {}
for _, option in ipairs(filterUiInfo.options) do
filter.values[option] = false
if im.BeginCombo("##combo", displayText) then
for _, option in ipairs(filterUiInfo.options) do
local selected = filter.values[option] or false
if im.BeginCombo("+ Add to BlackList##addBlackList"..settingIdx, "Add Filter...") then
for _, filterUiInfo in ipairs(e.filterUiData) do
if im.Selectable1(filterUiInfo.propName) then
else
for _, option in ipairs(filterUiInfo.options) do
newFilter.values[option] = false
e._cachedVehicleByModelKey = {}
for _, v in ipairs(e._cachedVehicleList.vehicles) do
e._cachedVehicleByModelKey[v.model.key] = v
-- Add filtered configs
for _, vehicleModel in ipairs(e.cachedVehicleOptions) do
local model = vehicleModel.model
local model = vehicleModel.model
for _, configInfo in ipairs(vehicleModel.configs) do
local config = configInfo.config
-- Add manual additions (ensure they have nice names)
for _, manualConfig in ipairs(e.manualAdditions) do
local model = manualConfig.model
else
for i, cfg in ipairs(finalConfigs) do
im.Text(cfg.model .. " / " .. (cfg.name or cfg.config))
local foundManual = false
for j, manualCfg in ipairs(e.manualAdditions) do
if manualCfg.model == cfg.model and manualCfg.config == cfg.config then
if im.BeginCombo("Model##"..e._id.."addModel", selectedModel) then
for _, modelKey in ipairs(allModels) do
if im.Selectable1(modelKey, modelKey == selectedModel) then
if im.BeginCombo("Config##"..e._id.."addConfig", selectedConfig) then
for _, configKey in ipairs(configs) do
if im.Selectable1(configKey, configKey == selectedConfig) then
local alreadyExists = false
for _, manualCfg in ipairs(e.manualAdditions) do
if manualCfg.model == selectedModel and manualCfg.config == selectedConfig then
@/lua/ge/extensions/flowgraph/nodes/macro/integrated.lua
end
for _, name in ipairs(self.targetGraph.variables.sortedVariableNames) do
local full = self.targetGraph.variables:getFull(name)
@/lua/ge/extensions/gameplay/rally/trafficExclusion.lua
for _, mission in ipairs(missions) do
if mission.missionType == "rallyStage" then
local zones1 = createZonesForRallyStage(mission)
for _, z in ipairs(zones1) do table.insert(zones, z) end
elseif mission.missionType == "rallyRoadSection" then
local zones1 = createZonesForRallyRoadSection(mission)
for _, z in ipairs(zones1) do table.insert(zones, z) end
else
@/lua/ge/extensions/editor/dynamicDecals/colorPresets.lua
local uiIconSize = (math.ceil(im.GetFontSize()) + 2 * im.GetStyle().FramePadding.y) * im.uiscale[0]
for k, color in ipairs(data) do
if checkFilter(color) then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/getTrafficState.lua
self.pinOut.state.value = gameplay_traffic.getState()
for _, s in ipairs(states) do
self.pinOut[s].value = self.pinOut.state.value == s
@/lua/ge/extensions/editor/meshEditor.lua
local mesh = scenetree.findObjectById(actionData.meshID)
for _, nodeID in ipairs(actionData.nodeIDs) do
editor.setNodeWidth(mesh, nodeID, actionData.oldWidths[nodeID])
local mesh = scenetree.findObjectById(actionData.meshID)
for _, nodeID in ipairs(actionData.nodeIDs) do
editor.setNodeWidth(mesh, nodeID, actionData.newWidths[nodeID])
local mesh = scenetree.findObjectById(actionData.meshID)
for _, nodeID in ipairs(actionData.nodeIDs) do
editor.setNodePosition(mesh, nodeID, actionData.oldPositions[nodeID])
local mesh = scenetree.findObjectById(actionData.meshID)
for _, nodeID in ipairs(actionData.nodeIDs) do
editor.setNodePosition(mesh, nodeID, actionData.newPositions[nodeID])
local mesh = scenetree.findObjectById(actionData.meshID)
for _, nodeID in ipairs(actionData.nodeIDs) do
mesh:setNodeNormal(nodeID, actionData.oldNormals[nodeID])
local mesh = scenetree.findObjectById(actionData.meshID)
for _, nodeID in ipairs(actionData.nodeIDs) do
mesh:setNodeNormal(nodeID, actionData.newNormals[nodeID])
local firstID
for _, nodeInfo in ipairs(actionData.nodeInfos) do
local id = editor.addMeshNode(actionData.meshID, nodeInfo)
local nodeInfos = {}
for id, nodeInfo in ipairs(editor.getNodes(selectedMesh)) do
if selectedNodes[id-1] then
-- Loop through all the nodes
for id, node in ipairs(nodes) do
insertNode(originalMesh, node.pos, node.width, node.depth, node.normal, u_32_max_int)
-- Loop through all the nodes
for id, node in ipairs(nodes) do
if (id - 1) == actionData.nodeID then
for index, node in ipairs(nodes) do
local pos = node.pos
local minNodeDist = u_32_max_int
for i, node in ipairs(editor.getNodes(selectedMesh)) do
local distNodeToCam = (node.pos - camPos):length()
if (fieldName == "segmentLength" or fieldName == "subdivideLength") then
for _, id in ipairs(selectedIds) do
local object = scenetree.findObjectById(id)
@/lua/ge/extensions/editor/crawlEditor/missionPortTool.lua
for i, vertexPos in ipairs(zone.vertices) do
local pos = vec3(vertexPos[1], vertexPos[2], vertexPos[3])
if raceData.startPositions then
for i, pathnode in ipairs(raceData.pathnodes) do
if pathnode.recovery and pathnode.recovery ~= -1 then
-- A pathnode is a recovery checkpoint if it has a recovery field pointing to a startPosition
for i, pathnode in ipairs(raceData.pathnodes) do
local node = {
-- Find startPosition with matching oldId
for _, sp in ipairs(raceData.startPositions) do
if sp.oldId == defaultStartOldId then
for _, missionDir in ipairs(missionDirs) do
local stat = FS:stat(missionDir)
for _, levelName in ipairs(allLevels) do
local missionsPath = "/gameplay/missions/" .. levelName .. "/crawl/"
for _, missionDir in ipairs(missionDirs) do
local stat = FS:stat(missionDir)
for i, mission in ipairs(missionsList) do
im.PushID1(tostring(i))
@/lua/ge/extensions/career/modules/valueCalculator.lua
local function isPartException(partPath)
for _, exception in ipairs(repairExceptions) do
if string.find(partPath, exception) then
@/lua/ge/extensions/career/modules/tether.lua
local function onUpdate()
for _, t in ipairs(tethers) do
if not t.remove and t.checkfun(t) then
local idsToRemove = {}
for id, t in ipairs(tethers) do
if t.remove then
-- remove from the back to avoid ids moving
for _, id in ipairs(arrayReverse(idsToRemove)) do
table.remove(tethers, id)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
@/lua/ge/extensions/flowgraph/nodes/logic/edgeDetect.lua
else
for i, v in ipairs(self.pinIn.signal.value) do
if type(v) == "number" and type(self.lastSignal[i]) == "number" and type(self.pinIn.threshold.value) == "number" then
@/lua/ge/extensions/flowgraph/nodes/ui/threeElementSelect.lua
}
for _, i in ipairs({1,2,3}) do
local veh = {}
local veh = {}
for _, key in ipairs({"image","name","desc"}) do
veh[key] = self.pinIn["veh"..i..key].value
@/lua/ge/extensions/tech/techCore.lua
local scenarioList = scenariosLoader.getList(nil, true)
for _, v in ipairs(scenarioList) do
local scenarioPath = nil
local captureFilename = nil
for i, v in ipairs(cmdArgs) do
if v == '-rport' then
local roads = scenetree.findClassObjects('DecalRoad')
for idx, roadName in ipairs(roads) do
local road = scenetree.findObject(roadName)
local roads = scenetree.findClassObjects('DecalRoad')
for idx, roadName in ipairs(roads) do
local road = scenetree.findObject(roadName)
roadData.edges = {}
for i, e in ipairs(road:getEdgesTable()) do
local edge = {
local edges = {}
for i, e in ipairs(road:getEdgesTable()) do
local edge = {
local list = {}
for idx, object in ipairs(objects) do
object = scenetree.findObject(object)
local ids = {}
for idx, participant in ipairs(participants) do
local veh = scenetree.findObject(participant)
local levelSet = {}
for _, level in ipairs(levels) do
levelSet[level] = true
-- rename the created meshes so multiple trackbuilder mesh names don't collide
for _, objName in ipairs(scenetree.findClassObjects("ProceduralMesh")) do
if string.find(objName, "procMesh") and not string.find(objName, ".json") 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
for _, v in ipairs(getAllVehicles()) do
if v:getName() == request.leaderID then
@/lua/ge/extensions/core/highscores.lua
for i,v in ipairs(scores) do
v.place = i
local newIndex = -1
for k,v in ipairs(currentHighscores) do
if v == record then newIndex = k end
@/lua/ge/extensions/career/modules/partInventory.lua
local currentNode = tree
for _, segment in ipairs(segments) do
if currentNode.children and currentNode.children[segment] then
local total = 0
for _, partId in ipairs(partIds) do
local part = partInventory[partId]
Engine.Audio.playOnce('AudioGui','event:>UI>Career>Buy_01')
for _, partId in ipairs(partIds) do
partInventory[partId] = nil
local newParts = generateAndGetPartsFromVehicle(inventoryId)
for _, part in ipairs(newParts) do
addPartToInventory(part)
@/lua/ge/extensions/editor/crawlEditor/boundaries.lua
elseif data.field == 'vertices' then
for i, vertex in ipairs(data.old) do
if boundary.vertices[i] then
elseif data.field == 'vertices' then
for i, vertex in ipairs(data.new) do
if boundary.vertices[i] then
local allBoundaries = editor_crawlEditor.getAllBoundaries()
for i, b in ipairs(allBoundaries) do
if b == boundary then
for i, boundary in ipairs(allBoundaries) do
local isSelected = (i == selection.index)
local verticesToDelete = {}
for i, vertex in ipairs(boundary.vertices) do
if vertex.selected then
for i, vertex in ipairs(boundary.vertices) do
editor.addRoadNode(decalRoad:getID(), {
local selected = false
for _, vertex in ipairs(self.currentVertices) do
if vertex.index == idx then
local objs = {}
for i, v in ipairs(self.boundary.vertices) do
local nextIdx = v.next or (i == #self.boundary.vertices and 1 or i + 1)
local objects = {}
for i, vertex in ipairs(self.boundary.vertices) do
table.insert(objects, {
local centroid = vec3(0, 0, 0)
for _, vertex in ipairs(self.currentVertices) do
centroid = centroid + vertex.pos
self._prevVerticesPos = {}
for _, vertex in ipairs(self.currentVertices) do
self._prevVerticesPos[vertex.index] = deepcopy(vertex.pos)
if #self.currentVertices > 0 then
for i, vertex in ipairs(self.currentVertices) do
self.boundary.vertices[vertex.index].pos = self.boundary.vertices[vertex.index].pos + posOffset
local centroid = vec3(0, 0, 0)
for _, vertex in ipairs(self.currentVertices) do
centroid = centroid + vertex.pos
for i, vertex in ipairs(self.currentVertices) do
local gizmoTransform = editor.getAxisGizmoTransform()
if self.snapToTerrain then
for _, vertex in ipairs(self.currentVertices) do
local newPos = self:dropToTerrain(vertex.pos)
for _, vertex in ipairs(self.currentVertices) do
oldPositions[vertex.index] = self._prevVerticesPos[vertex.index]
local remove
for i, name in ipairs(fields.names) do
if fields.types[name] == 'string' then
@/lua/ge/extensions/editor/forestEditor.lua
for _, item in ipairs(editor.selection.forestItem) do
local obj = var.forestData:getItem(item:getKey(), item:getPosition())
if editor.selection and editor.selection.forestItem then
for _, item in ipairs(editor.selection.forestItem) do
editor.setForestItemSelected(var.forestData, item:getKey(), false)
if not addToSelection and editor.selection and editor.selection.forestItem then
for _, item in ipairs(editor.selection.forestItem) do
editor.setForestItemSelected(var.forestData, item:getKey(), false)
for _, item in ipairs(forestItems) do
editor.setForestItemSelected(var.forestData, item:getKey(), true)
local function addItemsActionUndo(actionData)
for _, item in ipairs(actionData.items) do
editor.removeForestItem(var.forestData, item)
local function addItemsActionRedo(actionData)
for _, item in ipairs(actionData.items) do
editor.addForestItem(var.forestData, item)
local function setItemTransformUndo(actionData)
for index, item in ipairs(actionData.items) do
actionData.items[index] = editor.updateForestItem(var.forestData, item:getKey(), item:getPosition(), item:getData(), editor.tableToMatrix(actionData.oldTransforms[index]), actionData.oldScales[index], item:getUid())
local function setItemTransformRedo(actionData)
for index, item in ipairs(actionData.items) do
actionData.items[index] = editor.updateForestItem(var.forestData, item:getKey(), item:getPosition(), item:getData(), editor.tableToMatrix(actionData.newTransforms[index]), actionData.newScales[index], item:getUid())
local function selectToolByName(toolName)
for _, tool in ipairs(var.tools) do
if tool.label == toolName then
for _, brush in ipairs(var.brushes) do
if brush.label == toolName then
else
for k, brush in ipairs(var.selectedForestBrushes) do
brush.selected = false
else
for i, brush in ipairs(var.selectedForestBrushes) do
if brush.id == item.id then
else
for _, mesh in ipairs(var.selectedForestItemDatas) do
mesh.selected = false
else
for i, itemData in ipairs(var.selectedForestItemDatas) do
if itemData.id == item.id then
-- Remove brush element from the brushes element list
for i, element in ipairs(item.parentBrush.elements) do
if element.id == item.id then
for i, brush in ipairs(var.forestBrushes) do
if brush.id == item.id then
for i, otherItem in ipairs(var.forestItemData) do
if item.id == otherItem.id then
end
for _, fb in ipairs(var.forestBrushes) do
if fb.internalName == name then
local objectBBs = {}
for index, item in ipairs(editor.selection.forestItem) do
table.insert(originalTransforms, item:getTransform())
local newTransforms = editor.getTransformsGizmoTranslate(forestTable, objectHeights)
for index, transform in ipairs(newTransforms) do
local item = editor.selection.forestItem[index]
elseif editor.getAxisGizmoMode() == editor.AxisGizmoMode_Scale then
for index, obj in ipairs(editor.selection.forestItem) do
local delta = vec3(worldEditorCppApi.getAxisGizmoScaleOffset())
local newScales = {}
for index, item in ipairs(editor.selection.forestItem) do
table.insert(newTransforms, editor.matrixToTable(item:getTransform()))
local forestItem = nil
for _, item in ipairs(var.forestData:getItems()) do
if item:getKey() == actionData.itemKey then
local forestItem = nil
for _, item in ipairs(var.forestData:getItems()) do
if item:getKey() == actionData.itemKey then
if im.Button("Select ForestItemData", im.ImVec2(im.GetContentRegionAvailWidth(), 0)) then
for _, forestItemData in ipairs(var.forestItemData) do
local forestItemDataId = item:getData():getID()
local objNames = scenetree.findClassObjects("ForestBrushElement")
for _, id in ipairs(objNames) do
local obj = scenetree.findObject(id)
objNames = scenetree.findClassObjects("ForestBrush")
for _, id in ipairs(objNames) do
local obj = scenetree.findObject(id)
var.forestItemData = {}
for k, forestItemDataId in ipairs(forestItemDataNames) do
local cobj = scenetree.findObject(forestItemDataId)
local forestBrushElementIds = scenetree.findClassObjects("ForestBrushElement")
for _, id in ipairs(forestBrushElementIds) do
local fbe = scenetree.findObject(id)
-- draw toolbar icons for the tools
for _, tool in ipairs(var.tools) do
toolbarToolIcon(tool)
for _, tool in ipairs(var.tools) do
if tool.type == var.enum_toolType.transformTool then
-- draw toolbar icons for the brushes
for _, brush in ipairs(var.brushes) do
toolbarToolIcon(brush)
if forestBrush.open == true then
for _, element in ipairs(forestBrush.elements) do
im.SetCursorPosX(cursorPos.x + var.style.FramePadding.x - var.fontSize)
if var.forestBrushes then
for _, brush in ipairs(var.forestBrushes) do
forestBrushTreeNode(brush)
if im.BeginChild1("MeshesChild") then
for _, item in ipairs(var.forestItemData) do
forestItemDataTreeNode(item)
local forestBrushElements = {}
for k, item in ipairs(var.selectedForestBrushes) do
if item.type == var.enum_forestObjType.forestBrush then
if item.type == var.enum_forestObjType.forestBrush then
for k, element in ipairs(item.elements) do
forestBrushElements[element.id] = element.internalName
if var.lassoSelectMode == var.enum_lassoSelectMode.polyline then
for _, node in ipairs(var.lassoPLNodes) do
table.insert(lassoNodes2D, Point2F(node.pos.x, node.pos.y))
else
for _, node in ipairs(var.lassoFHLineSegments) do
table.insert(lassoNodes2D, Point2F(node.x, node.y))
if var.lassoSelectMode == var.enum_lassoSelectMode.polyline then
for index, node in ipairs(var.lassoPLNodes) do
local distNodeToCam = (node.pos - camPos):length()
for index, node in ipairs(var.lassoPLNodes) do
local nodeColor = roadRiverGui.highlightColors.node
for _, node in ipairs(var.lassoPLNodes) do
node.isUpdated = false
local lineWidth = editor.getPreference("gizmos.general.lineThicknessScale") * 4
for index, segmentPos in ipairs(var.lassoFHLineSegments) do
if index == 1 and not var.lassoSelectionEnded then
local before = var.forestData:getItemsCircle(hit.pos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(before) do
deletedItems[item:getKey()] = item
local items = var.forestData:getItemsCircle(hit.pos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(items) do
snappedItems[item:getKey()] = editor.matrixToTable(item:getTransform())
local after = var.forestData:getItemsCircle(hit.pos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(after) do
if deletedItems[item:getKey()] then
local after = var.forestData:getItemsCircle(lastHitPos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(after) do
if deletedItems[item:getKey()] then
local before = var.forestData:getItemsCircle(hit.pos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(before) do
deletedItems[item:getKey()] = item
local items = var.forestData:getItemsCircle(hit.pos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(items) do
if not snappedItems[item:getKey()] then
forest:disableCollision()
for _, item in ipairs(newItems) do
local pos = vec3(item:getPosition())
local after = var.forestData:getItemsCircle(lastHitPos, editor.getPreference("forestEditor.general.brushSize") / 2)
for _, item in ipairs(after) do
if deletedItems[item:getKey()] then
local itemsTbl = {}
for _, item in ipairs(items) do
newTransforms[item:getKey()] = editor.matrixToTable(item:getTransform())
if var.selectedTab == var.enum_tabType.brushes then
for k, item in ipairs(var.selectedForestBrushes) do
objectHistoryActions.deleteObjectWithUndo(item.id)
else
for k, item in ipairs(var.selectedForestItemDatas) do
objectHistoryActions.deleteObjectWithUndo(item.id)
local newItems = {}
for i, item in ipairs(items) do
newItems[i] = var.forestData:createNewItem(item:getData(), item:getTransform(), item:getScale())
table.clear(copyItemsArray)
for i, item in ipairs(editor.selection.forestItem) do
copyItemsArray[i] = {itemDataId = item:getData():getID(), transform = editor.matrixToTable(item:getTransform()), scale = item:getScale()}
local newItems = {}
for i, item in ipairs(copyItemsArray) do
newItems[i] = var.forestData:createNewItem(scenetree.findObjectById(item.itemDataId), editor.tableToMatrix(item.transform), item.scale)
for i, dbName in ipairs(dataBlockNames) do
if im.ImGuiTextFilter_PassFilter(dataBlockNameFilter, dbName) then
for _, item in ipairs(var.forestItemData) do
local obj = scenetree.findObjectById(item.id)
@/lua/ge/extensions/editor/missionEditor/startTrigger.lua
if im.BeginCombo("##levelCombo", self.fields.levelName) then
for _, lvl in ipairs(self.sortedLevels) do
if im.Selectable1(lvl.value, lvl.value == self.mission.startTrigger.level) then
if im.BeginCombo("##levelCombo", "...") then
for _, lvl in ipairs(self.sortedLevels) do
if im.Selectable1(lvl.value, lvl.value == self.mission.startTrigger.level) then
if im.BeginCombo("##levelCombo", "...") then
for _, lvl in ipairs(self.sortedLevels) do
if im.Selectable1(lvl.value, lvl.value == self.mission.startTrigger.level) then
self.sortedLevels = {}
for _, lvl in ipairs(levels) do
table.insert(self.sortedLevels, {value = lvl, name = "displayed name"})
if im.BeginCombo('##startTrigger', self.mission.startTrigger.type) then
for _, stType in ipairs(startTriggersSorted) do
if im.Selectable1(stType, stType == self.mission.startTrigger.type) then
@/lua/ge/extensions/editor/meshSpline.lua
local validCtr = 0
for _, objId in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(objId)
@/lua/common/jbeam/links.lua
if vehicle[sectionName] ~= nil then
for tKey, tValue in ipairs(rowValue) do
if vehicle[sectionName][tValue] ~= nil then
--]]
for tKey, tValue in ipairs(cellValue) do
if vehicle[sectionName][tValue] ~= nil then
-- play journal
for _, val in ipairs(journal) do
val[1][val[2]] = val[3]
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veNodeTriSelfCollisionDetector.lua
jbeamTableSchema.processTableWithSchemaDestructive(couplerNodesCopy, newCouplerNodePairs)
for _, couplerNodePair in ipairs(newCouplerNodePairs) do
couplerNodes[couplerNodePair.cid1] = true
@/lua/console/bananabench.lua
local vehicles = {}
for _, v in ipairs(FS:findFiles('/vehicles', '*', 0, false, true)) do
if v ~= '/vehicles/common' then
@/lua/common/testFramework/JUnitXMLWriter.lua
-- Add test cases
for _, result in ipairs(testResults) do
local testcase = {
@/lua/ge/extensions/career/modules/delivery/parcelManager.lua
end
for _, cargo in ipairs(allCargo) do
if cargo.id == cargoId then
local ret = {}
for _, cargo in ipairs(allCargo) do
if cargo._transientMove then
local moveIdx = -1
for i, move in ipairs(transientMoves) do
if move.cargoId == cargoId then
table.clear(transientMoves)
for _, cargo in ipairs(allCargo) do
cargo._transientMove = nil
local hasMergeableCargo = false
for _, move in ipairs(transientMoves) do
local cargo = M.getCargoById(move.cargoId)
if hasMergeableCargo then
for _, movedCargo in ipairs(movedCargo) do
for _, cargo in ipairs(allCargo) do
for _, movedCargo in ipairs(movedCargo) do
for _, cargo in ipairs(allCargo) do
if cargo.merge and movedCargo.merge
local ret = {}
for _, cargo in ipairs(allCargo) do
if cargo._transientMove and M.sameLocation(cargo._transientMove.targetLocation, targetLocation) then
local function onTrailerAttached(objId1, objId2)
for _, cargo in ipairs(allCargo) do
if cargo.location and cargo.location.vehId then
--[[
for _, cargo in ipairs(allCargo) do
if cargo.transient then
local ret = {}
for _, cargo in ipairs(allCargo) do
if filter(cargo, ...) then
local ret = {}
for _, cargo in ipairs(allCargo) do
if M.sameLocation(cargo.location, loc) then
local ret = {}
for _, cargo in ipairs(allCargo) do
if M.sameLocation(cargo.location, loc) and cargo.offerExpiresAt > dGeneral.time() then
local ret = {}
for _, cargo in ipairs(allCargo) do
if M.sameLocation(cargo.location, loc)
local ret = {}
for _, cargo in ipairs(allCargo) do
if cargo.location.type == "facilityParkingspot" and cargo.location.facId == facId
local ret = {}
for _, cargo in ipairs(allCargo) do
if cargo.destination.facId == facId
local ret = {}
for _, cargo in ipairs(allCargo) do
if M.sameLocation(cargo.location, cargo.origin)
local ret = {}
for _, cargo in ipairs(allCargo) do
if cargo.location.type == "vehicle" or (includeTransient and cargo._transientMove) then
local function getCargoById(cargoId)
for _, c in ipairs(allCargo) do
if c.id == cargoId then
-- check modifiers adjustment on rewards
for _,mod in ipairs(cargo.modifiers or {}) do
if mod.type == "timed" then
-- compute final adjusted rewards
for _, bd in ipairs(breakdown) do
for key, amount in pairs(bd.rewards) do
local cargoByGroupId = {}
for _, c in ipairs(cargo) do
local gId = string.format("%d-%d", c.groupId, c.loadedAtTimeStamp or -1)
--if secondsChanged then print("SC") end
for _,cargo in ipairs(allCargo) do
if cargo.location.type == "vehicle" then
if cargo.location.type == "vehicle" then
for _,mod in ipairs(cargo.modifiers or {}) do
if mod.type == "timed"then
local deletedCount = 0
for _, cargo in ipairs(allCargo) do
if cargo.location.type == "delete"
log("I","",string.format("Reached tier %d of delivery. Increasing money rewards from %0.2f to %0.2f", tier, prevMult, nextMult))
for _, cargo in ipairs(allCargo) do
if cargo.rewards and cargo.rewards.money then
@/lua/common/jbeam/sections/meshs.lua
vehicleObj:clearResourceSearchPath()
for _, d in ipairs(vehicle.directoriesLoaded or {}) do
vehicleObj:addResourceSearchPath(d)
@/lua/common/jbeam/optimization.lua
-- nodes are a special kind
for _, key in ipairs(sortedNodeKeys) do
local node = nodes[key]
-- add non collidable nodes
for _, node in ipairs(nonCollidableNodes) do
node.cid = maxID
-- put non fixed nodes at the end
for _, node in ipairs(nonFixedNodes) do
node.cid = maxID
local vkeys = tableKeysSorted(vehicle)
for _, keyEntry in ipairs(vkeys) do
local entry = vehicle[keyEntry]
tableKeysSorted(entry, ekeys)
for _, rowKey in ipairs(ekeys) do
entry[rowKey].cid = maxID
@/lua/ge/extensions/gameplay/rally/audioManager.lua
for _, audioObj in ipairs(audioObjs) do
self:_enqueueAudioObj(audioObj, addToFront)
@/lua/ge/extensions/editor/sitesEditor/zones.lua
local selected = false
for _, vertex in ipairs(self.currentVertices) do
if vertex.index == idx then
for i, v in ipairs(self.current.vertices) do
table.insert(objs, {
local centroid = vec3(0, 0, 0)
for _, vertex in ipairs(self.currentVertices) do
centroid = centroid + vertex.pos
self._prevVerticesPos = {}
for _, vertex in ipairs(self.currentVertices) do
self._prevVerticesPos[vertex.index] = vertex.pos
if tableSize(self.currentVertices) > 0 then
for i, vertex in ipairs(self.currentVertices) do
local succ
local centroid = vec3(0, 0, 0)
for _, vertex in ipairs(self.currentVertices) do
centroid = centroid + vertex.pos
for i, vertex in ipairs(self.currentVertices) do
if snapToTerrain then
for _, vertex in ipairs(self.currentVertices) do
vertex.pos = self:dropToTerrain(vertex.pos)
local newVerticesPos = {}
for _, vertex in ipairs(self.currentVertices) do
newVerticesPos[vertex.index] = vertex.pos
if im.Button("Delete current selection") then
for _, vertex in ipairs(self.currentVertices) do
self.current:removeVertex(vertex.index)
if im.IsItemHovered() then
for _, vertex in ipairs(self.currentVertices) do
debugDrawer:drawSphere(vertex.pos, 2, ColorF(1, 0, 0, 1))
@/lua/vehicle/powertrain/differential.lua
local isValidMode = false
for _, availableMode in ipairs(device.availableModes) do
if mode == availableMode then
@/lua/ge/extensions/editor/missionEditor/conditions.lua
local files = FS:findFiles('/lua/ge/extensions/gameplay/missions/unlocks/conditions/','*.lua', -1)
for _, file in ipairs(files) do
local aConds = require(file:sub(0,-5))
local rem = nil
for i, con in ipairs(condition.nested) do
if conditionFunctions.displayCondition(self, con) then
--end
for _, cType in ipairs(getConditionsSorted()) do
if im.Selectable1(cType, cType == condition.type) then
if im.BeginCombo("##branchSelector"..index, condition.branchId or "(None!)") then
for _, branch in ipairs(career_branches.getSortedBranches()) do
if im.Selectable1(branch.id, branch.id == condition.branchId) then
if im.BeginCombo('##'..condition.type..'drivetrainLayout'..index, condition.value or "") then
for _,i in ipairs({ "4WD", "AWD", "FWD", "Other", "RWD" }) do
if im.Selectable1(i..'##'..index, i == condition.value) then
if im.BeginCombo('##'..condition.type..'drivetrainLayout'..index, condition.value or "") then
for _,i in ipairs({ "Electric", "ICE" }) do
if im.Selectable1(i..'##'..index, i == condition.value) then
if im.BeginCombo('##'..condition.type..index..'numeric'..self.name, condition.comparator) then
for _, c in ipairs(comparisonOps) do
if im.Selectable1(c.opSymbol..'##'..index..self.name, c.opSymbol == condition.comparator) then
if im.BeginCombo('##'..condition.type..index..'wpCat'..self.name, condition.value) then
for _, c in ipairs({"A","B","C","D","E"}) do
if im.Selectable1(c..'##'..index..self.name, c == condition.value) then
if im.BeginCombo('##manuFacCombo'..index..self.name, "...") then
for idx, man in ipairs(self.manufacturerList) do
if im.Selectable1(man..'##ManSelect'..idx..self.name, man == condition.value) then
@/lua/ge/extensions/editor/crawlEditor/trails.lua
for i, t in ipairs(allTrails) do
if t == trail then
for i, t in ipairs(missionTrails) do
if t == trail then
local crawlsFiles = FS:findFiles(crawlsPath, "*.prefab.json", 1, false, true)
for _, file in ipairs(crawlsFiles) do
table.insert(prefabFiles, file)
for i, trail in ipairs(allTrails) do
local isSelected = (i == selection.index)
if trail.pathId then
for i, path in ipairs(allPaths) do
if path._filePath == trail.pathId then
if im.BeginCombo("##pathCombo", currentPath and currentPath._filePath or "Select Path") then
for i, path in ipairs(allPaths) do
local isSelected = currentPath and currentPath._filePath == path._filePath
if trail.boundaryId then
for i, boundary in ipairs(allBoundaries) do
if boundary._filePath == trail.boundaryId then
if im.BeginCombo("##boundaryCombo", currentBoundary and currentBoundary._filePath or "Select Boundary") then
for i, boundary in ipairs(allBoundaries) do
local isSelected = currentBoundary and currentBoundary._filePath == boundary._filePath
if trail.startingPositionId then
for i, startingPosition in ipairs(allStartingPositions) do
if startingPosition._filePath == trail.startingPositionId then
if im.BeginCombo("##startingPositionCombo", currentStartingPosition and currentStartingPosition._filePath or "Select Starting Position") then
for i, startingPosition in ipairs(allStartingPositions) do
local isSelected = currentStartingPosition and currentStartingPosition._filePath == startingPosition._filePath
if trail.startingPositionIdReversed then
for i, startingPosition in ipairs(allStartingPositions) do
if startingPosition._filePath == trail.startingPositionIdReversed then
if im.BeginCombo("##startingPositionReversedCombo", currentReversedStartingPosition and currentReversedStartingPosition._filePath or "Select Reversed Starting Position") then
for i, startingPosition in ipairs(allStartingPositions) do
local isSelected = currentReversedStartingPosition and currentReversedStartingPosition._filePath == startingPosition._filePath
-- Show dropdown for each existing prefab
for i, prefabFileName in ipairs(trail.prefabs) do
im.Text(string.format("Prefab %d:", i))
local currentIndex = 0
for j, filePath in ipairs(prefabFiles) do
local _, filename, _ = path.split(filePath)
if im.BeginCombo("##PrefabSelect" .. i, prefabFileName) then
for j, filePath in ipairs(prefabFiles) do
local _, filename, _ = path.split(filePath)
if im.BeginCombo("##AddPrefabSelect", "Select new one...") then
for i, filePath in ipairs(prefabFiles) do
local _, filename, _ = path.split(filePath)
@/lua/vehicle/damageTracker.lua
guihooks.trigger("DamageData", damageData)
for _, callback in ipairs(damageUpdateCallbacks) do
callback(damageData, damageDataDelta)
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/setRacerDial.lua
local expectedFailedCount = 0
for _, d in ipairs(dials) do
if d and d.racerId and d.value then
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenWhole.lua
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
local contained = false
for _, op in ipairs(self.oldOptions) do
if pn.name == op or pn.name == op.."_active" then
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
if self.mgr.activity and self.mgr.activity.nextMissions then
for _, mid in ipairs(self.mgr.activity.nextMissions or {}) do
local mission = gameplay_missions_missions.getMissionById(mid)
table.sort(attributesSorted, career_branches.sortAttributes)
for _, key in ipairs(attributesSorted) do
if entryFee[key] > 0 then
for _, btn in ipairs(self.options) do
if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
if self.pinIn.customBtnsFirst.value then
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
else
else
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
end
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/countdownSynced.lua
for _, warningTime in ipairs(warningTimes) do
-- Check if we've crossed this warning threshold and haven't triggered it yet
@/lua/ge/extensions/gameplay/markers/missionMarker.lua
if self:playerIsInArea(interactData) then
for _, elem in ipairs(self.cluster.elemData) do
table.insert(interactableElements, elem)
table.sort(pois, dateSort)
for i, poi in ipairs(pois) do
cluster.pos = cluster.pos + poi.markerInfo.missionMarker.pos
local poiList = {}
for i, poi in ipairs(pois) do poiList[i] = poi end
table.sort(pois, idSort)
local count = 0
for i, poi in ipairs(pois) do
qt:preLoad(i, quadtree.pointBBox(poi.markerInfo.missionMarker.pos.x, poi.markerInfo.missionMarker.pos.y, 1.5)) -- Fixed radius of 1.5m
-- remove all the elements in the cluster from the qt and the locations list
for _, c in ipairs(cluster) do
qt:remove(c._qtId, poiList[c._qtId].markerInfo.missionMarker.pos.x, poiList[c._qtId].markerInfo.missionMarker.pos.y)
@/lua/ge/extensions/editor/util/vehicleSelectUtil.lua
for i, key in ipairs(paintNameKeys) do
self[key] = data[key]
for _, key in ipairs({"enableConfigs", "enablePaints", "enableCustomConfig", "paintLayers", "columnWidth"}) do
if data[key] then
if im.BeginCombo("##vehicleSelectorTypes"..dumps(self.id), self.vehType) then
for _, t in ipairs(self.allowedTypes) do
if im.Selectable1(t.."##vehicleSelectorTypeNames"..dumps(self.id), t == self.vehType) then
if im.BeginCombo("##vehicleSelectorModels"..dumps(self.id), label) then
for _, m in ipairs(self.models) do
local label = m.Name and (m.Name.." ["..m.key.."]")
for _, c in ipairs(self.configs) do
local label = dumps(c.Name).." ["..dumps(c.key).."]"
for i, key in ipairs(paintNameKeys) do
if self.paintLayers and i <= self.paintLayers then
for _, paint in ipairs(self.paintKeys) do
if im.Selectable1(paint.."##vehicleSelectorPaintNames"..dumps(self.id).."_"..i, self[key] == paint) then
@/lua/ge/extensions/gameplay/sites/sites.lua
-- check for multiSpots to generate
for _, ps in ipairs(self.parkingSpots.sorted) do
if ps.isMultiSpot and not ps.isProcedural then
for _, zone in ipairs(self.zones.sorted) do
zone.locations = {}
zone.parkingSpots = {}
for _, t in ipairs(zone.customFields.sortedTags) do
self.tags[t] = 1
for _, loc in ipairs(self.locations.sorted) do
loc.zones = {}
loc.zones = {}
for _, t in ipairs(loc.customFields.sortedTags) do
self.tags[t] = 1
end
for _, zone in ipairs(self.zones.sorted) do
if zone:containsPoint2D(loc.pos) then
for _, ps in ipairs(self.parkingSpots.sorted) do
ps.zones = {}
ps.zones = {}
for _, zone in ipairs(self.zones.sorted) do
if zone:containsPoint2D(ps.pos) then
@/lua/ge/extensions/gameplay/rally/loop/rallyLoopManager.lua
-- Add stages in order
for _, stageNum in ipairs(stageNumbers) do
local roadSection = self:extractMissionId(self.fgVariables["stage"..stageNum.."_rallyRoadSection"])
-- Search for event matching the name and current mission
for i, event in ipairs(self.events) do
if event.missionId == currentMissionId and event.spName == eventName then
-- Process each mission in the sequence
for i, missionId in ipairs(self.missionSequence) do
if missionId == serviceOut then
-- Log individual penalties to eventLog
for _, penaltyData in ipairs(timingResult.penalties or {}) do
self.eventLog:addItem(currentEvent, self.clock, 'penalty', {
-- local logItems = self.eventLog:getItemsByEventGroup(currentEvent.eventGroup)
-- for _, item in ipairs(logItems) do
-- if item.type == 'penalty' and item.data.penaltyType == 'route_recalc' and item.eventId == currentEvent.eventId then
-- -- Query eventLog for speeding penalties for this event
-- for _, item in ipairs(logItems) do
-- if item.type == 'penalty' and item.data.penaltyType == 'speeding' and item.eventId == currentEvent.eventId then
-- local logItems = self.eventLog:getItemsByEventGroup(currentEvent.eventGroup)
-- for _, item in ipairs(logItems) do
-- if item.type == 'penalty' and item.data.penaltyType == 'speeding' and item.eventId == currentEvent.eventId then
for i, entry in ipairs(self.schedule) do
if entry.missionType == 'serviceOut' then
-- Loop through all events and build initial timecard entries
for i, event in ipairs(self.events) do
-- For TC events (timecard entries)
local timecardItem = nil
for _, item in ipairs(logItems) do
if item.type == 'timecard' and item.eventId == event.eventId then
for i, data in ipairs(self.schedule) do
if not data.error then
local eventItems = self.eventLog:getItemsByEventGroup(event.eventGroup)
for _, item in ipairs(eventItems) do
if item.type == 'penalty' and item.data.penaltyType == 'false_start' and item.eventId == event.eventId then
local missions = {}
for _, missionId in ipairs(self.missionSequence) do
-- Skip placeholder IDs for serviceOut and serviceIn
@/lua/ge/extensions/core/gamestate.lua
local function tellListeners ()
for k,v in ipairs(listeners) do
v()
local function stateStartsWithPausedPrefix(stateName)
for _, prefix in ipairs(pausedStates) do
if string.sub(stateName, 1, string.len(prefix)) == prefix then
@/lua/ge/extensions/util/forestGenerator.lua
table.clear(forestItemDict)
for i, v in ipairs(forestData:getItems()) do
local internalName = v:getData():getInternalName()
-- the polygon is an array of vec3 positions
for i, v in ipairs(polygon) do
table.insert(lassoNodes2D, Point2F(v.x, v.y))
local function clearForest()
for i, item in ipairs(forestData:getItems()) do
local itemType = item:getData():getInternalName()
@/lua/ge/extensions/ui/apps/genericMissionData.lua
-- Send all elements in order
for i, item in ipairs(missionData.displayOrder) do
guihooks.trigger('SetGenericMissionData', {
-- Update all matched categories
for _, category in ipairs(matchedCategories) do
if args.clear then
if not orderChanged then
for i, item in ipairs(newOrder) do
if missionData.displayOrder[i] ~= item.category then
-- If order changed, send all elements
for i, item in ipairs(missionData.displayOrder) do
guihooks.trigger('SetGenericMissionData', {
-- If order didn't change, only send updated elements
for _, category in ipairs(matchedCategories) do
local element = missionData.elements[category]
-- Find the index of this element
for i, item in ipairs(missionData.displayOrder) do
if item.category == category then
im.Text("Current Mission Data:")
for i, item in ipairs(missionData.displayOrder) do
local element = item.element
@/lua/ge/extensions/flowgraph/nodes/gameplay/blacklistWalking.lua
gameplay_walk.clearBlacklist()
for _, id in ipairs(self.mgr.modules.vehicle.sortedIds) do
gameplay_walk.addVehicleToBlacklist(sortedIds)
gameplay_walk.clearBlacklist()
for _, name in ipairs(scenetree.findClassObjects("BeamNGVehicle")) do
local obj = scenetree.findObject(name)
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/setButtonProperty.lua
if id and button then
for _, p in ipairs(properties) do
if self.pinIn[p].value ~= nil then
@/lua/ge/extensions/gameplay/rally/tools/devTools.lua
for _, file in ipairs(compositorFiles) do
-- Extract compositor name from path
for i, point in ipairs(elevationProfile) do
if point.z < minZ then minZ = point.z end
for i, point in ipairs(self.pacenotesTools.elevationProfile) do
local pos = vec3(point.x, point.y, point.z)
if points then
for i, point in ipairs(points) do
-- dump(point.pos)
for i, corner in ipairs(self.pacenotesTools.corners) do
-- Choose color based on direction
if self.compositors then
for _, compositorName in ipairs(self.compositors) do
if im.Selectable1(compositorName, compositorName == self.selectedCompositor) then
@/lua/ge/extensions/flowgraph/nodes/scene/rectMarker.lua
end
for _, obj in ipairs(self.markerObjects) do
if editor and editor.onRemoveSceneTreeObjects then
@/lua/ge/extensions/ui/liveryEditor/layerAction.lua
local performEnabled = function(layerUids)
for _, uid in ipairs(layerUids) do
local layer = api.getLayerByUid(uid)
@/lua/ge/extensions/editor/vehicleEditor/api/nodeTransformer.lua
local function setNodesPositionOffset(deltaPos)
for _,node in ipairs(vEditor.selectedNodes) do
node.pos = deltaPos + lastPickedNodesPos[node.name]
@/lua/ge/extensions/c2/webSocketHandler.lua
for _, evt in ipairs(events) do
if evt.type == "D" and evt.msg ~= "" then
@/lua/ge/extensions/gameplay/rally/notebook/pacenoteGenerator.lua
for _, n in ipairs(corner.nodes) do
corner.length = corner.length + n.length
-- Merge cornerNext into corner
for _, node in ipairs(cornerNext.nodes) do
nodesMoved = nodesMoved + 1
local route = {}
for i, point in ipairs(pointList) do
-- Handle both formats: tables with .pos property or direct vec3 objects
local results = {}
for _, corner in ipairs(corners) do
if corner.nodes and #corner.nodes > 0 then
@/lua/vehicle/backwardsCompatibility.lua
if oldEngine.gears then
for _, v in ipairs(oldEngine.gears) do
if type(v) == "number" then
@/lua/vehicle/extensions/gameplayStatisticModules/watchBurnout.lua
if initialWheelCount ~= wheels.wheelCount then return end --if we lose a wheel
for _, wIndex in ipairs(wheelsBurnout) do
wd = wheels.wheels[wIndex]
@/lua/ge/extensions/gameplay/rally/driveline/drivelineV3.lua
local positions = {}
for i, xyz in ipairs(data.points) do
table.insert(positions, vec3(xyz[1], xyz[2], xyz[3]))
local tempNormals = {}
for i, point in ipairs(points) do
tempNodes[i] = vec3(point.pos)
-- Set up prev/next relationships
for i, point in ipairs(points) do
point.id = i
-- Calculate normals and add pacenote fields
for i, point in ipairs(points) do
point.normal = SnaproadNormals.forwardNormalVec(point)
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veView.lua
if type(viewsSerialized) == 'table' then
for id, data in ipairs(viewsSerialized) do
if data then
local viewsSerialized = {}
for id, view in ipairs(sceneViews) do
if view then
local function unload()
for id, data in ipairs(sceneViews) do
if data and data.control then
for id, view in ipairs(sceneViews) do
if not view or (view and not editor.isWindowVisible(view.name)) then
for id, view in ipairs(sceneViews) do
if view and editor.isWindowRegistered(view.name) then
@/lua/ge/extensions/editor/missionPlaybook/unlockedMissionsViewer.lua
for _, key in ipairs({"startable","visible","invisible"}) do
for _, id in ipairs(data.unlockedMissions[key]) do
for _, key in ipairs({"startable","visible","invisible"}) do
for _, id in ipairs(data.unlockedMissions[key]) do
local highlight = false
}
for _, id in ipairs(gameplay_missions_missions.getAllIds()) do
local m = gameplay_missions_missions.getMissionById(id)
@/lua/ge/extensions/editor/assetDeduplicator.lua
job.allfiles = job.allfiles + #filenames
for _, filename in ipairs(filenames) do
if not FS:isLinkFile(filename) then
job.allfiles = job.allfiles + #filenames
for _, filename in ipairs(filenames) do
if not FS:isLinkFile(filename) then
local filenames = FS:findFiles("/levels/", "info.json", 1, true, false)
for _, filename in ipairs(filenames) do
if isOfficialContentVPath(filename) then
cacheData['stockLevels'][path] = {}
for _, filename in ipairs(filenames) do
if not FS:isLinkFile(filename) then
local filenames = FS:findFiles("/levels/", "info.json", 1, true, false)
for _, filename in ipairs(filenames) do
if not isOfficialContentVPath(filename) then
cacheData['modLevels'][path] = {}
for _, filename in ipairs(filenames) do
if not FS:isLinkFile(filename) then
job.allfiles = job.allfiles + #filenames
for _, filename in ipairs(filenames) do
if not FS:isLinkFile(filename) then
if type(jobData.blacklistExtensions) == "table" then
for _, ext in ipairs(jobData.blacklistExtensions) do
if type(ext) == "string" and ext ~= "" then
@/lua/ge/extensions/core/vehicle/inplaceEdit.lua
for i, slot in ipairs(partSlots) do
local chosenPartName = vBundle.chosenParts[slot.type]
availablePartsForSlotIdx = 1
for i, possiblePartname in ipairs(availablePartsForSlot) do
if possiblePartname == chosenPartName or ((chosenPartName == '' or chosenPartName == 'nil') and possiblePartname == '') then
end
for i, possiblePartname in ipairs(availablePartsForSlot) do
local txt2 = ''
@/lua/ge/extensions/scenario/speedGoal.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
instance.raceTickTime = 0.25
end
for _,i in ipairs(instance.value.wayPointNum) do
if type(i) == "number" then
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id ~= 'speed' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
statistics_statistics.setGoalProgress(instance.vId, instance.id, instance.vId, {status=instance.status.result, maxPoints=nil})
@/lua/ge/extensions/editor/api/gui.lua
if terrainBlock then
for k,v in ipairs(line1) do
v.z = terrainBlock:getHeight(vec3(v.x,v.y,0)) + 0.1
end
for k,v in ipairs(line2) do
v.z = terrainBlock:getHeight(vec3(v.x,v.y,0)) + 0.1
end
for k,v in ipairs(line3) do
v.z = terrainBlock:getHeight(vec3(v.x,v.y,0)) + 0.1
end
for k,v in ipairs(line4) do
v.z = terrainBlock:getHeight(vec3(v.x,v.y,0)) + 0.1
@/lua/ge/extensions/editor/api/gizmo.lua
for _, bb in ipairs(objectBBs) do
bbox:extend(bb.minExtents)
if editor.getPreference("snapping.terrain.useRayCast") then
for _, object in ipairs(objects) do
object:disableCollision()
for index, objectTransform in ipairs(objectTransforms) do
table.insert(currentTransforms, copyMat(objectTransform))
if editor.getPreference("snapping.terrain.enabled") and editor.getPreference("snapping.terrain.useRayCast") then
for _, object in ipairs(objects) do
object:enableCollision()
if editor.getPreference("snapping.terrain.useRayCast") then
for _, object in ipairs(objects) do
object:disableCollision()
for index, transform in ipairs(currentTransforms) do
transform:setPosition(transform:getColumn(3) + worldEditorCppApi.getAxisGizmoTranslateOffset())
if editor.getPreference("snapping.terrain.useRayCast") then
for _, object in ipairs(objects) do
object:enableCollision()
@/lua/ge/extensions/editor/assemblySpline.lua
local variations = rigid.variations
for j, variation in ipairs(variations) do
-- All variations (including root variations) have enable/disable checkboxes.
local variations = bridge.variations
for j, variation in ipairs(variations) do
local varTmpPtr = im.BoolPtr(mol.getBridgeEnabled(selSpline, variation.id))
end
for _, variation in ipairs(variations) do
if mol.getRigidEnabled(selSpline, variation.id) then
-- Variation weight sliders.
for j, variation in ipairs(variations) do
if mol.getRigidEnabled(selSpline, variation.id) then
-- Process bridge components.
for i, bridge in ipairs(molecule.bridges) do
local baseMesh = bridge.mesh
end
for _, variation in ipairs(variations) do
if mol.getBridgeEnabled(selSpline, variation.id) then
-- Variation weight sliders.
for j, variation in ipairs(variations) do
if mol.getBridgeEnabled(selSpline, variation.id) then
local validCtr = 0
for _, objId in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(objId)
@/lua/ge/extensions/editor/assemblySpline/import.lua
local function restoreTSStatics(backup)
for _, entry in ipairs(backup) do
local obj = createObject("TSStatic")
local function deleteTSStaticsFromBackup(backup)
for _, entry in ipairs(backup) do
if entry.name then
end
for _, anchorName in ipairs(obj:getAnchorNames()) do -- Check if any anchor points have the nail prefix.
if anchorName:sub(1, 5) == anchorPrefixStr .. '.' then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/signals/sequenceByName.lua
if self.pinIn.signalsData.value and self.pinIn.name.value then
for _, sequence in ipairs(self.pinIn.signalsData.value.sequences) do
if sequence.name == self.pinIn.name.value then
@/lua/ge/extensions/util/trackBuilder/markers.lua
expandTruncateList(markers['bank'],#nodes,addBankMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['height'],#nodes,addHeightMarker)
for i, node in ipairs(nodes) do
markers['height'][i]:setPosition((node.markerInfo.position + vec3(0,0,-1)))
expandTruncateList(markers['width'],#nodes*2,addWidthMarker)
for i, node in ipairs(nodes) do
local right = node.markerInfo.rot:__mul(vec3( node.width.value/2, 0, 0))
expandTruncateList(markers['centerMesh'],#nodes,addCenterMeshMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['leftMesh'],#nodes,addLeftMeshMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['rightMesh'],#nodes,addRightMeshMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['checkpoint'],#nodes,addCheckpointMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['leftWall'],#nodes,addLeftWallMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['rightWall'],#nodes,addRightWallMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
expandTruncateList(markers['ceilingMesh'],#nodes,addCeilingMeshMarker)
for i, node in ipairs(nodes) do
local rot = node.markerInfo.rot
for _,name in ipairs(names) do markers[name] = {} markerChanges[name] = {} end
local types = {
local function interpolateSingle(nameOfField, track)
for _,index in ipairs(markerChanges[nameOfField]) do
if track[index] ~= nil then
if startValue == endValue or (not endLength and not endValue) then
for _,p in ipairs(segment.points) do
M.interpolateField(nameOfField,0,startValue,startValue,p,1)
-- otherwise, calculate fraction of distances and then interpolate
for _,p in ipairs(segment.points) do
local t = (p.length - startLength) / (endLength - startLength)
local function unloadAll()
for _,name in ipairs(names) do markers[name] = {} end
end
@/lua/ge/extensions/core/lapTimes.lua
local lapIndexToDuration = {}
for _, seg in ipairs(segmentTimes) do
lapIndexToDuration[seg.lap] = lapIndexToDuration[seg.lap] or {}
for _, seg in ipairs(segmentTimes) do
if lapIndexToDuration[seg.lap - 1] and lapIndexToDuration[seg.lap - 1][seg.segment] then
if bestLapTime then
for i, lap in ipairs(lapData) do
if lap.duration == bestLapTime then
for i, lap in ipairs(lapData) do
-- Calculate diffs
local segmentCounts = {}
for _, segment in ipairs(segmentTimes) do
segmentCounts[segment.segment] = (segmentCounts[segment.segment] or 0) + 1
for i, segment in ipairs(segmentTimes) do
-- Only mark as best if there are multiple instances of this segment to compare
-- Include completed laps (from historicTimes)
for i, lap in ipairs(lapData) do
-- Add all segments for this lap
@/lua/common/jbeam/utils.lua
if wheel._group_nodes ~= nil then
for k, v in ipairs(wheel._group_nodes) do
t_insert(nodes, vehicle.nodes[v])
if wheel._rotatorGroup_nodes ~= nil then
for k, v in ipairs(wheel._rotatorGroup_nodes) do
t_insert(nodes, vehicle.nodes[v])
@/lua/vehicle/controller/shiftLights.lua
local rpm = electrics.values[inputElectricsName]
for _, v in ipairs(lightSteps) do
electrics.values[v.electricsName] = 0
for _, v in ipairs(lightSteps) do
if rpm >= v.startRPM and (rpm < v.endRPM or keepLowerLEDsOn) and not isOverMaxRPM then
local flashValue = flashSwitch and 1 or 0
for _, v in ipairs(flashingLEDsOn) do
electrics.values[v] = flashValue
end
for _, v in ipairs(flashingLEDsOff) do
electrics.values[v] = 1 - flashValue
@/lua/ge/extensions/util/renderComponentsAPI.lua
local function recursiveSetupSettings(sets)
for _, s in ipairs(sets) do
table.insert(settingKeys, s.tsVar)
local rendererComponentFiles = FS:findFiles("/renderer/components/", "*.rendercomponent.json", -1, false, false)
for _, filename in ipairs(rendererComponentFiles) do
local data = jsonReadFile(filename)
local current = {}
for _, key in ipairs(settingKeys) do
current[key] = TorqueScriptLua.getVar(key)
local result = {}
for i,file in ipairs(FS:findFiles('art/postfx', '*.png', 0, false, false)) do
table.insert(result, {filename=file})
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/setMultipleButtonsProperty.lua
if id and button then
for _, p in ipairs(properties) do
if self.pinIn[p .. '_' ..i].value ~= nil then
@/lua/ge/extensions/editor/levelValidator.lua
local result = {}
for _, value in ipairs(t) do
local filterPassed = false
local filterPassed = false
for _, filter in ipairs(filters) do
if filter(value) then
local firstSignPositive = (bbMax - terrainHeights[1]) > 0
for _, terrainHeight in ipairs(terrainHeights) do
local diffTop = bbMax - terrainHeight
for _, obj in ipairs(objects) do
if obj:isSubClassOf("TSStatic") and obj.canSave then
forestData = core_forest.getForestObject():getData()
for i, forestItem in ipairs(forestData:getItems()) do
if forestItem:getPosition().x < terrainMaxExtents.x and forestItem:getPosition().x > terrainMinExtents.x
local function setNodesPlanted(node)
for i, otherNode in ipairs(node.edges) do
if not otherNode.planted then
local sortedData = {}
for i, field in ipairs(sortedFields) do
table.insert(sortedData, data[field])
if sortedData[i][1] then
for i2, value in ipairs(sortedData[i]) do
sortedData[i][i2] = sortData(value)
-- Loop tsstatics and forest items
for i, unplantedObj in ipairs(unplantedObjects) do
local unplantedNode = unplantedObj.getKey and forestItemNodes[unplantedObj:getKey()] or sceneObjectNodes[unplantedObj:getID()]
local objects = findObjectList(bb, SOTStaticShape, 0)
for _, otherObj in ipairs(objects) do
local otherNode = sceneObjectNodes[otherObj:getID()]
local items = forestData:getItemsBox(bb)
for _, item in ipairs(items) do
local otherNode = forestItemNodes[item:getKey()]
local objectHashes = {}
for _, name in ipairs(scenetree.getAllObjects()) do
local object = scenetree.findObject(name)
-- loop all forest items
for i1, forestItem1 in ipairs(forestData:getItems()) do
local forestItem1TransformString = forestItem1:getTransform():__tostring()
-- loop all items that are close to forestItem1
for i2, forestItem2 in ipairs(forestData:getItemsCircle(forestItem1:getPosition(), 0.1)) do
if forestItem1:getKey() ~= forestItem2:getKey() then
end
for _, log in ipairs(objectLogs) do
table.insert(levelLogs, log)
if im.Button("Delete all duplicates (WARNING: This cannot be undone with ctrl+z)") then
for i, logItem in ipairs(levelLogs) do
if logItem.onCheck and logItem.type == "duplicate" and not logItem.prefabChildId then
local processedLogs = {}
for _, logItem in ipairs(levelLogs) do
local isIgnored = isLogItemIgnored(logItem)
for i, logItem in ipairs(filteredLogs) do
local object
for _, l in ipairs(levelLogs) do
local log = deepcopy(l)
for _, log in ipairs(adjustedLevelLogs) do
if not types[log.type] then
@/lua/ge/extensions/scenario/raceMarkers/crawlMarker.lua
function C:clearMarkers()
for _, id in ipairs(self._ids or {}) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/editor/trafficDebug.lua
for _, id in ipairs(gameplay_traffic.getTrafficList()) do
local veh = traffic[id]
for _, id in ipairs(gameplay_parking.getParkedCarsList()) do
im.PushStyleColor2(im.Col_Text, colors.silver)
if im.TreeNode1("General Info") then
for _, key in ipairs(generalKeys) do
doBulletTextInfo(key, currVeh[key])
if im.TreeNode1("Road Info") then
for _, key in ipairs(roadKeys) do
doBulletTextInfo(key, currVeh.tracking[key])
if im.TreeNode1("Respawn Info") then
for _, key in ipairs(respawnKeys) do
doBulletTextInfo(key, currVeh.respawn[key])
local pursuit = currVeh.pursuit
for _, key in ipairs(pursuitKeys) do
doBulletTextInfo(key, pursuit[key])
local timers = pursuit.timers
for _, key in ipairs(timerKeys) do
doBulletTextInfo(key, timers[key])
local role = currVeh.role
for _, key in ipairs(roleKeys) do
doBulletTextInfo(key, role[key])
if logs[currVeh.id] then
for i, v in ipairs(logs[currVeh.id]) do
if(i > maxLogsPerVeh) then table.remove(logs[currVeh.id], 1) end
@/lua/ge/extensions/editor/rallyEditor/static.lua
for name,variants in pairs(self.systemPacenotes) do
for i,variant in ipairs(variants) do
im.Text(name..'_'..tostring(i))
-- else
-- for _,spn in ipairs(self.path:getSystemPacenotes()) do
-- im.Text(spn.name)
-- local lang_set = {}
-- for i,langData in ipairs(self.path:getLanguages()) do
-- lang_set[langData.language] = langData.codrivers
-- for _,spn in ipairs(self.path.static_pacenotes.sorted) do
-- for lang,langData in pairs(spn.notes) do
-- for _,codriver in ipairs(codrivers or {}) do
-- local fname = ''
@/lua/ge/extensions/editor/missionStartPositionEditor.lua
local function isMissionInList(mission, list)
for _, m in ipairs(list) do
if m == mission then
for _, otherMission in ipairs(allMissions) do
if otherMission ~= mission and otherMission.startTrigger and otherMission.startTrigger.level == currentLevel then
-- Store old positions and move missions
for _, nearbyMission in ipairs(nearby) do
oldPositions[nearbyMission] = getMissionStartPosition(nearbyMission)
function(data)
for _, mission in ipairs(data.missions) do
setMissionStartPosition(mission, data.oldPositions[mission])
function(data)
for _, mission in ipairs(data.missions) do
setMissionStartPosition(mission, data.newPos)
-- Draw all mission start positions
for _, mission in ipairs(allMissions) do
if mission.startTrigger and mission.startTrigger.level == currentLevel then
@/lua/common/libs/luamqtt/mqtt/protocol.lua
local strings = {}
for i, part in ipairs(self) do
strings[i] = tostring(part)
local len = 0
for _, part in ipairs(self) do
len = len + part:len()
@/lua/ge/extensions/editor/raceEditor/pacenotes.lua
im.BeginChild1("keynotes", im.ImVec2(125 * im.uiscale[0], 0 ), im.WindowFlags_ChildWindow)
for i, note in ipairs(self.path.pacenotes.sorted) do
if im.Selectable1(note.name, note.id == self.index) then
end
for i, sp in ipairs(self.path.segments.sorted) do
if im.Selectable1('#'..i .. " - " .. sp.name, node[fieldName] == sp.id) then
@/lua/ge/extensions/editor/dragRaceEditor/strips.lua
for i, strip in ipairs(allStrips) do
local isSelected = i == selectedStripIndex
for i, lane in ipairs(strip.lanes) do
local isLaneSelected = i == selectedLaneIndex
for i, waypoint in ipairs(lane.waypoints) do
local isWaypointSelected = i == selectedWaypointIndex
for _, lane in ipairs(strip.lanes) do
if lane.waypoints then
if lane.waypoints then
for i, waypoint in ipairs(lane.waypoints) do
local pos = vec3(waypoint.transform.position.x, waypoint.transform.position.y, waypoint.transform.position.z)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
for i, lane in ipairs(strip.lanes) do
if lane.boundary then
@/lua/ge/extensions/editor/prefabInstanceEditor.lua
local differsFromParent = false
for i, id in ipairs(inspectorInfo.previousSelectedIds) do
local object = scenetree.findObjectById(id)
@/lua/ge/extensions/ui/gridSelectorUtils/displayDataModule.lua
local displayOptionKeyToType = {}
for _, option in ipairs(finalDisplayDataOptions) do
displayOptionKeyToType[option.key] = option.type
local displayOptionSettingsKeyByKey = {}
for _, option in ipairs(finalDisplayDataOptions) do
if option.settingsKey then
}
for _, option in ipairs(finalDisplayDataOptions) do
if option.save then
-- Copy default values
for _, option in ipairs(finalDisplayDataOptions) do
displayData[option.key] = option.default
-- Reset all options to their default values
for _, option in ipairs(finalDisplayDataOptions) do
if option.save then
local data = {}
for _, option in ipairs(finalDisplayDataOptions) do
local value = nil
@/lua/ge/extensions/ui/vehicleSelector/vehicleSpecifications.lua
for _, specificationGroup in ipairs(specificationSetup) do
local group = {}
if metricOrImperial == 'metric' then
for _, specification in ipairs(specificationGroup.aggregatesMetric or {}) do
makeSpec(modelDetails, configDetails, specification, group.specifications)
else
for _, specification in ipairs(specificationGroup.aggregatesImperial or {}) do
makeSpec(modelDetails, configDetails, specification, group.specifications)
end
for _, specification in ipairs(specificationGroup.aggregates) do
makeSpec(modelDetails, configDetails, specification, group.specifications)
local generalSpecs = {}
for _, specification in ipairs(generalSpecifications) do
makeSpec(modelDetails, configDetails, specification, generalSpecs)
}
for _, multiPaintSetup in ipairs(modelDetails.multiPaintSetups) do
if multiPaintSetup.usedByConfigByKey[configKey] or multiPaintSetup.forAllConfigs then
@/lua/ge/extensions/flowgraph/modules/levelModule.lua
end
for _, fun in ipairs(self.funs) do
fun()
@/lua/ge/extensions/editor/roadRiverCacheHandler.lua
local function onEditorPrefabExploded(groups)
for _, group in ipairs(groups) do
for _, name in pairs(group:getObjects()) do
@/lua/ge/extensions/tech/capturePlayer.lua
local messages = {}
for _, currFilename in ipairs(files) do
log('D', logTag, 'Merging ' .. currFilename .. '.')
for _, message in ipairs(messages) do
local line = message.timestamp .. '\n' .. message.ctx .. '\n' .. message.payload .. '\n'
if removeIntermediates then
for _, file in ipairs(files) do
FS:removeFile(file)
@/lua/ge/extensions/util/trackBuilder/multiTrackMerger.lua
local totalDist = edge.bezierPoints[#edge.bezierPoints].dist
for i,p in ipairs(edge.bezierPoints) do
local t = p.dist / totalDist
for _, point in ipairs(edge.bezierPoints) do
point.orientation = calculatePointCoordinateSystem(point)
local normal = vec3()
for _,e in ipairs(edges) do center = center+e.bezierPoints[math.ceil(bezierCount/2)].position normal = normal+e.bezierPoints[math.ceil(bezierCount/2)].orientation.nz end
center = center / (#edges)
local center = vec3()
for i,s in ipairs(segments) do
local p
for _,p in ipairs(points) do
debugDrawer:drawSphere(p.position, 1, ColorF(1, 0, 0, 1))
local meshes = {{}}
for i, edge in ipairs(edges) do
-- make pseudo segment out of edge
if #segments > 2 then
for i, m in ipairs(getCenterMesh(edges, centerMat)) do
meshes[1][#meshes[1]+1] = m
local name = "procMerger"
for _, seg in ipairs(segments) do
name = name.."-"..(seg.reverse and 'r' or '')..seg.index.."x"..seg.sub
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaKombi.lua
local crc = 0x0
for _, b in ipairs(data) do
crc = bxor(crc, b)
else
-- for _, messageId in ipairs(messageIdsToIgnore) do
-- if msg.ID == messageId then
@/lua/common/utils/simpleHttpServer.lua
for _, c in ipairs(read) do
if write[c] == nil then
local newList = {}
for i, sinkData in ipairs(sinks) do
if write[sinkData[1]] then
@/lua/ge/extensions/flowgraph/nodes/scene/raceLineParking.lua
table.clear(wlml)
for _, p in ipairs(line) do
table.insert(wlml,self:toInternal2d(p))
@/lua/ge/extensions/editor/flowgraph/missionVariableHelper.lua
local injected = 0
for _, varName in ipairs(vehicleIdVarNames) do
if mgr.variables:variableExists(varName) then
@/lua/ge/extensions/ui/liveryEditor/tools.lua
if selectedLayerUids then
for key, layerUid in ipairs(selectedLayerUids) do
local layer = api.getLayerByUid(layerUid)
@/lua/ge/extensions/career/modules/delivery/pages.lua
local totalItems, totalMoney
for _, fac in ipairs(dGenerator.getFacilities()) do
if dProgress.isFacilityUnlocked(fac.id) then
}
for _, change in ipairs(arrayReverse(deepcopy(career_modules_playerAttributes.getAttributeLog()))) do
if change.reason.delivery then
local changeText = ""
for _, key in ipairs(career_branches.orderAttributeKeysByBranchOrder(tableKeys(change.attributeChange))) do
changeText = changeText .. string.format('%s: %s%0.2f
', key, change.attributeChange[key] > 0 and "+" or "", change.attributeChange[key])
@/gameplay/missionTypes/rallyStage/constructor.lua
local ret = {}
for i, nId in ipairs(path.config.linearSegments or {}) do
local node = path.pathnodes.objects[nId]
self.cachedWorldPreviewRoute = {}
for _, p in ipairs(ret) do
table.insert(self.cachedWorldPreviewRoute, {pos = p})
@/flowgraphEditor/Tower/customNodes/towerNode.lua
for _, rList in pairs(rooms) do
for _, r in ipairs(rList) do
table.insert(all, r)
-- Calculate the total frequency of all options
for _, option in ipairs(options) do
totalFrequency = totalFrequency + option.frequency
--print(n)
for _, option in ipairs(options) do
local amount = math.ceil((option.frequency / totalFrequency) * (n))
local list = {}
for _, elem in ipairs(blueprint) do
local typeFiles = deepcopy(rooms[elem.type])
for i, room in ipairs(list) do
local _, fn, ext = path.split(room.file, true)
if type ~= "Prefab" then
for _, id in ipairs(list) do
table.insert(allChildrenIds, id)
local start, goal = nil, nil
for _, id in ipairs(allChildrenIds) do
local obj = scenetree.findObjectById(id)
local startPos, startRot = start:getPosition(), quat(start:getRotation())
for _, id in ipairs(allChildrenIds) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/editor/flowgraph/search.lua
})
for _, pin in ipairs(node.pinList) do
self.search:queryElement({
local match = string.lower(ffi.string(self.searchText))
for _, t in ipairs(tableKeys(typeOrder)) do
if match:find(t..": ") ~= nil then
local debugEnabled = editor.getPreference("flowgraph.debug.editorDebug")
for _, result in ipairs(self.searchResultsByMgr[self.mgr.id] or {}) do
if self.filterByType and string.lower(result.type) == string.lower(self.filterByType) or not self.filterByType then
@/lua/ge/extensions/gameplay/rally/cameraPathPlayer.lua
local accumulated_distance = 0
for i,cap in ipairs(points) do
-- Calculate distance from previous point for irregular spacing
-- extract all its markers
for i, markerData in ipairs(pathJsonObj.markers) do
local marker = {
@/lua/ge/extensions/scenario/distanceGoal.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
local targetobj= helper.getVehicleByName(instance.value.target)
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'distance' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
statistics_statistics.setGoalProgress(instance.vId, instance.id, instance.vId, {status=instance.status.result, maxPoints=nil})
@/lua/vehicle/controller/gauges/genericGauges.lua
local function updateElectricsData(dt)
for _, v in ipairs(electricsConfig) do
gaugeData.electrics[v] = electrics.values[v] or 0
local function updatePowertrainData(dt)
for _, v in ipairs(powertrainConfig) do
for _, n in ipairs(v.properties) do
for _, v in ipairs(powertrainConfig) do
for _, n in ipairs(v.properties) do
gaugeData.powertrain[v.device.name][n] = v.device[n] or 0
local function updateCustomModuleData(dt)
for _, module in ipairs(customModuleConfig) do
module.controller.updateGaugeData(gaugeData.customModules[module.name], dt)
@/lua/ge/extensions/editor/dynamicDecals/debugSection.lua
for _, vehicle in ipairs(vehicles) do
local matPath = string.format("%s/main.materials.json", vehicle)
local materialsUsed = settings.getUsedMaterialNames()
for _, material in ipairs(materialsUsed) do
@/lua/ge/extensions/flowgraph/nodes/ui/autoMedal.lua
local nextMedal = ""
for _, m in ipairs(medals) do
local val = self.pinIn[m].value
@/lua/ge/extensions/flowgraph/nodes/vehicle/fire/fire.lua
if im.BeginCombo("##beamFunc" .. self.id, self.selected) then
for _, fun in ipairs(self.functions) do
if im.Selectable1(fun, fun == self.selected) then
@/lua/ge/extensions/gameplay/crawl/debug.lua
if im.CollapsingHeader1("Node Details", im.TreeNodeFlags_DefaultOpen) then
for i, pathnode in ipairs(pathnodes) do
local isCompleted = debugData.completedPathnodes and debugData.completedPathnodes[i]
@/lua/ge/extensions/gameplay/drag/dragBridge.lua
local current = obj
for _, key in ipairs(path) do
if current == nil then
local function checkVehiclePermission(model, rules)
for _, rule in ipairs(rules) do
local propertyValue = getPropertyValue(model, rule.path)
local found = false
for _, allowedValue in ipairs(rule.allowedValues) do
if propertyValue == allowedValue then
for _, data in ipairs(vehicleIds) do
gameplay_drag_general._setupRacer(data.id, data.lane)
@/gameplay/missionTypes/rallyRoadSection/constructor.lua
-- local ret = {}
-- for i, nId in ipairs(path.config.linearSegments or {}) do
-- local node = path.pathnodes.objects[nId]
-- self.cachedWorldPreviewRoute = {}
-- for _, p in ipairs(ret) do
-- table.insert(self.cachedWorldPreviewRoute, {pos = p})
@/lua/ge/extensions/util/instancedLineRenderDemo.lua
local function simStep(dt)
for j, mj in ipairs(masses) do
mj.force = mj.position * -32
mj.force = mj.position * -32
for k, mk in ipairs(masses) do
if j ~= k then
end
for _, mass in ipairs(masses) do
mass.velocity = mass.velocity + (mass.force * dt / mass.mass)
local offset = vec3(6, 0, 0)
for _, mass in ipairs(masses) do
for _, line in ipairs(mass.lines) do
for _, mass in ipairs(masses) do
for _, line in ipairs(mass.lines) do
debugDrawer:drawLineInstance(line[1] + simDrawOffset, line[2] + simDrawOffset, 3, line[3], useDepth)
@/lua/ge/extensions/editor/missionEditor.lua
if groupFilter.filter then
for _, f in ipairs(filterNamesSorted) do
if groupFilter.filter[f.key] ~= nil then
local groupFilter = { filter = {}}
for _, f in ipairs(filterNamesSorted) do
groupFilter.filter[f.key] = filter[f.key]
for _, issue in ipairs(missionData._issueList) do
im.BulletText(issue.label)
for _, mission in ipairs(gameplay_missions_missions.getFilesData() or {}) do
local passed = true
local result = {missions = {}, sortedKeys = {}}
for _, mission in ipairs(missions) do
local key = propertyFunction(mission)
missionSearch:startSearch(s)
for k,missionData in ipairs(missionList) do
missionSearch:queryElement({
local taken = false
for _, mission in ipairs(missionList or {}) do
if mission.id == id then
if im.BeginCombo('##MissionType',newMissionData.type) then
for _, mType in ipairs(missionTypeWindow.missionTypes) do
if im.Selectable1(mType, mType == newMissionData.type) then
if editHelper then
for _, elem in ipairs(editHelper.elements) do
if elem.displayOptions and elem.displayOptions.isTranslation then
table.insert(keys,"noStarUnlocked")
for _, key in ipairs(keys) do
local t = clickedMission.careerSetup.starOutroTexts[key]
end
for _, elem in ipairs(translation) do
if translateLanguage(elem.value, "NoTranslation!") ~= "NoTranslation!" then
local translationStrings = {}
for _, elem in ipairs(translation) do
table.insert(translationStrings,string.format(' "%s": "%s"', elem.key, elem.value))
local branchNames = {}
for _, branch in ipairs(career_branches.getSortedBranches()) do
if not branch.showProgressAsStars then
for _, mission in ipairs(missionList) do
local instance = gameplay_missions_missions.getMissionById(mission.id)
local leagueNames = {}
for _, league in ipairs(leagues) do
table.insert(leagueNames, league.id)
for _, key in ipairs(instance.careerSetup._activeStarCache.sortedStars) do
local translatedStarLabel = instance.starLabels[key]
local rewards = {}
for _, r in ipairs(instance.careerSetup._activeStarCache.sortedStarRewardsByKey[key] or {}) do
rewards[r.attributeKey] = r.rewardAmount
local branchRewards = {}
for _, branch in ipairs(branchNames) do
table.insert(branchRewards, rewards[branch] or 0)
for _, mission in ipairs(missionList) do
local instance = gameplay_missions_missions.getMissionById(mission.id)
for _, mission in ipairs(missionList) do
local instance = gameplay_missions_missions.getMissionById(mission.id)
for _, scenario in ipairs(scenario_scenariosLoader.getList()) do
local origin = "Scenario"
-- for _, qr in ipairs(scenario_quickRaceLoader.getQuickraceList()) do
-- csvdata:add(translateLanguage(qr.scenarioName, qr.scenarioName, true), tonumber(qr.date), "Time Trial")
local validSkills = {}
for _, branch in ipairs(career_branches.getSortedBranches()) do
if branch.parentDomain == "apm" then
for _, mission in ipairs(missionList) do
local instance = gameplay_missions_missions.getMissionById(mission.id)
print("Removing non-attribute star rewards...")
for _, mission in ipairs(missionList) do
local shortId = getShortId(mission.id)
shortId = getShortId(mission.id) .. "-" .. key
for _, reward in ipairs(list) do
if ignoreAttributeKeys[reward.attributeKey] then
local branchNames = {}
for _, branch in ipairs(career_branches.getSortedBranches()) do
if not branch.showProgressAsStars then
local fDataById = {}
for _, m in ipairs(gameplay_missions_missions.getFilesData()) do
fDataById[m.id] = m
end
for _, row in ipairs(data) do
local mission = fDataById[row['Mission ID']]
local rewards = {}
for _, key in ipairs({"money", "vouchers",unpack(branchNames)}) do
if row[key] ~= 0 then
--[[
for _, mission in ipairs(missionList) do
mission.careerSetup.showInFreeroam = false
local finalList = {}
for _, mission in ipairs(missionList) do
if editHelper then
for _, elem in ipairs(editHelper.elements) do
if elem.displayOptions and elem.displayOptions.isTranslation then
table.insert(keys,"noStarUnlocked")
for _, key in ipairs(keys) do
local t = mission.careerSetup.starOutroTexts[key]
local count = 0
for _, elem in ipairs(translation) do
if elem ~= "" and translateLanguage(elem, "NoTranslation!") ~= "NoTranslation!" then
local translationJson = {}
for _, elem in ipairs(finalList) do
table.insert(translationStrings,string.format('"%s": "%s"', elem.key, elem.value))
local function applyTranslation()
for _, elem in ipairs(translationData.translation) do
if elem.starText then
for _, win in ipairs(windows) do
win:setMission(clickedMission)
local changedMissioncount = 0
for _, m in ipairs(missionList or {}) do
if m._dirty then changedMissioncount = changedMissioncount + 1 end
if im.MenuItem1("Save All ("..changedMissioncount..")") then
for _, m in ipairs(missionList) do
if m._dirty then
if lastShownMission then
for _, f in ipairs(FS:findFiles(lastShownMission.missionFolder, "*", -1, true, false)) do
table.insert(files, f)
table.sort(dirs)
for _, f in ipairs(files) do
im.Text(f)
im.Separator()
for _, d in ipairs(dirs) do
im.Text(d)
if im.MenuItem1("PERMANENTLY delete mission") then
for _, f in ipairs(files) do
FS:removeFile(f)
table.sort(dirs, function(a,b) return a>b end)
for _, d in ipairs(dirs) do
FS:directoryRemove(lastShownMission.missionFolder .. '/'..d)
local newMissions = {}
for _, m in ipairs(missionList) do
if m.id ~= lastShownMission.id then
local sortedFunctions = tableKeysSorted(helper)
for _, funName in ipairs(sortedFunctions) do
if string.startswith(funName, "customFunction") then
helper[funName](helper, clickedMission, M)
for _, win in ipairs(windows) do
win:setMission(clickedMission)
if im.MenuItem1("All Mission of same type: " ..funName) then
for _, m in ipairs(missionList) do
if m.missionType == clickedMission.missionType then
end
for _, win in ipairs(windows) do
win:setMission(clickedMission)
local instance = gameplay_missions_missions.getMissionById(clickedMission.id)
for _, key in ipairs(instance.sortedStarKeys or {}) do
if im.MenuItem1("Generate one attempt with star: " .. key) then
gameplay_missions_progress.startBatchMode()
for _, mission in ipairs(missionList) do
gameplay_missions_progress.generateAttempts(mission.id, 1 + math.floor(math.random()*4))
gameplay_missions_progress.startBatchMode()
for _, mission in ipairs(missionList) do
if math.random() < 0.5 then
end
for _, fl in ipairs(filterNamesSorted) do
if filter[fl.key] then
im.BeginTooltip()
for _, elem in ipairs(groupFilterText) do
im.BulletText(elem)
if im.BeginCombo("##GroupMissions", "Grouping: " .. grouping.mode) then
for _, gr in ipairs(groupingNamesSorted) do
if im.Selectable1(gr.name, gr.key == grouping.mode) then
im.PopItemWidth()
for _, fl in ipairs(filterNamesSorted) do
local bl = im.BoolPtr(filter[fl.key])
if missionSearchDisplayResult then
for _, item in ipairs(missionSearchResults) do
displayMissionSelector(item.data)
if grouping.mode == "none" then
for k,missionData in ipairs(missionList) do
displayMissionSelector(missionData)
else
for _, key in ipairs(grouping.sortedKeys) do
displayed = true
if M.forceOpenTree then
for k,missionData in ipairs(grouping.missions[key]) do
if missionData.id == (hoveredMission or clickedMission or {}).id then
if im.TreeNode1(key.." ("..#grouping.missions[key]..")"..'##'..key.."missionEditorGrouping") then
for k,missionData in ipairs(grouping.missions[key]) do
local other = nil
if shownMission then
for _, win in ipairs(windows) do
win:setMission(shownMission)
if showWindows.generalWindows then
for idx, win in ipairs(generalWindows) do
im.PushID1("generalWindows" .. idx.."_"..shownMission.id)
if showWindows.additionalWindows then
for idx, win in ipairs(additionalWindows) do
im.PushID1("additionalWindows" .. idx.."_"..shownMission.id)
if showWindows.setupModulesWindows then
for idx, win in ipairs(setupModulesWindows) do
im.PushID1("setupModulesWindows" .. idx.."_"..shownMission.id)
if showWindows.missionTypeWindows then
for idx, win in ipairs(missionTypeWindows) do
im.PushID1("missionTypeWindows" .. idx.."_"..shownMission.id)
end
for _, tab in ipairs(tabs) do
selectTab = nil
end
for k,missionData in ipairs(missionList) do
if missionData.id == id then
if instant then
for _, win in ipairs(windows) do
win:setMission(clickedMission)
if oldId then
for _,m in ipairs(missionList) do
if m.id == oldId then
clickedMission = m
for _, win in ipairs(windows) do
win:setMission(m)
@/lua/ge/extensions/util/decalRoadsEditor.lua
local fadeEnd = 250
for _, AIPathName in ipairs(scenetree.findClassObjects('AIPath')) do
local o = scenetree.findObject(AIPathName)
@/lua/vehicle/controller/propAnimation/hPattern.lua
local supportedGearboxLookup = {}
for _, gearboxType in ipairs(supportedGearboxTypes) do
supportedGearboxLookup[gearboxType] = true
@/lua/ge/extensions/editor/api/dynamicDecals.lua
local res = 0
for k, v in ipairs(children) do
res = res + 1 + getChildrenCountRec(v.children)
if layer.children and #layer.children then
for _, childLayer in ipairs(layer.children) do
local childData = serializeLayer(childLayer)
for _, maskLayer in ipairs(layer.mask.layers) do
local maskData = serializeLayer(maskLayer)
if layer.children and #layer.children > 0 then
for _, childData in ipairs(layer.children) do
local childLayer = deserializeLayer(childData)
for _, maskLayer in ipairs(layer.mask.layers) do
local maskData = deserializeLayer(maskLayer)
local loadingMode = {}
for _, mode in ipairs(M.loadingModes) do loadingMode[mode.key] = mode.value end
M.layerTypes = {
for _, cat in pairs(M.properties) do
for _, prop in ipairs(cat) do
if not prop.value then prop.value = shallowcopy(prop.default) end
local materials = {}
for _, mat in ipairs(partMaterials) do
materials[mat] = true
local function checkLayers(layers)
for k, layer in ipairs(layers) do
if res.layers[layer.uid] then
local res
for k, layer in ipairs(layers) do
if layer.uid == layerUid then return layer end
if layer.mask then
for kk, maskLayer in ipairs(layer.mask.layers) do
if maskLayer.uid == layerUid then return maskLayer end
local function _setLayerInCollection(collection, layerUid, layerData)
for k, layer in ipairs(collection) do
if layer.uid == layerUid then
if layer.mask then
for kk, maskLayer in ipairs(layer.mask.layers) do
if maskLayer.uid == layerUid then
if layer.mask then
for _, maskLayer in ipairs(layer.mask.layers) do
maskLayer.uid = getRandomUid()
if layer.children and #layer.children > 0 then
for _, childLayer in ipairs(layer.children) do
setRandomLayerUidRec(childLayer)
local materialsUsed = {}
for _, id in ipairs(M.getMaterialIndices()) do
table.insert(materialsUsed, materials[id])
local found = 0
for _, matName in ipairs(materialsUsed) do
local matSkinPresetName = matName .. ".skin.dynamicTextures"
local layerCopy = deepcopy(layer)
for _, cpos in ipairs(layerCopy.dataPoints) do
cpos.x = cpos.x + cursorPosOffset.x
local layerCopy = deepcopy(layer)
for _, cpos in ipairs(layerCopy.dataPoints) do
cpos.x = cpos.x + cursorPosOffset.x
if layer.children then
for _, child in ipairs(layer.children) do
moveLayerCursorPos(child, cursorPosOffset)
local invParent = parentTransformOld:copy():inverse()
for _, child in ipairs(layer.children) do
if child.type == M.layerTypes.decal then
local function deserializeLayerStack(layerStackData)
for _, layer in ipairs(layerStackData) do
local lyr = deserializeLayer(layer)
@/lua/ge/extensions/core/sounds.lua
missionMarkerInteraction = false
for i,v in ipairs(elemData) do
if v.type == "mission" then
@/lua/ge/extensions/flowgraph/modules/prefabModule.lua
if not ignoredClasses[k] then
for _, id in ipairs(v) do
local name = scenetree.findObjectById(id):getName() or ""
local contains = false
for _, id in ipairs(data.allChildrenIds['TSStatic'] or {}) do
if not contains then
local transforms = {}
for _, id in ipairs(data.allChildrenIds['BeamNGVehicle'] or {}) do
local veh = scenetree.findObjectById(id)
for _, id in ipairs(data.allChildrenIds['BeamNGWaypoint'] or {}) do
if not requires then
if not requires then
for _, id in ipairs(data.allChildrenIds['DecalRoad'] or {}) do
if not requires then
local rebuildNavgraph = false
for _, id in ipairs(self.sortedIds) do
local data = self.prefabs[id]
@/lua/vehicle/extensions/couplings.lua
local fiftwheels = controller.getControllersByType("couplings/fifthwheel")
for _, fifthwheel in ipairs(fiftwheels) do
fifthwheel.setFifthwheelIndicatorVisibility(true)
local fiftwheels = controller.getControllersByType("couplings/fifthwheel")
for _, fifthwheel in ipairs(fiftwheels) do
fifthwheel.setFifthwheelIndicatorVisibility(false)
local fiftwheels = controller.getControllersByType("couplings/fifthwheel")
for _, fifthwheel in ipairs(fiftwheels) do
fifthwheel.detachFifthwheel()
local fiftwheels = controller.getControllersByType("couplings/fifthwheel")
for _, fifthwheel in ipairs(fiftwheels) do
if fifthwheel.isAttached() then
@/lua/ge/extensions/flowgraph/nodes/recording/recordCamera.lua
local oldT = self.path[1].time
for k,v in ipairs(self.path) do
local currentMarker = createObject("Marker")
@/gameplay/missionTypes/scatterPickup/customNodes/scatterAnimatorNode.lua
if not self.mgr.scatterPickup then return end
for _, e in ipairs(self.mgr.scatterPickup.states or {}) do
if e.collected and e.animationTimer <= animationMax then
for _, icon in ipairs(self.mgr.scatterPickup.icons) do
icon.visible = icon.remaining > 0
function C:onDrawOnMinimap(td)
for _, icon in ipairs(self.mgr.scatterPickup.icons) do
if icon.remaining > 0 then
function C:onDrawOnMinimapBorder(td)
for _, icon in ipairs(self.mgr.scatterPickup.icons) do
if icon.remaining > 0 then
@/lua/common/extensions/networking/editorToolchain.lua
local nodes = playerVehicle.vdata.nodes
for _, nodeName in ipairs(data.nodes) do
local nodeFound = false
local nodeFound = false
for _, node in ipairs(nodes) do
if node.name == nodeName then
local vehPos = veh:getPosition()
for _, node in ipairs(selectedNodes) do
local npos = veh:getNodePosition(node.cid) + vehPos
for connection, subs in pairs(subscriptions) do
for _, sub in ipairs(subs) do
if sub.type == 'nodePositions' and sub.what == '*' and veh and vData then
@/lua/ge/extensions/gameplay/rally/transcripts/path.lua
function C:drawDebugTranscripts(selected_id)
for i,tsc in ipairs(self.transcripts.sorted) do
local is_hovered = self._draw_debug_hover_tsc_id == tsc.id
@/lua/ge/extensions/gameplay/drift/scoring.lua
if driftScore.cachedScore and driftScore.cachedScore > 0 then
for i, t in ipairs(driftTiers) do
if driftScore.cachedScore >= t.minScore then
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veJBeamPicker.lua
for k, objData in ipairs(hitObjects) do
if k >= 2 then
-- Generate lookup table for pickedNodes index based on node ID
for k,v in ipairs(pickedNodes) do
pickedNodesCIDs[v.cid] = k
-- Get list of nodes hovered over by mouse cursor
for _, i in ipairs(nodesAvaliable) do
local node = vEditor.vdata.nodes[i]
-- Generate lookup table for pickedBeams index based on beam ID
for k,v in ipairs(pickedBeams) do
pickedBeamsCIDs[v.cid] = k
-- Get list of beams hoverd over by mouse cursor
for _, i in ipairs(beamsAvaliable) do
local beam = vEditor.vdata.beams[i]
if im.BeginCombo("##nodeDataCombobox", "Set node data to view...", im.ComboFlags_HeightLarge) then
for _, v in ipairs(nodeDataRendering) do
if im.Checkbox(v.name .. "##nodeDataRenderingCheckbox", v.enabled) then end
if im.BeginCombo("##beamDataCombobox", "Set beam data to view...", im.ComboFlags_HeightLarge) then
for _, v in ipairs(beamDataRendering) do
if im.Checkbox(v.name .. "##beamDataRenderingCheckbox", v.enabled) then end
table.clear(pickedNodesCIDs)
for k,v in ipairs(pickedNodes) do
pickedNodesCIDs[v.cid] = k
table.clear(pickedBeamsCIDs)
for k,v in ipairs(pickedBeams) do
pickedBeamsCIDs[v.cid] = k
for pickedNodesKey, node in ipairs(pickedNodes) do
local nodeID = node.cid
im.Text("Average over last " .. plotLen .. " frames")
for _, v in ipairs(nodeDataRendering) do
if v.enabled[0] then
local function renderPickedBeamsTree()
for pickedBeamsKey, beam in ipairs(pickedBeams) do
local beamID = beam.cid
im.Text("Average over last " .. plotLen .. " frames")
for _, v in ipairs(beamDataRendering) do
if v.enabled[0] then
@/lua/ge/extensions/gameplay/util/crashDetection.lua
-- Show legend with colored text
for _, series in ipairs(graphGroups[graphNum]) do
if series.color then
for seriesIndex, series in ipairs(graphGroups[graphNum]) do
chartData[seriesIndex] = {}
@/lua/ge/extensions/ui/vehicleSelector/vehicleOperations.lua
if details and details.buttonInfo then
for _, button in ipairs(details.buttonInfo) do
if button.isDoubleClickAction or #details.buttonInfo == 1 then
@/lua/ge/extensions/editor/main.lua
M.allExtensionNames = {}
for _, filename in ipairs(extensionFiles) do
if isFileAnEditorExtension(filename) then
local function loadEditorExtensions(names)
for _, name in ipairs(names) do
extensions.load(name)
for _, name in ipairs(names) do
if extensions[name].onEditorRegisterApi then
M.log("Unloading " .. tableSize(M.extensionNames) .. " editor extensions...")
for _, name in ipairs(M.extensionNames) do
extensions.unload(name)
local function unloadEditorExtension(extName)
for i, name in ipairs(M.extensionNames) do
if extName == name then
local function pushVehicleActionMapsEnabled()
for _, mapName in ipairs(vehicleActionMaps) do
local map = scenetree.findObject(mapName)
local function popVehicleActionMapsEnabled()
for _, mapName in ipairs(vehicleActionMaps) do
if mapsEnabledStateBefore[mapName] ~= nil then
-- first allow extensions to register their preferences
for _, val in ipairs(M.extensionNames) do
if extensions.isExtensionLoaded(val) and extensions[val].onEditorRegisterPreferences then
timer:stopAndReset()
for _, val in ipairs(M.extensionNames) do
if extensions.isExtensionLoaded(val) and extensions[val].onEditorInitialized then
-- clear selected objects flags
for _, objId in ipairs(editor.selection.object) do
local obj = scenetree.findObjectById(objId)
--TODO: remove this, if we'll use the disable action maps on editor open strategy
for _, actionMap in ipairs(M.additionalActionMaps) do
popActionMap(actionMap)
@/lua/vehicle/scriptai.lua
for _, s in ipairs(script) do
s.t = s.t - timeOffset
for _, s in ipairs(script) do
s.t = s.t - timeOffset
if M.debugMode == "all" or M.debugMode == "path" then
for _, s in ipairs(script) do
debugDrawer:drawSphere(0.2, vec3(s), color(255, 0, 0, 255))
@/lua/common/interpolatedMap.lua
else
for xIndex, xValue in ipairs(self.xIndices) do
if x >= xValue and x < self.xIndices[xIndex + 1] then
else
for yIndex, yValue in ipairs(self.yIndices) do
if y >= yValue and y < self.yIndices[yIndex + 1] then
self.data = {}
for yIndex, rowData in ipairs(data) do
if yIndex > 1 then
local row = {}
for xIndex, value in ipairs(rowData) do
if xIndex > 1 then
@/lua/ge/extensions/flowgraph/nodes/math/ease.lua
if im.BeginCombo("##easeFunc" .. self.id, self.easeFuncName) then
for _, fun in ipairs(easeFuncNameList) do
if im.Selectable1(fun, fun == self.easeFuncName) then
@/lua/common/utils/filterchain.lua
table.insert(newList, 'examine("** starting input:")')
for i, v in ipairs(filterlist) do
table.insert(newList, 'examine(" ** step ' .. i .. ' - input: ",'..#commonFilterArguments..')')
for i, v in ipairs(filterlist) do
table.insert(data.f, load("return " .. v, nil, "t", F)())
@/lua/vehicle/controller/advancedCouplerControl.lua
local distance = math.huge
for _, cid2 in ipairs(cnp.availableCid2) do
local d = obj:nodeLength(cnp.cid1, cid2)
local currentStates = {}
for _, coupler in ipairs(couplerGroup.couplerNodePairs) do
currentStates[coupler.state] = true
if couplerGroup.groupType == couplerGroupTypes.manualClose or couplerGroup.groupType == couplerGroupTypes.manualCloseMultiPoint then
for _, cnp in ipairs(couplerGroup.couplerNodePairs) do
if cnp.state == couplerStates.detached then
for _, cnp in ipairs(couplerGroup.couplerNodePairs) do
obj:detachCoupler(cnp.cid1, 0)
local canApplyOpenForce = true
for _, condition in ipairs(couplerGroup.openForceConditions) do
local couplerController = controller.getController(condition.advancedCouplerControlName)
local controllerMatchesRequiredStates = false
for _, requiredState in ipairs(condition.requiredStates) do
controllerMatchesRequiredStates = couplerControllerState == requiredState or controllerMatchesRequiredStates
local function toggleGroupConditional(conditions)
for _, c in ipairs(conditions) do
if #c < 2 then
local activatedAutoLatches = {}
for key, couplerIndex in ipairs(autoLatchesToActivate) do
local cnp = couplerGroup.couplerNodePairs[couplerIndex]
for _, key in ipairs(activatedAutoLatches) do
table.remove(autoLatchesToActivate, key)
if couplerGroup.groupState == couplerStates.autoCoupling and couplerGroup.groupType == couplerGroupTypes.manualCloseMultiPoint then
for _, cnp in ipairs(couplerGroup.couplerNodePairs) do
local foundCloserNode = updateCid2(cnp, true)
couplerGroup.openForceTimer = couplerGroup.openForceTimer - dt
for _, cnp in ipairs(couplerGroup.couplerNodePairs) do
obj:applyForceTime(cnp.applyForceCid2, cnp.applyForceCid1, -couplerGroup.openForceMagnitude * couplerGroup.invCouplerNodePairCount, dt)
couplerGroup.closeForceTimer = couplerGroup.closeForceTimer - dt
for _, cnp in ipairs(couplerGroup.couplerNodePairs) do
obj:applyForceTime(cnp.applyForceCid2, cnp.applyForceCid1, couplerGroup.closeForceMagnitude * couplerGroup.invCouplerNodePairCount, dt)
local function registerExternalCouplerBreakGroups()
for _, couplerBreakGroupData in ipairs(externalCouplerBreakGroups) do
beamstate.registerExternalCouplerBreakGroup(couplerBreakGroupData.breakGroup, couplerBreakGroupData.cid)
couplerGroup.groupState = couplerStates.detached
for _, cnp in ipairs(couplerGroup.couplerNodePairs) do
cnp.state = couplerStates.detached
for _, cnp in ipairs(nodeData) do
local couplerNodePairData = {
couplerGroup.couplerNodeIdLookup[couplerNodePairData.cid1] = #couplerGroup.couplerNodePairs
for _, cid2 in ipairs(couplerNodePairData.availableCid2) do
couplerGroup.couplerNodeIdLookup[cid2] = couplerGroup.couplerNodeIdLookup[couplerNodePairData.cid1]
@/lua/ge/extensions/gameplay/missions/missionTypes/flowMission.lua
for i, v in ipairs(setupModule.vehicles) do
local model = core_vehicles.getModel(v.model or "").model
local values = {{l = "ui.common.default", v = self.setupModules.environment.time}}
for _, t in ipairs(timesSorted) do
table.insert(values, {l = "ui.quickrace.tod."..t, v = times[t]})
function C:setPreviewsForCustomVehicles(userSettings)
for _, s in ipairs(userSettings or {}) do
if s.type == "select" and s.isVehicleSelector then
if s.type == "select" and s.isVehicleSelector then
for _, v in ipairs(s.values) do
if v.type == "custom" and v.viaUserSettingsKey == 'setupModuleVehiclesCustom' then
local viaSetting = nil
for _, l in ipairs(userSettings) do
if l.key == v.viaUserSettingsKey then
local viaKey = nil
for _, s in ipairs(settings) do
if s.key == 'setupModuleVehicles' then
local flat = {}
for _, e in ipairs(entryFee) do
flat[e.attributeKey] = e.rewardAmount
for _, veh in ipairs(getAllVehicles()) do
if veh:isReady() then
local byId = {}
for _, btn in ipairs(results) do
if not byId[btn.id] or (btn.active and not byId[btn.id].active) then
local rulesFiles = {}
for _, layer in ipairs(self.layers or {}) do
local rulesFolder = layer.dir .. "rules/"
end)
for _, file in ipairs(rulesFiles) do
local content = readFile(file):gsub("\r\n","")
local entries = {}
for _, page in ipairs(self:getRules()) do
local entry = {
local scriptHooks = {'onVehicleReset'}
for _, hook in ipairs(scriptHooks) do
C[hook] = function(self, ...)
@/lua/ge/extensions/ui/gameplaySelector/tiles.lua
local generatorFiles = FS:findFiles('lua/ge/extensions/ui/gameplaySelector/tileGenerators/', '*.lua', 1, true, false)
for _, filePath in ipairs(generatorFiles) do
-- Get relative path from tileGenerators folder and convert to extension name format
@/lua/ge/extensions/editor/gen/world.lua
local objects = extensions.editor_resourceChecker_resourceUtil.getSimObjects(v)
for _, obj in ipairs(objects) do
obj.doubleSided = true
local materials = {} --'m_metal_brushed'}
for _,map in ipairs(terrainImpExp.textureMaps) do
table.insert(materials, map.material)
local terrainBlockProxies = {}
for _, name in ipairs(scenetree.findClassObjects("TerrainBlock")) do
lo('?? ifTB:'.._..':'..name) --tostring(scenetree.findClassObjects("TerrainBlock")))
for dae,list in pairs(desctop.df) do
for i,key in ipairs(list) do
if dbg then lo('?? fC_key:'..key..':'..tostring(dforest[key].item)) end
for dae,list in pairs(df) do
for i,key in ipairs(list) do
editor.removeForestItem(fdata, dforest[key].item)
if desc.achild then
for _,b in ipairs(desc.achild) do
if b.yes then
end
for k,key in ipairs(desc.df[desc.win]) do
local modper = (k - desc.balcony.ind[1])%per
for d,list in pairs(w.df) do
for _,key in ipairs(list) do
lo('?? ftype:'..tostring(dforest[key].type))
local vn = w.u:cross(vec3(0,0,1)):normalized()
for _,key in ipairs(w.df[w.win]) do
if cedit.fscope ~= 1 or key == cedit.forest then
elseif w.df[forestMeshName] then
for _,key in ipairs(w.df[forestMeshName]) do
if cedit.fscope ~= 1 or key == cedit.forest then
if pop and ({balcony=1, pillar=1})[ddae[forestMeshName].type] and w.df[forestMeshName] then
for _,key in ipairs(w.df[forestMeshName]) do
out.aforest[#out.aforest + 1] = dforest[key].item:getPosition()
end
for _,key in ipairs(desc.df[desc.roofborder[1]]) do
out.avedit[#out.avedit + 1] = dforest[key].item:getPosition() + vec3(0,0,0.1)
for dae,list in pairs(w.df) do
for _,key in ipairs(list) do
-- lo('?? for_key:'..key..':'..tostring(dforest[key]))
if w.df[w.win] then
for _,key in ipairs(w.df[w.win]) do
dforest[key].mesh = id
--- link doors
for _,key in ipairs(w.df[w.door]) do
dforest[key].mesh = id
for dae,list in pairs(desctop.df) do
for _,key in ipairs(list) do
-- lo('??_____to_LINK:'..key..':'..id)
for d,list in pairs(w.df) do
for _,k in ipairs(list) do
if k == key then
@/lua/common/extensions/ui/flowgraph/editor.lua
if im.BeginCombo("##type" .. variable.index .. name, variable.type) then
for _, type in ipairs(source:getTypes()) do
source.mgr:DrawTypeIcon(type.name, true, 1)
if im.BeginCombo("##mergeStrat" .. variable.index .. name, variable.mergeStrat) then
for _, strat in ipairs(source:getMergeStrats(variable.type)) do
if im.Selectable1(strat.name, variable.mergeStrat == strat.name) then
if self.models and self.model then
for _, m in ipairs(self.models) do
if m.key == self.model then
self.configs = sortedConfigs
for _, m in ipairs(self.configs) do
if m.key == self.config then
if im.BeginCombo("##vehType" .. dumps(self.id), self.vehType) then
for _, t in ipairs({ 'Car', 'Truck', 'Prop', 'Trailer', 'Utility', 'Unknown', 'Any'}) do
if im.Selectable1(t, t == self.vehType) then
if im.BeginCombo("##models" .. dumps(self.id), self.modelName .. " [" .. self.model .. "]") then
for _, m in ipairs(self.models) do
if m.Type == self.vehType or self.vehType == 'Any' then
if im.BeginCombo("##configs" .. dumps(self.id), self.configName .. " [" .. self.config .. "]") then
for _, m in ipairs(self.configs) do
if im.Selectable1((dumps(m.value.Name) .. " [" .. m.key .. "]"), m.key == self.config) then
vehSearch:startSearch(ffi.string(vehSearchTxt))
for mIdx, m in ipairs(self.models) do
for cIdx, c in pairs(core_vehicles.getModel(m.key).configs) do
im.BeginChild1("Scroller", im.GetContentRegionAvail())
for _, result in ipairs(vehSearchResults) do
im.BeginChild1(result.id, im.ImVec2(im.GetContentRegionAvailWidth(), 20 * editor.getPreference("ui.general.scale")))
@/lua/ge/extensions/editor/preferences.lua
for _, pageName in ipairs(sortedByIndex) do
pageItemGui(pageName, preferencesPages[pageName])
for _, pageName in ipairs(sortedByName) do
pageItemGui(pageName, preferencesPages[pageName])
-- prefilter the subcategories for the search term, if no items visible/match then do not show the subcategory
for _, subCat in ipairs(cat.subcategories) do
subCat.visibleOnSearch = false
-- show the visible subcategories and their items
for _, subCat in ipairs(cat.subcategories) do
if subCat.visibleOnSearch and imgui.CollapsingHeader1(subCat.label, nodeFlags) then
else
for _, pageName in ipairs(sortedByIndex) do
if pageName ~= "all" then
for _, pageName in ipairs(sortedByName) do
pageGui(editor.preferencesRegistry:findCategory(pageName))
preferencesPages = {}
for _, cat in ipairs(editor.preferencesRegistry.categories) do
-- check to see if it has any visible subcateg items
local hasVisibleItems = false
for _, subCat in ipairs(cat.subcategories) do
for _, item in ipairs(subCat.items) do
for _, subCat in ipairs(cat.subcategories) do
for _, item in ipairs(subCat.items) do
if not item.hidden then hasVisibleItems = true break end
@/lua/ge/extensions/editor/decalEditor.lua
for _,instanceData in ipairs(actionData.instancesData) do
local instance = editor.addDecalInstanceWithTanForceId(instanceData.position, instanceData.normal,
selectedInstances = {}
for _,instanceData in ipairs(actionData.instancesData) do
local instance = editor.addDecalInstanceWithTanForceId(instanceData.position, instanceData.normal, instanceData.tangent, instanceData.template, instanceData.size, instanceData.textureRectIdx, 3, 1, instanceData.id)
local function deleteInstanceActionRedo(actionData)
for _,instanceData in ipairs(actionData.instancesData) do
local instance = editor.getDecalInstance(instanceData.id)
im.BeginChild1("Instances", im.ImVec2(0,300), true)
for _, templateName in ipairs(templateNamesSorted) do
if im.TreeNode1(templateName) then
if im.TreeNode1(templateName) then
for _, instance in ipairs(instances[templateName]) do
local flags = bit.bor(im.TreeNodeFlags_Leaf, isSelected(instance) and im.TreeNodeFlags_Selected or 0)
@/lua/ge/extensions/util/trackBuilder/segmentToProceduralMesh.lua
--segment.shape = "square"
for _,controlPoint in ipairs(segment.points) do
if controlPoint.quality[segment.quality] then
@/lua/ge/extensions/editor/rallyEditor/notebookInfo.lua
local issues = "Issues (".. (#self.path.validation_issues) .."):\n"
for _, issue in ipairs(self.path.validation_issues) do
issues = issues..'- '..issue..'\n'
if im.BeginCombo("Audio Mode##notebookAudioMode", notebookAudioMode) then
for _, mode in ipairs(RallyEnums.pacenoteAudioModeNames) do
if mode ~= "auto" then
-- if im.BeginCombo("Driveline Mode##notebookDrivelineMode", notebookDrivelineMode) then
-- for _, mode in ipairs(RallyEnums.drivelineModeNames) do
-- if im.Selectable1(mode, mode == notebookDrivelineMode) then
im.BeginChild1("codrivers", im.ImVec2(125 * im.uiscale[0], tabContentsHeight), im.WindowFlags_ChildWindow)
for _,codriver in ipairs(self.path.codrivers.sorted) do
local codriverName = codriver.name
local isLastCodriver = false
for _, langInfo in ipairs(langSet) do
if langInfo.language == lang then
@/lua/common/extensions/ui/improfiler.lua
local ann = prof_ann
for _, file in ipairs(files) do
local f0 = file:byte()
@/lua/ge/extensions/career/modules/playerAttributes.lua
attributes["vouchers"] = deepcopy(baseAttribute)
for _, branch in ipairs(career_branches.getSortedBranches()) do
attributes[branch.attributeKey] = deepcopy(baseAttribute)
-- Update old attribute names in the log to new names for backwards compatibility
for _, change in ipairs(attributeLog) do
if change.attributeChange then
}
for _, change in ipairs(arrayReverse(deepcopy(attributeLog))) do
if change.attributeChange.money then
}
for _, change in ipairs(arrayReverse(deepcopy(attributeLog))) do
if change.reason.tags.gameplay then
local rewards = {}
for _, key in ipairs(career_branches.orderAttributeKeysByBranchOrder(tableKeys(change.attributeChange))) do
if key:endswith("Reputation") then
@/lua/ge/extensions/flowgraph/nodes/activity/getProgress.lua
local keysSorted = tableKeysSorted(aggregate)
for _, k in ipairs(keysSorted) do
local val = aggregate[k]
@/gameplay/missionTypes/aiRace/constructor.lua
local ret = {}
for i, nId in ipairs(path.config.linearSegments or {}) do
local node = path.pathnodes.objects[nId]
self.cachedWorldPreviewRoute = {}
for _, p in ipairs(ret) do
table.insert(self.cachedWorldPreviewRoute, {pos = p})
@/lua/ge/extensions/editor/fileDialog.lua
local res = false
for _, p in ipairs(pattern) do
local file_name = options.case_sensitive_match and file.name or string.lower(file.name)
pattern = {}
for k, ext in ipairs(options.suffix[fileTypeSelected][2]) do
local p ,_ = ext:gsub("%.","%%.")
local validName
for _, fn in ipairs(files) do
local s = FS:stat(fn)
local cols = {}
for _, column in ipairs(columns) do
cols[column.name] = column.visible
local res = suffix[1] .."("
for k, ext in ipairs(suffix[2]) do
res = (k ~= #suffix[2]) and (res .. "*" .. ext .. ", ") or (res .. "*" .. ext)
im.Begin(smartSearchItemsWindowName, editor.getWindowVisibleBoolPtr(smartSearchItemsWindowName), im.WindowFlags_NoTitleBar + im.WindowFlags_NoResize + im.WindowFlags_NoMove + im.WindowFlags_NoFocusOnAppearing)
for _, file in ipairs(fileCache) do
if not (options.select_folder and file.filetype ~= 'dir') then
im.Separator()
for i, f in ipairs(favs or {}) do
if im.MenuItem1(f..'##'..i) then
if im.BeginPopup("ColumnContextMenu", nil, im.WindowFlags_AlwaysAutoResize) then
for _, column in ipairs(columns) do
if column.lockedVisibility and column.lockedVisibility == true then im.BeginDisabled() end
columnCount = 0
for _, column in ipairs(columns) do
if column.visible and column.visible == true then
if fileViewColumnWidth and columnCount > 1 then
for k, width in ipairs(fileViewColumnWidth) do
if k <= im.GetColumnsCount() and im.GetColumnsCount() > 1 then
for _, column in ipairs(columns) do
if column.visible and column.visible == true then
if not (options.select_folder and file.filetype ~= 'dir') then
for k, column in ipairs(columns) do
if column.visible and column.visible == true then
if im.BeginCombo("##file_type", getFiletypeLabel(options.suffix[fileTypeSelected])) then
for i,v in ipairs(options.suffix) do
if im.Selectable1(getFiletypeLabel(v), i == fileTypeSelected) then
local found = false
for _, file in ipairs(fileCache) do
if file.name == fName or file.nameWithoutExt == fName then
im.Begin("recentDirs", editor.getWindowVisibleBoolPtr(recentDirsWindowName), im.WindowFlags_NoTitleBar + im.WindowFlags_NoResize + im.WindowFlags_NoMove + im.WindowFlags_NoScrollbar)
for _, dir in ipairs(recentDirs) do
if im.Selectable1(dir) then
for columnName, visible in pairs(cols) do
for _, column in ipairs(columns) do
if columnName == column.name then
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
local function indexOf(table, value)
for i,v in ipairs(table) do
if v == value then return i end
local old
for i, v in ipairs(values) do
im.SetCursorPosX(pos[i])
-- check wether track exists, or we can save preview/pack to mod
for _,file in ipairs(saveSettings.trackNames) do
if file == name then
allowScreenshot = true
for _,preview in ipairs(saveSettings.previewNames) do
if preview == name then
im.BeginChild1("LoadBox")
for _,file in ipairs(saveSettings.trackNames) do
if im.ImGuiTextFilter_PassFilter(loadFilesFilter, file) then
local name
for i, o in ipairs(modifierValues.obstacles.list) do
if o.active then
im.NextColumn()
for i,cp in ipairs(currentCheckpointList) do
if currentIndex == cp.segmentIndex then
for _, a in ipairs(angles) do
local p = a/180 * math.pi + math.pi
table.insert(mergeList,{sub = subTrackIndex[0], index = #tb.getPieceInfo(nil, sub).pieces, segment = tb.getSegmentInfo(pieceCount, sub), reverse = false})
for _, a in ipairs(angles) do
im.Text("Number of Pieces:" .. #currentMergeList)
for _, seg in ipairs(currentMergeList) do
if seg.reverse then
-- local collision = false
-- for j, p in ipairs(windowPositions) do
-- if math.abs(window[0].Pos.x - p.x) < 5 and math.abs(window[0].Pos.y - p.y) < 5 then
local obstacles = {}
for i, o in ipairs(from.list) do
if o.active then
@/lua/ge/spawn.lua
local res = {}
for index, clusterId in ipairs(nodes) do
if clusterId == targetClusterId then
for _, nodeId in ipairs(nodesInMainCluster) do
if veh:getInitialNodeCollision(nodeId) == 3 then
local localBB = Box3F()
for i, nodePosition in ipairs(nodePositions) do
nodePositions[i] = vehRot:inversed() * nodePosition
for _, nodePos in ipairs(vehicleNodes[vehID]) do
if otherVehicleLarge then
for _, otherId in ipairs(gameplay_traffic.getTrafficList()) do
if otherId ~= vehID and (not map.isCrashAvoidable(otherId, bbCenter, vehRadius) or intersectingOtherVehicle(getObjectByID(otherId), axis0, axis1, axis2, halfExtentsX, halfExtentsY, halfExtentsZ, bbCenter)) then
@/lua/ge/extensions/flowgraph/nodes/vehicle/randomConfigProvider.lua
self.options = {}
for _, v in ipairs(vehs) do
if v.model.Type == 'Car' then
@/lua/ge/extensions/flowgraph/nodes/input/blacklistActionFilter.lua
self.activeTemplates = {}
for _, key in ipairs(defaultActiveTemplates) do
self.activeTemplates[key] = true
-- todo: make more pretty
for i, key in ipairs(self.sortedTemplateKeys) do
if im.Checkbox(key.."##cbaf"..i, im.BoolPtr(self.activeTemplates[key] or false)) then
@/lua/ge/extensions/util/vehicleRopeDebug.lua
local ropes = {}
for _, ropeId in ipairs(vehicle.ropeIds) do
local rope = getRopeVisual(ropeId)
local minMass, maxMass = math.huge, 0
for _, node in ipairs(nodes) do
if node.mass then
local allRopes = getCurrentVehicleRopes()
for _, entry in ipairs(allRopes) do
local rope = getRopeVisual(entry.id)
local nodes = rope:getNodes()
for i, node in ipairs(nodes) do
if rayIntersectsSphere(rayOrigin, rayDir, node.pos, 0.1) then
local simSum = 0
for _, t in ipairs(perfStats.totalSimTimes) do
simSum = simSum + t
local renderSum = 0
for _, t in ipairs(perfStats.totalRenderTimes) do
renderSum = renderSum + t
for _, entry in ipairs(allRopes) do
local ropeId = entry.id
simStats.max = 0
for _, t in ipairs(simStats.times) do
sum = sum + t
simStats.spikes = 0
for _, t in ipairs(simStats.times) do
if t > perfStats.spikeThreshold * simStats.avg then
local activeRopeIds = {}
for _, entry in ipairs(allRopes) do
activeRopeIds[entry.id] = true
local allRopes = getCurrentVehicleRopes()
for _, entry in ipairs(allRopes) do
local rope = getRopeVisual(entry.id)
for _, entry in ipairs(allRopes) do
local ropeStats = getRopePerfStats(entry.id)
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/imDialogue.lua
im.Text(tostring(self.id))
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
for i, btn in ipairs(self.options) do
self.pinOut[btn].value = false
@/lua/ge/extensions/career/modules/vehicleClassGrouping.lua
local groupModels, groupModelsToConfigs = {}, {}
for _, v in ipairs(group.data) do
if not groupModelsToConfigs[v.model] then
repeat -- repeats until groupModelsToConfigs is empty
for _, model in ipairs(groupModels) do
if groupModelsToConfigs[model][1] then
@/lua/ge/extensions/flowgraph/modules/vehicleModule.lua
function C:onUpdate()
for _, id in ipairs(self.sortedIds) do
local data = self.vehicles[id]
function C:executionStopped()
for _, id in ipairs(self.sortedIds) do
local data = self.vehicles[id]
local veh = scenetree.findObjectById(id)
for _, tank in ipairs(self.vehicles[id].storedEnergyStorage or {}) do
core_vehicleBridge.executeAction(veh, 'setEnergyStorageEnergy', tank.name, tank.currentEnergy)
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/setDragVehicle.lua
if im.BeginCombo("##", self.mode, 0) then
for _,fun in ipairs(fg_utils.sortedMergeFuns.any) do
if fun.name ~= 'readOnly' then
@/lua/ge/extensions/gameplay/drift/saveLoad.lua
--dump(levelSpotsDir)
for _, file in ipairs(FS:findFiles(levelSpotsDir, "spot.driftSpot.json", -1, false, true)) do
local dir, _, _ = path.split(file)
for id, line in pairs(spotData.spatialInfo.lines) do
for _, name in ipairs(line.markerObjects or {}) do
local obj = scenetree.findObject(name)
local found = false
for _, fn in ipairs(previewFilenames) do
local f = dir..fn
-- "cast" scl, pos and rot to vec/quat
for _, elem in ipairs(json.stuntZones or {}) do
if elem.pos and type(elem.pos) == "table" and elem.pos.x and elem.pos.y and elem.pos.z then elem.pos = vec3(elem.pos) end
@/lua/ge/extensions/editor/trafficSignalsEditor.lua
for _, objId in ipairs(instance.tempSignalObjects) do
instance:linkSignalObject(objId) -- now links using the new name
local idx = 0
for _, otherInstance in ipairs(instances) do
if instance.id ~= otherInstance.id and string.startswith(otherInstance.name, name) then
table.clear(simLogs)
for _, instance in ipairs(instances) do
if instance.controllerId == 0 then
local ctrlArray = useAllControllers and controllers or selectableControllers
for i, sc in ipairs(ctrlArray) do
if controller.id == sc.id then
local function processGroups() -- groups instances by intersections, via a simple algorithm
for _, instance in ipairs(instances) do -- first, reset all groups
instance.group = nil
end
for _, instance in ipairs(instances) do
if not instance.group and not instance.intersectionId then
local idList = {}
for _, other in ipairs(instances) do
if not other.intersectionId and instance.sequenceId == other.sequenceId then -- sequence ids must match
for _, id in ipairs(idList) do
if not elements[id].group then
for _, instance in ipairs(instances) do
table.insert(instancesSerialized, instance:onSerialize())
end
for _, ctrl in ipairs(controllers) do
table.insert(controllersSerialized, ctrl:onSerialize())
end
for _, sequence in ipairs(sequences) do
table.insert(sequencesSerialized, sequence:onSerialize())
for _, instance in ipairs(data.instances) do
instance.pos = vec3(instance.pos)
end
for _, ctrl in ipairs(data.controllers) do
local new = trafficSignals.newController(ctrl)
end
for _, sequence in ipairs(data.sequences) do
local new = trafficSignals.newSequence(sequence)
if val then
for _, sequence in ipairs(sequences) do
sequence.enableTestTimer = true
local dir1 = selectedObj:getTransform():getForward()
for _, obj in ipairs(getObjectsByClass("TSStatic") or {}) do
if (internalName and obj:getInternalName() == internalName) or obj.shapeName == selectedObj.shapeName then
if im.BeginCombo("Type##ctrlDefinitionTypes", signalCtrlDefinitions.typesSorted[selected.ctrlDefType] or "(None)") then
for i, name in ipairs(signalCtrlDefinitions.typesSorted) do
if im.Selectable1(name.."##ctrlDefinitionType", selected.ctrlDefType == i) then
if im.BeginCombo("##ctrlDefinitionTypeDataState"..i, currData.states[i] or "(None)") then
for _, state in ipairs(signalCtrlDefinitions.tempStatesSorted) do
if im.Selectable1(state.."##ctrlDefinitionTypeData"..i, currData.states[i] == state) then
if im.BeginCombo("State##ctrlDefinitionStates", signalCtrlDefinitions.statesSorted[selected.ctrlDefState] or "(None)") then
for i, name in ipairs(signalCtrlDefinitions.statesSorted) do
if im.Selectable1(name.."##ctrlDefinitionState", selected.ctrlDefState == i) then
if im.BeginCombo("Signal Action##ctrlDefinitionState", currData.action or "(None)") then
for _, action in ipairs(tableKeysSorted(signalCtrlDefinitions.signalActions)) do
if im.Selectable1(action.."##ctrlDefinitionState", currData.action == action) then
if im.BeginCombo("Light Color #"..i.."##ctrlDefinitionStateLight"..i, currData.flashingLights[selected.flashingLight][i] or "(None)") then
for _, color in ipairs(tableKeysSorted(signalCtrlDefinitions.signalColors)) do
if im.Selectable1(color.."##ctrlDefinitionStateLight"..i, currData.flashingLights[selected.flashingLight][i] == color) then
end
for i, light in ipairs(state.flashingLights) do
for j = #light, state.lightsArraySize + 1, -1 do
for i, instance in ipairs(instances) do
if im.Selectable1(instance.name, selected.signal == i or groupInstances[instance.name]) then
end
for _, sequence in ipairs(sequences) do
if im.Selectable1(sequence.name.."##instanceSequence", sequence.name == name) then
currInstance._newSequence = nil
for i, sequence in ipairs(sequences) do
if sequence.id == currInstance.sequenceId then
local temp = {}
for _, phase in ipairs(sequence.phases) do
for _, cid in ipairs(phase.controllerIds) do
for _, phase in ipairs(sequence.phases) do
for _, cid in ipairs(phase.controllerIds) do
if elements[cid] and not temp[cid] then
else
for _, ctrl in ipairs(controllers) do
table.insert(selectableControllers, ctrl)
-- only controllers found within the current sequence should be selectable
for _, ctrl in ipairs(selectableControllers) do
if im.Selectable1(ctrl.name, ctrl.name == name) then
currInstance._newController = nil
for i, ctrl in ipairs(controllers) do
if ctrl.id == currInstance.controllerId then
currInstance.tempGroupList = {currInstance.name}
for i, instance in ipairs(instances) do
if instance.name ~= currInstance.name and instance.group and instance.group == currInstance.group then
if currInstance.tempSignalObjects then
for _, objId in ipairs(currInstance.tempSignalObjects) do
currInstance:unlinkSignalObject(objId)
if count > 0 then
for _, objId in ipairs(editor.selection.object) do
currInstance:linkSignalObject(objId)
im.BeginChild1("signalObjects", im.ImVec2(im.GetContentRegionAvailWidth(), 110 * im.uiscale[0]), im.WindowFlags_ChildWindow)
for _, oid in ipairs(currInstance.tempSignalObjects) do
local obj = scenetree.findObjectById(oid)
if editor.isViewportHovered() and im.IsMouseClicked(0) and not editor.isAxisGizmoHovered() and not editor.keyModifiers.shift then
for i, instance in ipairs(instances) do
if mousePos:squaredDistance(instance.pos) <= square(cylinderRadius * 2) then
for i, ctrl in ipairs(controllers) do
if im.Selectable1(ctrl.name, selected.controller == i) then
if im.BeginCombo("Signal Type##controller", typeName) then
for _, k in ipairs(tableKeysSorted(signalTypes)) do
if im.Selectable1(signalTypes[k].name, k == currController.type) then
if currController.isSimple or not currController.states[1] then
for _, state in ipairs(currController.states) do
local stateData = currController:getStateData(state.state)
for i, state in ipairs(currController.states) do
local stateData = currController:getStateData(state.state)
for i, sequence in ipairs(sequences) do
if im.Selectable1(sequence.name, selected.sequence == i) then
currSequence.tempControllers = {}
for _, phase in ipairs(currSequence.phases) do
for _, cid in ipairs(phase.controllerIds) do
for _, phase in ipairs(currSequence.phases) do
for _, cid in ipairs(phase.controllerIds) do
currSequence.tempControllers[cid] = 1
for i, phase in ipairs(currSequence.phases) do
im.TextUnformatted(tostring(i))
for j, cid in ipairs(phase.controllerIds) do
if im.BeginCombo("##phaseControllerName"..i.."_"..j, elements[cid] and elements[cid].name or "(None)") then
if im.BeginCombo("##phaseControllerName"..i.."_"..j, elements[cid] and elements[cid].name or "(None)") then
for _, ctrl in ipairs(controllers) do
if not currSequence.tempControllers[ctrl.id] and im.Selectable1(ctrl.name, cid == ctrl.id) then -- prevents duplicates by limiting controller selection
currSequence._advancedPhases = false
for i, phase in ipairs(currSequence.phases) do
if phase.startTime then
if not currSequence._advancedPhases then
for i, phase in ipairs(currSequence.phases) do
phase.startTime = nil -- clears all phase start times
local valid = true
for i, phase in ipairs(currSequence.phases) do
if not phase.startTime or not phase.totalDuration then
local totalDuration = 0
for i, phase in ipairs(currSequence.phases) do
phase.startTime = phase.startTime or totalDuration
for i, phase in ipairs(currSequence.phases) do
for j, id in ipairs(phase.controllerIds) do
for i, phase in ipairs(currSequence.phases) do
for j, id in ipairs(phase.controllerIds) do
local ctrl = elements[id]
end
for i, state in ipairs(ctrl.states) do
local duration = state.duration
end
for i, state in ipairs(ctrl.states) do
local color = imColors.white
for i, phase in ipairs(currSequence.phases) do
var = im.FloatPtr(phase.startTime)
for i, sequence in ipairs(core_trafficSignals.getSequences()) do
im.TextUnformatted(sequence.name)
-- error logs (and other logs, maybe) go here
for _, s in ipairs(simLogs) do
im.TextUnformatted(s)
for i, instance in ipairs(instances) do
local camDist = instance.pos:squaredDistance(core_camera.getPosition())
log('W', logTag, "Traffic signals validated with errors, see below for details")
for _, s in ipairs(simLogs) do
dump(s)
@/lua/common/json-ast.lua
for i, node in ipairs(astNodes) do
local parentNodeIdx = containerStack[#containerStack]
local res = {}
for _, childNodeIdx in ipairs(nodeHierarchy) do
local val = _convertToLuaNative(ctx, childNodeIdx, addAstId)
local storedKey
for _, childNodeIdx in ipairs(nodeHierarchy) do
local childNode = ctx.ast.nodes[childNodeIdx]
local res = ''
for i, node in ipairs(nodes) do
res = res .. stringifyNode(node)
local firstNodeIdx = nil
for nodeIdx, node in ipairs(ctx.ast.nodes) do
local nodeType = node[1]
local lineNum = 1
for nodeIdx, node in ipairs(ctx.ast.nodes) do
local nodeType = node[1]
local linesB = _lineSplit(strB)
for i, line in ipairs(linesA) do
--dump{i, linesA[i], linesB[i]}
for _, node in ipairs(res.ast.nodes) do
if node[1] == 'literal' then
local fileCount = #filenames
for i, filename in ipairs(filenames) do
if not testFile(filename, writeAST) then
@/lua/ge/extensions/scenario/nomoveGoal.lua
local function processState(scenario, state, stateData)
for _,instance in ipairs(M.instances) do
if not instance.vId and not instance.warnedVehicleMissing then
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'nomove' then
local function updateFinalStatus(scenario, instance)
for _,instance in ipairs(M.instances) do
if not instance.value.triggerEndOnly then
@/lua/ge/extensions/editor/raceEditor.lua
for _, window in ipairs(windows) do
currentWindow:setPath(currentPath)
previousFilepath = data.previousFilepath
for _, window in ipairs(windows) do
currentWindow:setPath(currentPath)
local missingNormals = 0
for _, pn in ipairs(currentPath.pathnodes.sorted) do
if not pn.hasNormal then
end
for _, seg in ipairs(currentPath.segments.sorted) do
if not seg:isValid() then
for i, pn in ipairs(newPath.pathnodes.sorted) do
if string.match(pn.name, "^Pathnode ") then
end
for i, seg in ipairs(newPath.segments.sorted) do
if string.match(seg.name, "^Segment ") then
table.clear(allFiles)
for _, f in ipairs(FS:findFiles("/", '*.race.json', -1, true,true)) do
local dir, filename, ext = path.split(f)
im.Separator()
for _,f in ipairs(allFiles) do
if im.MenuItem1(f.name..'##'..f.file) then
newPath:onDeserialized(currentPath:onSerialize())
for _, pn in ipairs(newPath.pathnodes.sorted) do
if add == 'all' then
if im.BeginMenu(#issues..' Issues') then
for i, issue in ipairs(issues) do
if im.MenuItem1(issue[1]) then
if im.BeginTabBar("modes") then
for _, window in ipairs(windows) do
local flags = nil
editor.clearObjectSelection()
for _, win in ipairs(windows) do
if win.onEditModeActivate then
local function onDeactivate()
for _, win in ipairs(windows) do
if win.onEditModeDeactivate then
@/lua/ge/extensions/editor/missionEditor/issues.lua
for _, issue in ipairs(self.mission._issueList) do
im.BulletText(issue.label)
if im.MenuItem1("Attempt to fix all Missiontype issues for all missions") then
for _, mission in ipairs(gameplay_missions_missions.getFilesData()) do
self.missionEditor.setMissionById(mission.id, true)
if im.MenuItem1("Attempt to remove all additional data from missionTypeData") then
for _, mission in ipairs(gameplay_missions_missions.getFilesData()) do
self.missionEditor.setMissionById(mission.id, true)
for _, issue in ipairs(self.issues.list or {}) do
im.Text(issue.idx.."")
local idx = 1
for _, mission in ipairs(missionList) do
if not shipping_build and mission.devMission then
for _, w in ipairs(windows) do
if w.getMissionIssues then
if w.getMissionIssues then
for _, issue in ipairs(w:getMissionIssues(mission) or {}) do
@/lua/ge/extensions/gameplay/vehiclePerformance.lua
for _, class in ipairs(vehicleClasses) do
if performanceIndex >= class.minPI then
@/lua/ge/extensions/career/modules/uiUtils.lua
table.clear(careerPauseContextButtonFunctions)
for i, btn in ipairs(data.buttons) do
btn.functionId = i
local function getCareerCurrentLevelName()
for _, lvl in ipairs(core_levels.getList()) do
if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/lua/ge/extensions/gameplay/rally/loop/stagedCountdownTest.lua
local timeUntilEvent = newScheduledEventTime - currentEpochTime
for _, warningTime in ipairs(defaultWarningTimes) do
if timeUntilEvent < warningTime then
@/lua/ge/extensions/core/funstuff.lua
vehicleOptions = {}
for _, v in ipairs(vehs) do
local passType = true
if not ret or not ret[1] then return end
for _, tank in ipairs(ret[1]) do
core_vehicleBridge.executeAction(veh,'setEnergyStorageEnergy', tank.name, tank.maxEnergy * level)
@/lua/ge/extensions/editor/sitesEditor.lua
previousFilepath = dir
for _, window in ipairs(windows) do
window:setSites(currentSites)
currentSites = require('/lua/ge/extensions/gameplay/sites/sites')("New Sites")
for _, window in ipairs(windows) do
window:setSites(currentSites)
end)
for i, e in ipairs(currentSites.locations.sorted) do
e.sortOrder = i
end)
for i, e in ipairs(currentSites.zones.sorted) do
e.sortOrder = i
end)
for i, e in ipairs(currentSites.parkingSpots.sorted) do
e.sortOrder = i
local spotsByName = {}
for i, e in ipairs(currentSites.parkingSpots.sorted) do
spotsByName[e.name] = spotsByName[e.name] or {}
local c = 1
for _, spot in ipairs(list) do
spot.name = string.format("%s%0"..l.."d", name, c)
if im.MenuItem1("Parkingspot Names by Zone Containment (can take long)") then
for _, zone in ipairs(currentSites.zones.sorted) do
for _, ps in ipairs(currentSites.parkingSpots.sorted) do
for _, zone in ipairs(currentSites.zones.sorted) do
for _, ps in ipairs(currentSites.parkingSpots.sorted) do
if zone:containsPoint2D(ps.pos) then
if im.BeginTabBar("modes") then
for _, window in ipairs(windows) do
if im.BeginTabItem(window.windowDescription) then
if im.BeginMenu("Empty Levels") then
for _, name in ipairs(emptyLevelNamesSorted) do
im.MenuItem1(name)
for _, lvl in ipairs(lvlNamesSorted) do
if im.BeginMenu(lvl) then
if im.BeginMenu(lvl) then
for _, site in ipairs(levelSites[lvl]) do
local _, siteName = path.split(site)
currentSites = extensions.gameplay_sites_sitesManager.loadSites(site)
for _, window in ipairs(windows) do
window:setSites(currentSites)
editor.clearObjectSelection()
for _, win in ipairs(windows) do
if win.onEditModeActivate then
local function onDeactivate()
for _, win in ipairs(windows) do
if win.onEditModeDeactivate then
@/lua/vehicle/hydros.lua
local maxx, maxy = 0, 0
for _,p in ipairs(rCurve) do
if p[1] > maxx then maxx = p[1] end
-- find current section (previous and next datapoint) in response curve
for _, v in ipairs(responseCurve) do
local v2 = v[2]
local simWheelPos = 0
for i, h in ipairs(FFBHydros) do
h._inrate, h._outrate = h.inRate * physicsDt, h.outRate * physicsDt
for i, h in ipairs(FFBHydros) do
local hbcid = h.bcid
@/lua/ge/extensions/ui/liveryEditor/camera.lua
for k, v in ipairs(switchOrder) do
if v == orthographicView then
@/lua/ge/extensions/flowgraph/nodes/states/transition.lua
if im.BeginCombo("Transition Name", self.transitionName) then
for _, tName in ipairs(target:getTransitionNames()) do
if im.Selectable1(tName, tName == self.transitionName) then
im.SetWindowFontScale(1/editor.getPreference("ui.general.scale"))
for _, hop in ipairs(hops) do
local lnk = hop.link
@/lua/ge/extensions/gameplay/discover/newPlayerExperience.lua
local setupVehs = {}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
local setupVehs = {}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
setupVehs[v:getID()] = [[
for _, v in ipairs(powertrain.getDevicesByType("differential")) do powertrain.toggleDeviceMode(v.name) end
controller.getControllerSafe("frontLockControl").setDriveMode('locked')
}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
local setupVehs = {}
for i, veh in ipairs(vehs) do
local spawningOptions = sanitizeVehicleSpawnOptions(veh[3], {config = veh[4]})
@/lua/ge/extensions/flowgraph/nodes/vehicle/special/customVehicleGetter.lua
local currentFun = "Custom Function"
for _, f in ipairs(functions) do
if f.fun == self.data.fun then
if im.BeginCombo("##currentFunc" .. self.id, currentFun) then
for _, fun in ipairs(functions) do
if im.Selectable1(fun.name, fun.fun == self.data.fun) then
@/lua/ge/extensions/freeroam/crashCamMode.lua
local hitPoint
for _, point in ipairs(bbCornerPoints) do
local hitDist = intersectRayOBB(point, playerVeh:getVelocity():normalized(), crashCamData.futureBB2)
local adjustedHitPoint
for _, point in ipairs(bbCornerPoints) do
local hitDist = intersectRayOBB(point, crashCamData.velocity:normalized(), bb2)
local modesToChooseFrom = {}
for _, mode in ipairs(modeAttributes) do
if not mode.cooldown or timeSinceLastCrashCam > mode.cooldown then
local totalProb = 0
for _, mode in ipairs(modesToChooseFrom) do
totalProb = totalProb + mode.prob
local probCounter = 0
for modeId, mode in ipairs(modesToChooseFrom) do
probCounter = probCounter + mode.prob
for _, otherId in ipairs(trafficVehicleIds) do
if willCollideWithJbeam(playerVehId, otherId) then
@/lua/ge/extensions/gameplay/rally/rallyManager.lua
for _, sp in ipairs(self.racePath.startPositions.sorted) do
if sp.name == name then
-- local pathnodes = self.racePath.pathnodes.sorted
-- for _, pathnode in ipairs(pathnodes) do
-- local name = pathnode.name
@/lua/ge/extensions/editor/createObjectTool.lua
for _, itemName in ipairs(currentItems) do
if string.match(itemName, "^"..classname.."_%d+".."$") then
table.sort(fileNameIndexes)
for _, index in ipairs(fileNameIndexes) do
if index > newNameIndex then
local function getObjectCreateItem(classname)
for _, group in ipairs(createGroups) do
for _, class in ipairs(group.objectClasses) do
for _, group in ipairs(createGroups) do
for _, class in ipairs(group.objectClasses) do
if class.classname == classname then
-- show the toolbar buttons for the class groups
for i, item in ipairs(createGroups) do
local bgColor = nil
simObjectSearch:startSearch(ffi.string(simObjectClassNameFilter))
for i, clsName in ipairs(simObjectClassNames) do
simObjectSearch:queryElement({
for i, result in ipairs(searchResults) do
if hiddenClasses[result.name] then
-- else we show a button for each class type we can create
for i, item in ipairs(createGroups[createObjectGroupIndex].objectClasses) do
local bgColor = nil
local function getObjectCreateGroup(name)
for _, grp in ipairs(createGroups) do
if grp.name == name then return grp end
for i, className in ipairs(simObjectClassNames) do
allClassesSearchResults[i] = {name = className}
@/lua/ge/extensions/editor/forestView.lua
-- else
-- for _, entry in ipairs(selectedItems) do
-- entry.selected = false
-- else
-- for i, entry in ipairs(selectedItems) do
-- if entry.key == item.key then
@/lua/ge/extensions/editor/api/core.lua
local function setVisualizationType(name, on)
for _, type in ipairs(visualizationTypes) do
if type.name == name then
local function getVisualizationType(name)
for _, type in ipairs(visualizationTypes) do
if type.name == name then
@/lua/vehicle/controller/propAnimation/sequentialLever.lua
local supportedGearboxLookup = {}
for _, gearboxType in ipairs(supportedGearboxTypes) do
supportedGearboxLookup[gearboxType] = true
@/lua/ge/extensions/scenario/quickRaceLoader.lua
--dump(files)
for _, levelName in ipairs(files) do
--print(levelName)
for _,t in ipairs(tbt) do
newLevel.tracks[#newLevel.tracks+1] = t
if raceList then
for _,raceLevel in ipairs(raceList) do
if raceLevel.levelInfo.title == levelName or raceLevel.levelName == levelName then
if level and level.tracks and level.trackCount > 0 then
for _,track in ipairs(level.tracks) do
if track.name == trackName then
-- local previews = {}
-- for i, file in ipairs(FS:findFiles('trackEditor/','*.json',-1,true,false)) do
-- local _, fn, e = path.split(file)
local editorTracks = {}
for i, file in ipairs(FS:findFiles('trackEditor/','*.json',-1,true,false)) do
local _, fn, e = path.split(file)
end
for _, name in ipairs(editorTracks) do
local trackData = M.loadTrackBuilderJSON(name)
local procedurals = lvlName == "driver_training"
for _, trackFile in ipairs(quickraceFiles) do
local dir, filename, ext = path.split(trackFile, true)
for list, suf in pairs(autoPrefabs) do
for _, ext in ipairs(prefabExt) do
local file = "levels/"..scenarioFile.levelName.."/quickrace/"..trackFile.trackName..suf..ext
if trackFile.reverse then
for _,p in ipairs(trackFile.reversePrefabs) do
trackFile.prefabs[#trackFile.prefabs+1] = p
else
for _,p in ipairs(trackFile.forwardPrefabs) do
trackFile.prefabs[#trackFile.prefabs+1] = p
local rev = {}
for i,c in ipairs(scenarioFile.lapConfig) do
rev[#scenarioFile.lapConfig +1 - i] = c
local modules = {}
for _,m in ipairs(M.quickRaceModules) do
modules[#modules+1] = m
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/raceCpLapChange.lua
local wps = {}
for _, pn in ipairs(self.pinIn.raceData.value.path.pathnodes.sorted) do
table.insert(wps, {name = pn.id, pos = pn.pos, radius = pn.radius, normal = pn.hasNormal and pn.normal or nil})
@/lua/vehicle/controller/hydraulicSuspension.lua
local avgBleedCoef = 0
for _, beam in ipairs(beams) do
if beam.bleedCoef > 0 then
currentPumpFlow = 0
for _, beam in ipairs(beams) do
if beam.momentaryIncrease then
lastFrameBeamLengths = {}
for _, beam in ipairs(beams) do
beam.currentPosition = beam.originalBeamPosition
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/signals/controllerByName.lua
if self.pinIn.signalsData.value and self.pinIn.name.value then
for _, ctrl in ipairs(self.pinIn.signalsData.value.controllers) do
if ctrl.name == self.pinIn.name.value then
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/missionTiles.lua
if backend.backendName == "gameplaySelector" then
for _, mission in ipairs(gameplay_missions_missions.get()) do
local isCareerOnly = mission.careerSetup and mission.careerSetup.showInCareer and not mission.careerSetup.showInFreeroam
if mission.customAdditionalAttributes and #mission.customAdditionalAttributes > 0 then
for _, attr in ipairs(mission.customAdditionalAttributes) do
table.insert(generalSpecs, {
@/lua/ge/extensions/flowgraph/modules/actionModule.lua
function C:blockActions(id)
for k, p in ipairs(self.lists[id] or {}) do
self.addActions[k] = p
function C:allowActions(id)
for k, p in ipairs(self.lists[id] or {}) do
self.removeActions[k] = p
if not self.changed then return end
for _, act in ipairs(self.addActions) do
self.actionsByName[act] = true
end
for _, act in ipairs(self.removeActions) do
self.actionsByName[act] = nil
@/lua/ge/extensions/tech/sumoExporter.lua
local function doesSegmentContainKey(path, key)
for _, v in ipairs(path) do
if v == key then return true end
local edges = {}
for _, path in ipairs(pathSegments) do
for i = 1, #path - 1 do
file:write("\n")
for _, node in ipairs(nodes) do
file:write(string.format('\t\n',
local ctr = 1
for _, edge in ipairs(edges) do
local id1 = "e" .. tostring(ctr)
@/lua/ge/extensions/editor/dynamicDecals/export.lua
for _, v in ipairs(maps) do
local path = string.format("%s%s%s.%s", dirPath, texturesExport_Name, v, exportTexturesFileTypes[texturesExport_exportFormatId])
if im.TreeNodeEx1("Export Paths", im.TreeNodeFlags_DefaultOpen) then
for _, exportPath in ipairs(texturesExport_exportPaths) do
im.TextUnformatted(exportPath[1])
@/lua/vehicle/controller/vehicleController/vehicleController.lua
local avCount = 0
for _, v in ipairs(powertrain.getDevicesByType(deviceType)) do
avSum = avSum + v.outputAV1
local avCount = 0
for _, v in ipairs(powertrain.getDevicesByCategory(deviceCategory)) do
avSum = avSum + v.outputAV1
local storages = {}
for _, v in ipairs(engines) do
for _, w in ipairs(v.energyStorage or {}) do
for _, v in ipairs(engines) do
for _, w in ipairs(v.energyStorage or {}) do
local energyStorage = energyStorage.getStorage(w)
for _, s in ipairs(controlLogicModule.energyStorages or {}) do
local energyStorage = energyStorage.getStorage(s)
@/lua/ge/extensions/flowgraph/nodes/ui/selectButtons.lua
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and lnk.sourcePin.name ~= "flow" and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
local buttonsTable = {}
for i, btn in ipairs(self.options) do
if self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
@/lua/ge/client/core.lua
-- log('I','core', 'Loading: ')
for _, filename in ipairs(subfiles) do
-- log('I','core', ' '..tostring(filename))
@/lua/common/jbeam/groups.lua
newGroups = {}
for keyGroup, group in ipairs(row.group) do
if group ~= "" then
@/lua/vehicle/controller/vivaceGauges.lua
local motorCount = 0
for _, motor in ipairs(motors) do
powerDisplay = powerDisplay + (motor.throttle or 0)
@/lua/ge/extensions/editor/api/valueInspector.lua
for _, objectSet in ipairs(objectSetArray) do
for i = 0, objectSet:size() - 1 do
if imgui.BeginCombo('##filterTypes', filterTypes[filterTypeIndex]) then
for i, type in ipairs(filterTypes) do
if imgui.Selectable1(type) then
self.startValues = {}
for _, id in ipairs(self.selectedIds) do
table.insert(self.startValues, editor.getFieldValue(id, fieldName, arrayIndex) or "")
self.startValues = {}
for _, id in ipairs(self.selectedIds) do
table.insert(self.startValues, editor.getFieldValue(id, fieldName, arrayIndex) or "")
self.startValues = {}
for _, id in ipairs(self.selectedIds) do
table.insert(self.startValues, editor.getFieldValue(id, fieldName, arrayIndex) or "")
if self.selectedIds then
for _, id in ipairs(self.selectedIds) do
customData.objectId = id
self.startValues = {}
for _, id in ipairs(self.selectedIds) do
table.insert(self.startValues, editor.getFieldValue(id, fieldName, arrayIndex) or "")
if self.selectedIds then
for _, id in ipairs(self.selectedIds) do
customData.objectId = id
for i, dbName in ipairs(dataBlockNames) do
if imgui.ImGuiTextFilter_PassFilter(dataBlockNameFilter, dbName) then
@/lua/common/libs/xlsxlib/tests/JUnitXMLWriter.lua
-- Add test cases
for _, result in ipairs(testResults) do
local testcase = {
@/lua/vehicle/extensions/inputAnalyzer.lua
local inputLength = inputString:len()
for _, is in ipairs(registeredInputStrings) do
if inputLength >= is.stringLength then
local duplicate = false
for _, v in ipairs(registeredInputStrings) do
if v.string == string and v.callback == callback then
local indexToRemove
for k, v in ipairs(registeredInputStrings) do
if v.string == string and v.callback == callback then
@/lua/ge/extensions/editor/util/transformUtil.lua
local prevRow = 0
for i, btn in ipairs(buttons) do
local row = math.floor((i - 1) / columnsNeeded)
local validButtons = {}
for i, btn in ipairs(buttonData) do
if (btn.needsPos and not self.allowTranslate) or (btn.needsRot and not self.allowRotate) then
@/lua/ge/extensions/core/vehicle/manager.lua
local files = FS:findFiles(path, '*materials.json\t*.cs', -1, true, false)
for _, filename in ipairs(files) do
if filename:find('.json') then
@/lua/ge/extensions/editor/missionEditor/progressMulti.lua
if im.BeginCombo("Progress Key", self.currentProgressKey) then
for _, k in ipairs(progressKeys) do
if im.Selectable1(k, k==self.currentProgressKey) then
@/lua/ge/extensions/editor/mainMenu.lua
local menuGenerator = function(menuGroups, menuItems)
for _, item in ipairs(menuItems) do
if item.isGroup then
if imgui.BeginMenu(item.itemText, imgui_true) then
for _, subitem in ipairs(menuGroups[item.itemText]) do
if imgui.MenuItem1(subitem.itemText, nil, imgui_false, imgui_true) then
local addToSearch = function(menuGroups, menuItems)
for _, item in ipairs(menuItems) do
if item.isGroup then
if item.isGroup then
for _, subitem in ipairs(menuGroups[item.itemText]) do
local entry = shallowcopy(subitem)
if windowSearchDisplayResult then
for _, item in ipairs(windowSearchResults) do
if imgui.MenuItem1(item.name, nil, imgui_false, imgui_true) then
if imgui.BeginMenu("Layouts", imgui_true) then
for _, layoutPath in ipairs(editor_layoutManager.getWindowLayouts()) do
if imgui.MenuItem1(string.match(layoutPath, ".+/(.+)"), nil, imgui_false, imgui_true) then
if editor.beginWindow(deleteLayoutWindowName, deleteLayoutWindowTitle) then
for _, layoutPath in ipairs(editor_layoutManager.getWindowLayouts()) do
if imgui.MenuItem1(string.match(layoutPath, ".+/(.+)"), nil, imgui_false, imgui_true) then
local unpackedModsList = FS:findFiles( "/mods/unpacked/", "*", 0, false, true )
for _, modPath in ipairs(unpackedModsList) do
if FS:directoryExists(modPath.."/levels/"..levelName) and not FS:fileExists(modPath.."/levels/"..levelName) then
@/lua/ge/extensions/flowgraph/nodes/macro/foreach.lua
-- kill target
for _, mrg in ipairs(self.targets) do
mgr:setRunning(false)
self.targets = {}
for key, value in ipairs(list) do
local mgr = core_flowgraphManager.loadManager(self.pinIn.filepath.value)
@/lua/vehicle/controller/inputOutputDemo.lua
--iterating over all "lines" of saved data
for _, line in ipairs(csvData) do
--concat individual line entries
local electricMotors = powertrain.getDevicesByType("electricMotor")
for _, motor in ipairs(electricMotors) do
--Sum up output power of all motors ([W])
@/lua/ge/extensions/ui/bindingsLegend.lua
local name = actionMapName.."ActionMap"
for _, actionMap in ipairs(ActionMap:getList().active) do
if actionMap.enabled and actionMap.name == name then
local activeActions = core_input_actions.getActiveActions()
for _, device in ipairs(core_input_bindings.bindings) do
for _, binding in ipairs(device.contents.bindings) do
for _, device in ipairs(core_input_bindings.bindings) do
for _, binding in ipairs(device.contents.bindings) do
local actionInfo = activeActions[binding.action]
local function getActionDataSetByLabel(label)
for i, actionDataSet in ipairs(actionData) do
if actionDataSet.label == label then
local foundModifierAction = false
for _, device in ipairs(core_input_bindings.bindings) do
for _, binding in ipairs(device.contents.bindings) do
for _, device in ipairs(core_input_bindings.bindings) do
for _, binding in ipairs(device.contents.bindings) do
-- search for combined modifier actions
for _, device in ipairs(core_input_bindings.bindings) do
for _, binding in ipairs(device.contents.bindings) do
for _, device in ipairs(core_input_bindings.bindings) do
for _, binding in ipairs(device.contents.bindings) do
local activeActions = core_input_actions.getActiveActions()
for _, action in ipairs(actions) do
if action.inputActionOnClick == nil then
local highestPriorityIndex
for i, actionDataSet in ipairs(actionData) do
if actionDataSet.additionalData and actionDataSet.additionalData.priority and actionDataSet.additionalData.priority > highestPriority then
-- construct uiData table
for i, actionDataSet in ipairs(actionData) do
if actionDataSet.additionalData then
local modifiedDataSet = getActionDataSetByLabel("modified")
for _, action in ipairs(vehicleSpecificDataSet.actions) do
action.highlighted = nil
action.highlighted = nil
for _, modifiedAction in ipairs(modifiedDataSet and modifiedDataSet.actions or {}) do
if action.action == modifiedAction.action then
local function removeActionCategoryByLabel(label)
for i, actionDataSet in ipairs(actionData) do
if actionDataSet.label == label then
local function doesActionSetWithHigherPriorityExist(priority)
for _, actionSet in ipairs(actionData) do
if actionSet.additionalData and actionSet.additionalData.priority and actionSet.additionalData.priority > priority then
local function addConstantActions(actions)
for _, action in ipairs(actions) do
table.insert(actionData, {actions = {action}, additionalData = {priority = 10}, label = "constant"})
local function getBindingsByDeviceName(deviceName)
for _, device in ipairs(core_input_bindings.bindings) do
if device.devname == deviceName then
local activeActions = core_input_actions.getActiveActions()
for _, deviceName in ipairs(core_input_bindings.getRecentDevices()) do
local bindingsByDevice = getBindingsByDeviceName(deviceName)
local bindingsByDevice = getBindingsByDeviceName(deviceName)
for _, binding in ipairs(bindingsByDevice or {}) do
local actionInfo = activeActions[binding.action]
if modifiersMatch then
for _, modifier in ipairs(modifierNames) do
if not tableContains(bindingModifiers, modifier) then
table.clear(modifiersActive)
for _, modifier in ipairs(modifierNames) do
modifiersActive[modifier] = true
for _, actionDataSet in ipairs(actionData) do
if actionDataSet.additionalData then
@/lua/ge/extensions/gameplay/missions/proceduralMissionGenerators/busModeMissions.lua
local missions = {}
for _, level in ipairs(data) do
-- read all busline files for the route and navhelper data.
if hasData then
for _, scenario in ipairs(level.scenarios) do
local mission = getBaseMission()
@/lua/ge/extensions/editor/barriersEditor.lua
local levelPartLength = (directory:len())+1
for _, f in ipairs(FS:findFiles("/levels/"..level.."/", searchTerm..".prefab", -1, true,true)) do
if not prefabsIndex[f] then
end
for _, obj in ipairs(prefab.objects) do
debugDrawer:drawSphere(obj, 1.5, color)
local contained = {}
for _, elem in ipairs(path.prefabs) do
contained[elem] = true
if path then
for _, elem in ipairs(prefabList) do
if not contained[elem.dirInLevel] and elem.selected then
local contained = {}
for _, elem in ipairs(path.prefabs) do
contained[elem] = true
if path then
for _, elem in ipairs(prefabList) do
if not contained[elem.dirInLevel] and elem.selected then
local contained = {}
for _, elem in ipairs(path.prefabs) do
contained[elem] = true
if path then
for _, elem in ipairs(prefabList) do
elem.selected = contained[elem.dirInLevel] or false
if im.MenuItem1("Load Selected Prefabs") then
for _, elem in ipairs(prefabList) do
if elem.selected then
local flip = nil
for i, elem in ipairs(prefabList) do
if not elem.selected then
if im.Button(">") then
for _,elem in ipairs(prefabList) do
elem.selected = true
if im.Button("<") then
for _,elem in ipairs(prefabList) do
elem.selected = false
im.BeginChild1("NoTags", nil, im.WindowFlags_ChildWindow)
for i, elem in ipairs(prefabList) do
if elem.selected then
local useElem = true
for idx, prefab in ipairs(prefabList) do
if shift then
if useElem then
for _, pos in ipairs(prefab.objects) do
local t1,t2 = intersectsRay_Sphere(camPos, rayDir, pos, 1.5)
if closestElem then
for _, obj in ipairs(closestElem.objects) do
debugDrawer:drawSphere(obj, 1.25, ColorF(0,0,1,0.25))
@/lua/common/utils/wsUtils.lua
local res = false
for _, e in ipairs(events) do
if e.type == 'D' and e.msg == magicUp then
res = false
for _, e in ipairs(events) do
if e.type == 'D' and e.msg == magicDown then
local chosenAddress = 'localhost'
for _, addr in ipairs(addresses) do
local desc = addr.description:lower()
@/lua/ge/extensions/flowgraph/nodes/scene/spawnLight.lua
function C:clearObjects()
for _, obj in ipairs(self.objects) do
if obj then
@/gameplay/missionTypes/hypermiling/constructor.lua
self.sortedStarKeys = {}
for _, fuel in ipairs({"Gas","Diesel","Electric","Any"}) do
for _, tier in ipairs({"bronze","silver","gold"}) do
for _, fuel in ipairs({"Gas","Diesel","Electric","Any"}) do
for _, tier in ipairs({"bronze","silver","gold"}) do
self.starLabels[tier..fuel] = "missions.hypermilling.stars."..tier..fuel
@/lua/ge/extensions/core/checkpoints.lua
local waypoints = aiVehiclePath[data.vehicleId].waypoints
for index, wpName in ipairs(waypoints) do
if wpName == data.waypointName then
@/lua/ge/extensions/gameplay/rally/driveline/pointList.lua
function C:setupPointRelationships()
for i, point in ipairs(self.points) do
point.id = i
function C:setupPointNormals()
for i, point in ipairs(self.points) do
point.normal = snaproadNormals.forwardNormalVec(point)
for _, point in ipairs(self.points) do
local distSq = (point.pos - srcPos):squaredLength()
for _, point in ipairs(self.points) do
local pos = point.pos
@/lua/ge/extensions/editor/resourceChecker.lua
--log('E', '', '# objects existing: ' .. tostring(#scenetree.getAllObjects()))
for _, objName in ipairs(objs) do
local o = scenetree.findObject(objName)
local root = { name="/", path="/", isDir=true, bytes=0, children={} }
for _,f in ipairs(files or {}) do
local p = f.path or ""
for i,r in ipairs(rects) do
local path = r.item.path
table.sort(kids, function(a,b) return (a.bytes or 0) > (b.bytes or 0) end)
for _,ch in ipairs(kids) do row(ch) end
im.TreePop()
local order = {"textures","meshes_cache","meshes_source","terrain","audio","datablocks","other"}
for i, k in ipairs(order) do
local info = breakdown[k]
@/lua/ge/extensions/flowgraph/nodes/mission/selectGarage2GarageZones.lua
local zoneSet = {}
for _, zoneName in ipairs(zoneNames) do
zoneSet[zoneName] = true
if spot.zones then
for _, zone in ipairs(spot.zones) do
if zoneSet[zone.name] then
local usedStartSet = tableValuesAsLookupDict(self.usedStartSpots)
for _, spotData in ipairs(possibleStartSpots) do
if not usedStartSet[spotData.name] then
local usedEndSet = tableValuesAsLookupDict(self.usedEndSpots)
for _, spotData in ipairs(possibleEndSpots) do
if not usedEndSet[spotData.name] then
@/lua/ge/extensions/career/modules/delivery/tutorial.lua
local containers = dGeneral.getMostRecentCargoContainerData()
for _, container in ipairs(containers) do
local dist = (container.position - playerPosition):length()
local playerCargo = dParcelManager.getAllCargoInVehicles(true)
for _, cargo in ipairs(playerCargo) do
if cargo.location.vehId == playerVehId then
local vehicleTasks = dVehicleTasks.getVehicleTasks()
for _, task in ipairs(vehicleTasks) do
if task.offer and task.offer.data and task.offer.data.isTutorialVehicle then
@/gameplay/missionTypes/cannon/customNodes/MarkersNode.lua
markerOffset.z = self.pinIn.zMarkerOffset.value
for _, id in ipairs(vehIds) do
local veh = scenetree.findObjectById(id)
@/gameplay/missionTypes/busMode/constructor.lua
self.fgVariables = {}
for _, key in ipairs({"direction","routeId","variance","rdirection", "spawnPos", "spawnRot"}) do
self.fgVariables[key] = self.missionTypeData[key]
local ret = {self.startTrigger.pos}
for _, task in ipairs(self.missionTypeData.tasklist or {}) do
local help = self.missionTypeData.navhelp and self.missionTypeData.navhelp[task] or {}
local help = self.missionTypeData.navhelp and self.missionTypeData.navhelp[task] or {}
for _, h in ipairs(help) do
if map.getMap().nodes[h] then
@/lua/ge/extensions/freeroam/bigMapMode.lua
if mapBoundsFogPool then
for _, fog in ipairs(mapBoundsFogPool) do
fog:delete()
local color = spaceSeparated4Values(0,0,0,0)
for _, fog in ipairs(mapBoundsFogPool) do
fog.hidden = false
local function includeClustersInBbox(bbox)
for i, poi in ipairs(gameplay_rawPois.getRawPoiListByLevel(getCurrentLevelIdentifier())) do
if poi.markerInfo.bigmapMarker then
else
for _, cluster in ipairs(gameplay_rawPois.getAllClusters()) do
addMissionIdsToList(cluster, missionIdsSorted)
local missionIds = {}
for i, mission in ipairs(missionIdsSorted) do
missionIds[i] = mission.id
local color = spaceSeparated4Values(0,0,0,levelBoundAlpha)
for _, fog in ipairs(mapBoundsFogPool) do
fog:setField('instanceColor', 0, color)
local color = spaceSeparated4Values(0,0,0,1)
for _, fog in ipairs(mapBoundsFogPool) do
fog:setField('instanceColor', 0, color)
if mapBoundsFogPool then
for _, fog in ipairs(mapBoundsFogPool) do
fog.hidden = true
for i, cluster in ipairs(gameplay_playmodeMarkers.getPlaymodeClusters()) do
local marker = gameplay_playmodeMarkers.getMarkerForCluster(cluster)
-- if none has been found, use the bigmapMarkers instead
for i, poi in ipairs(gameplay_rawPois.getRawPoiListByLevel(getCurrentLevelIdentifier())) do
if poi.id == poiId and poi.markerInfo.bigmapMarker then
-- set target for markerInteraction
for i, cluster in ipairs(gameplay_playmodeMarkers.getPlaymodeClusters()) do
if cluster.containedIdsLookup and cluster.containedIdsLookup[poiId] then
for _, poi in ipairs(gameplay_rawPois.getRawPoiListByLevel(getCurrentLevelIdentifier())) do
if poiId == poi.id then
local missionIdsById = {}
for _, v in ipairs(missionIds) do
missionIdsById[v] = true
@/lua/common/guihooks.lua
local numOfSteps = #values
for i,v in ipairs(values) do
v[1] = v[1] or string.format("#%i", i) -- key
local keys = {}
for _,v in ipairs(values) do
table.insert(keys, string.format(v[4]=="" and "%s%s" or "%s (%s)", v[1], v[4]))
local row = {}
for _,v in ipairs(values) do
table.insert(row, v[2])
@/gameplay/missionTypes/scatterPickup/customNodes/scatterStuffInZonesNode.lua
for _, zone in ipairs(self.pinIn.sitesData.value.zones.sorted) do
if #zone.vertices > 2 then
self.quadtree = kdtreePoint3d.new()
for i, p in ipairs(self.points) do
self.quadtree:preLoad(i, p.x, p.y, p.z)
function C:drawMiddle(builder, style)
for _, p in ipairs(self.points or {}) do
debugDrawer:drawSphere(p, 0.5, ColorF(0.91,0.05,0.48,0.1))
@/lua/vehicle/controller/pneumatics/autoLevelSuspension.lua
for _, name in ipairs(groupNameOrNames) do
local group = controlGroups[name]
@/gameplay/missionTypes/evade/customNodes/roadblockPropsNode.lua
if self.pinIn.vehicleIds.value then
for _, v in ipairs(self.pinIn.vehicleIds.value) do
gameplay_police.insertProp(v)
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/scenarioTiles.lua
if backend.backendName == "gameplaySelector" then
for _, scenario in ipairs(scenario_scenariosLoader.getList(nil, false, true)) do
local item = {
local goalsValue = ""
for i, goal in ipairs(scenario.goals) do
if i > 1 then goalsValue = goalsValue .. ", " end
if scenario.additionalAttributes and #scenario.additionalAttributes > 0 then
for _, attr in ipairs(scenario.additionalAttributes) do
table.insert(specifications, {
@/lua/ge/extensions/scenario/finishRaceGoal.lua
if state == 'onRaceWaypointReached' then
for _,instance in ipairs(M.instances) do
if stateData.next == nil then
if state == 'onRaceResult' then
for _,instance in ipairs(M.instances) do
if not instance.status.result or instance.status.result == 'failed' then
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'finishRace' then
local function updateFinalStatus(scenario)
for _,instance in ipairs(M.instances) do
statistics_statistics.setGoalProgress(instance.vId, instance.id, instance.vId, {status=instance.status.result, maxPoints=nil})
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/path.lua
if im.TreeNode1("Data##textCharacterPositions") then
for k, v in ipairs(layer.textCharacterPositions) do
im.TextUnformatted(string.sub(layer.text, k, k))
if im.Button("Reset all##textCharacterPositions") then
for k,v in ipairs(layer.textCharacterPositions) do
local val = (1.0 / (#layer.text - 1) * (k-1))
for i, point in ipairs(layer.dataPoints) do
layerDataCopy.cursorPosScreenUv = {
for k, data in ipairs(layer.dataPoints) do
im.TextUnformatted(tostring(k))
im.TableHeadersRow()
for _, property in ipairs(api.properties["Path Layer"]) do
im.TableNextColumn()
@/lua/ge/suspensionFrequencyTester.lua
local function initNodes()
for _,node in ipairs(nodes) do
node.freqFilters = createFreqFilters()
for _, node in ipairs(nodes) do
imgui.Spacing()
local minCategorySum = math.huge
for catIdx, entry in ipairs(reference) do
local freqLimit = entry[2]
local categoryRange = maxCategorySum - minCategorySum
for catIdx, entry in ipairs(reference) do
imgui.TableNextRow()
if not veh then return end
for _, node in ipairs(nodes) do
if not node.id then goto continue end
local _,_,posZ = veh:getNodePositionXYZ(node.id)
for i, freqFilter in ipairs(node.freqFilters) do
node.amplitudes[i] = freqFilter.filter:get(posZ, dtSim, freqFilter.freq, freqExistsWindowPtr[0])
windowOpen[0] = true
for _, node in ipairs(nodes) do
node.amplitudes = {}
node.amplitudes = {}
for _, freqFilter in ipairs(node.freqFilters) do
freqFilter.filter:reset()
@/lua/ge/extensions/career/modules/vehicleShopping.lua
local soldVehicles = {}
for k,v in ipairs(t) do
if v.soldViewCounter and v.soldViewCounter > 0 then
local vehicleCountPerDealership = {}
for _, vehicle in ipairs(unsoldVehicles) do
vehicleCountPerDealership[vehicle.sellerId] = (vehicleCountPerDealership[vehicle.sellerId] or 0) + 1
local data = {}
for _, dealership in ipairs(dealerships) do
table.insert(data, {
local sum = 0
for _, configInfo in ipairs(configs) do
configInfo.adjustedPopulation = configInfo.Population or 1
local average = sum / tableSize(configs)
for _, configInfo in ipairs(configs) do
local distanceFromAverage = configInfo.adjustedPopulation - average
shopId = math.floor(math.random() * 1000000)
for _, vehInfo in ipairs(vehiclesInShop) do
if vehInfo.shopId == shopId then
local function getVehicleInfoByShopId(shopId)
for _, vehInfo in ipairs(vehiclesInShop) do
if vehInfo.shopId == shopId then
local configsInDealership = {}
for _, vehicleInfo in ipairs(vehiclesInShop) do
if vehicleInfo.sellerId == seller.id then
local facilities = deepcopy(freeroam_facilities.getFacilities(getCurrentLevelIdentifier()))
for _, dealership in ipairs(facilities.dealerships) do
if onlyStarterVehicles then
if not onlyStarterVehicles then
for _, dealership in ipairs(facilities.privateSellers) do
table.insert(sellers, dealership)
for _, seller in ipairs(sellers) do
if not sellersInfos[seller.id] then
for i, randomVehicleInfo in ipairs(randomVehicleInfos) do
-- Distribute generation times evenly between lastGenerationTime and currentTime
local sellerInfos = {}
for id, vehicleInfo in ipairs(vehiclesInShop) do
if vehicleInfo.pos then
-- remove the vehicle from the shop
for i, vehInfo in ipairs(vehiclesInShop) do
if vehInfo.shopId == purchaseData.vehicleInfo.shopId then
for _, vehicleInfo in ipairs(vehiclesInShop) do
vehicleInfo.pos = vec3(vehicleInfo.pos)
@/lua/ge/extensions/ui/liveryEditor/userData.lua
local files = FS:findFiles(saveDir, '*' .. dynDecalsExtension, -1, false, false)
for i, file in ipairs(files) do
local stat = FS:stat(file)
@/lua/common/libs/resty/template/microbenchmark.lua
{% for _, v in ipairs(context) do %}
- {{v}}
@/lua/ge/extensions/ui/messagesTasksAppContainers.lua
im.Text("App Controls:")
for _, appId in ipairs(tableKeysSorted(container.apps)) do
local app = container.apps[appId]
im.Text("Currently Visible:")
for _, appId in ipairs(visibleApps) do
im.BulletText(appId)
@/lua/ge/extensions/flowgraph/nodes/util/customLua.lua
table.sort(sortedNames)
for _, name in ipairs(sortedNames) do
if im.Selectable1(name, name == self.name) then
for _, code in ipairs(codeNames) do
if self.status[code] == nil then
function C:_executionStarted()
for _, code in ipairs(codeNames) do
self:compile(code)
self.code = deepcopy(data.code or self.code)
for _, code in ipairs(codeNames) do
self:compile(code)
-- add all non-virtual extensions from the global table to the env
for _, extName in ipairs(extensions.getLoadedExtensionsNames(true) or {}) do
env[extName] = _G[extName]
env.refreshExtensions = function()
for _, extName in ipairs(extensions.getLoadedExtensionsNames(true) or {}) do
env[extName] = _G[extName]
extensions.load(...)
for _, extName in ipairs(extensions.getLoadedExtensionsNames(true) or {}) do
env[extName] = _G[extName]
extensions.unload(...)
for _, extName in ipairs(extensions.getLoadedExtensionsNames(true) or {}) do
env[extName] = _G[extName]
@/lua/vehicle/sounds.lua
local maxStressVolume = 0
for bi, snd in ipairs(beamSounds) do
local beamVel = obj:getBeamVelocity(snd.beam)
local sbeamFiles = {}
for _, file in ipairs(files) do
table.insert(sbeamFiles, file)
for _, snd in ipairs(beamSounds) do
snd.resonance = 0
local count = 0
for index, engine in ipairs(engines) do
if engine.getSoundConfiguration then
@/lua/vehicle/controller/pyrotechnicCharge.lua
sounds.playSoundOnceFollowNode(eventName, eventNodeId, eventVolume, 1, 1, 1)
for _, breakgroup in ipairs(breakgroups) do
beamstate.breakBreakGroup(breakgroup)
for _, coupler in ipairs(couplers) do
beamstate.detachCouplers(coupler, true, true)
local doTrigger = false
for _, triggerElectric in ipairs(triggerElectrics) do
if electrics.values[triggerElectric] == 1 or electrics.values[triggerElectric] == true then
@/lua/common/luaProfiler.lua
self.sections = self.sections or {}
for _,v in ipairs(self.sections) do
if v.section == section then
self.sections = self.sections or {}
for _, t in ipairs(self.sections) do
currTotalTime = currTotalTime + t.time
log("I", "", msg)
for _, t in ipairs(self.sections) do
local localPeakDetected = self.stats[t.section].deltaRel > 0.3
@/lua/ge/extensions/gameplay/rally/notebook/path.lua
function C:appendPacenotes(pacenotes)
for _,pn in ipairs(pacenotes) do
local newPn = self.pacenotes:create()
local uniqueCount = 0
for _,codriver in ipairs(self.codrivers.sorted) do
if not codriverNameSet[codriver.name] then
local newList = {}
for i, v in ipairs(self.pacenotes.sorted) do
table.insert(newList, v)
-- Assign "sortOrder" in the sorted list
for i, v in ipairs(newList) do
v.sortOrder = i
for _, pacenote in ipairs(self.pacenotes.sorted) do
-- Extract the alphanumeric identifier from pacenote names that match "Import_X"
function C:cleanupPacenoteNames()
for i, v in ipairs(self.pacenotes.sorted) do
-- Pattern to match a name ending with a number: capture the non-numeric part and the numeric part
local function drawPacenotesAsRainbow(pacenotes, selection_state, globalOpacity)
for _,pacenote in ipairs(pacenotes) do
pacenote:drawDebugPacenoteNoSelection(selection_state, globalOpacity)
local skip_i = nil
for i,pacenote in ipairs(pacenotes) do
if pacenote.id == skip_pn.id then
for i,pacenote in ipairs(pacenotes) do
if pacenote.id == selected_pn_id then
}
for _,pacenote in ipairs(pacenotes) do
pacenote:drawDebugPacenotePartitionAllSnaproad(pacenoteToolsState, selectionState)
for _,langData in ipairs(langs) do
local lang = langData.language
for key,val in pairs(sp) do
for i,variant in ipairs(val) do
local pnName = key..'_'..i
local nextOldId = 1
for _,pn in ipairs(stage1) do
if not stage2[pn.name] then
log('I', logTag, 'upgrading '..self.name..' from v2 to v3')
for _, pacenote in ipairs(self.pacenotes.sorted) do
pacenote:upgradeFromV2ToV3()
self.textCompositor = nil -- clear the cached text compositor
for _,pacenote in ipairs(self.pacenotes.sorted) do
pacenote:refreshStructured()
function C:refreshAllFreeformNotes()
for _,pacenote in ipairs(self.pacenotes.sorted) do
pacenote:refreshFreeform()
function C:generateAllFreeform()
for _,pacenote in ipairs(self.pacenotes.sorted) do
pacenote:generateFreeformFromStructured()
-- Create pacenotes from detected corners
for i, corner in ipairs(corners) do
-- Skip straights (only create pacenotes for actual corners)
-- first clear everything
for _,pacenote in ipairs(self.pacenotes.sorted) do
if pacenote:getNoteFieldBefore() ~= rallyUtil.autofill_blocker and pacenote:getNoteFieldBefore() ~= rallyUtil.autodist_internal_level1 then
for i,pacenote in ipairs(self.pacenotes.sorted) do
-- Apply any prepended text from the previous iteration
local codriver = nil
for _,cd in ipairs(self.codrivers.sorted) do
if cd.name == codriver_name then
local codriver = nil
for _,cd in ipairs(self.codrivers.sorted) do
if cd.pk == codriverPk then
self:clearCompilationFailures()
for i,pn in ipairs(self.pacenotes.sorted) do
pn.visualSerialNo = i
function C:clearCompilationFailures()
for _,pn in ipairs(self.pacenotes.sorted) do
pn:clearCompilationFailures()
-- Calculate each object's distance from the input position and store it
for _,pacenote in ipairs(self.pacenotes.sorted) do
local distance = pos:distance(pacenote:getCornerStartWaypoint().pos) -- using the provided distance method
local pacenotesSorted = self.pacenotes.sorted
for i, note in ipairs(pacenotesSorted) do
if pacenote_id == note.id then
local pacenotesSorted = self.pacenotes.sorted
for i, note in ipairs(pacenotesSorted) do
note:clearAdjacentNotes()
for i, note in ipairs(pacenotesSorted) do
local prevNote = pacenotesSorted[i-1]
function C:markAllTodo()
for _,pn in ipairs(self.pacenotes.sorted) do
pn:markTodo()
function C:clearAllTodo()
for _,pn in ipairs(self.pacenotes.sorted) do
pn:clearTodo()
local hitPacenote = false
for _,pn in ipairs(self.pacenotes.sorted) do
if pn.id == pacenote.id then
local absPath = '/'
for _,dir in ipairs(dirs) do
absPath = absPath..dir..'/'
function C:clearPacenoteAudioModeOverrides()
for _, pacenote in ipairs(self.pacenotes.sorted) do
pacenote:setAudioMode(RallyEnums.pacenoteAudioMode.auto)
function C:deletePacenoteLanguage(lang)
for _, pacenote in ipairs(self.pacenotes.sorted) do
pacenote:deleteLanguage(lang)
@/lua/ge/extensions/editor/layoutManager.lua
local function deleteWindowLayout(layoutPath)
for _, path in ipairs(FS:findFiles(layoutPath, "*", -1, true, false)) do
FS:removeFile(path)
for _, path in ipairs(FS:findFiles(layoutDirectory, "*", 0, true, true)) do
if not string.find(path, "/Default") then
@/lua/ge/extensions/flowgraph/nodes/career/onRefueling.lua
local cur, max = 0,0
for index, data in ipairs(fuelData or {} ) do
cur, max = cur + data.currentEnergy, max + data.maxEnergy
@/lua/ge/extensions/campaign/campaigns.lua
for _, vehicle in ipairs(reqData.data) do
if vehicle.model == vehicleData.model and vehicle.config == vehicleData.config then
local canStart = true
for _, reqData in ipairs(scenarioData.requires or {}) do
if reqData.dataType == "scenarios" then
local result = false
for _,entry in ipairs(achievement.requires) do
-- dump(entry)
for _, v in ipairs(data.achievements) do
if v.key and type(v.key) == 'string' then
@/lua/ge/extensions/gameplay/rally/notebook/structured/visualCompositor.lua
local minDiff = math.huge
for _, sevData in ipairs(configSeverities) do
local sevValue = tonumber(sevData.value)
local minDiff = math.huge
for _, radData in ipairs(configRadiusChanges) do
local radVal = tonumber(radData.value)
for _, modField in ipairs(modFields) do
local mod = noteAttrs[modField]
for i,vp in ipairs(visualPacenotes) do
vp.id = string.format("%s_%d", string.gsub(pacenote.name, ' ', '_'), i)
@/lua/ge/extensions/core/audio.lua
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
for _,filepath in ipairs(stringFiles) do
if not loadedBankCache[filepath] then
end
for _,filepath in ipairs(preloadFiles) do
if not loadedBankCache[filepath] then
end
for _,filepath in ipairs(normalFile) do
if not loadedBankCache[filepath] then
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
for _,filepath in ipairs(stringFiles) do
if not loadedBankCache[filepath] then
end
for _,filepath in ipairs(preloadFiles) do
if not loadedBankCache[filepath] then
end
for _,filepath in ipairs(normalFile) do
if not loadedBankCache[filepath] then
for i, v in ipairs(forLoad) do
if not loadedBankCache[v] then
if not inLevelOrLoading then
for _,v in ipairs(forLoadLevel) do
if v == bankFilePath then
local function loadLevelBanks()
for i, v in ipairs(ambient_banks) do
loadLevelBank(v)
end
for i, v in ipairs(forLoadLevel) do
loadLevelBank(v)
for i,filepath in ipairs(asset_banks) do
if string.find(filepath, 'ambient_maps') then
for i,filepath in ipairs(meta_banks) do
if string.find(filepath, 'ambient_maps') then
-- so clear their cache entries so they get loaded on next level load
for _, v in ipairs(ambient_banks) do
cacheClearEntry(v)
local function startProcessForHotloading()
for i, projectName in ipairs(levelProjectsCache) do
local project = scenetree.findObject(projectName)
@/lua/ge/extensions/career/modules/loanerVehicles.lua
local result = {}
for _, vehInfo in ipairs(getLoanedVehicles()) do
if organizationId == vehInfo.owningOrganization then
local result = {}
for _, vehInfo in ipairs(getLoanedVehicles()) do
local veh = deepcopy(vehInfo)
veh.capacity = {}
for _, cap in ipairs(configInfo.capacity) do
if cap.type == "fluid" then
for idx, rentalVehicleInfo in ipairs(organization.loanableVehicles or {}) do
local configInfo = core_vehicles.getConfig(rentalVehicleInfo.model, rentalVehicleInfo.config)
for _, parkingSpot in ipairs(spots) do
if not parkingSpot:hasAnyVehicles() then
item.capacity = {}
for _, cap in ipairs(configInfo.capacity) do
if cap.type == "fluid" then
@/lua/ge/extensions/core/vehicleActivePooling.lua
new.total = 0
for _, v in ipairs(new.activeVehs) do
new.allVehs[v] = 1
end
for _, v in ipairs(new.inactiveVehs) do
new.allVehs[v] = 0
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
for _, v in ipairs(deepcopy(self.inactiveVehs)) do
if limit <= 0 then break end
if not self.activeVehs[1] then return false end
for _, v in ipairs(deepcopy(self.activeVehs)) do
self:setVeh(v, false)
if difference > 0 then -- hide some active vehicles
for i, v in ipairs(deepcopy(self.activeVehs)) do
if i <= difference then
local function onDeserialized(data)
for _, v in ipairs(data) do
local pool = createPool()
@/lua/ge/extensions/util/compileImposters.lua
for i, levelName in ipairs(queue) do
log('D', 'compileImposters', 'Loading level for compilation: ' .. levelName)
@/lua/ge/extensions/flowgraph/nodes/mission/knockAwayCheck.lua
local transforms = {}
for _, id in ipairs(data.allChildrenIds['BeamNGVehicle'] or {}) do
local veh = scenetree.findObjectById(id)
@/lua/ge/extensions/core/cameraModes/collision.lua
-- Test for geometry intersecting with the near clip plane
for i, cornerPos in ipairs(rayDestinations) do
local rayDest = rayDestinations[(i % 4) + 1]
-- Make 4 parallel raycasts from the targetPos to the camera pos and position the camera based on the closest hit
for i, cornerPos in ipairs(rayDestinations) do
rayStart:setSub2(cornerPos, dir)
@/lua/ge/extensions/flowgraph/nodes/scene/spawnTSStatic.lua
function C:onNodeReset()
for _, obj in ipairs(self.objects) do
if obj then
@/lua/common/tech/pcdLib.lua
local pointSize = 0
for _, v in ipairs(self.size) do
pointSize = pointSize + v
@/lua/ge/extensions/editor/dynamicDecals/fonts.lua
for _, fontName in ipairs(generatedFontAtlases) do
if im.TreeNode1(string.format("%s##browserTabGui", fontName)) then
generatedFontAtlases = {}
for _, file in ipairs(files) do
local dir, filename, ext = path.split(file)
for _, notification in ipairs(fontGenNotifications) do
im.TextColored(notification.color or editor.color.warning.Value, notification.msg)
local function editModeUpdate(dtReal, dtSim, dtRaw)
for k, notif in ipairs(fontGenNotifications) do
notif.time = notif.time - dtReal
@/lua/common/utils/perf.lua
f:write(";function, time\n")
for _,vv in ipairs(d.fcts) do
f:write(vv.f .. ', ' .. tostring(vv.s) .. "\n")
@/lua/vehicle/extensions/core/booster.lua
for _, boost in ipairs(boosts) do
local boostVec = boost[1] * 1000
@/lua/ge/extensions/editor/flowgraph/execution.lua
if editor.uiIconImageButton(editor.icons.play_arrow, im.ImVec2(20, 20)) then
for _, m in ipairs(self.fgMgr.getAllManagers()) do
missionVarHelper.applyMissionVariablesToManager(m, "execution")
if editor.uiIconImageButton(editor.icons.stop, im.ImVec2(20, 20)) then
for _, m in ipairs(self.fgMgr.getAllManagers()) do
m:setRunning(false)
--if editor.uiIconImageButton(editor.icons.replay, im.ImVec2(25, 25)) then
-- for _, m in ipairs(self.fgMgr.getAllManagers()) do
-- m:queueForRestart()
im.Separator()
for _, mgr in ipairs(self.fgMgr.getAllManagers()) do
if (not mgr.hidden and not mgr.transient) or editor.getPreference("flowgraph.debug.editorDebug") then
@/lua/common/extensions/ui/imguiWire.lua
local id = ''
for _, j in ipairs(t) do
id = id .. '|' .. tostring(j)
local results = {}
for k, v in ipairs(buf) do
local funcName = v[1]
@/lua/ge/extensions/career/modules/milestones/general.lua
--cache/sort Ids.
for i, milestone in ipairs(milestoneConfigs) do
milestonesById[milestone.id] = milestone
-- check savedata correctness
for _, milestone in ipairs(milestoneConfigs) do
milestones.saveData.general[milestone.id] = milestones.saveData.general[milestone.id] or {claimedStep = 0, notificationStep = 0}
local function onGetMilestones(list, filter)
for _, milestoneConfig in ipairs(milestoneConfigs) do
local valid = true
if milestoneConfig.filter then
for _, filterId in ipairs(filter) do
if milestoneConfig.filter[filterId] then
local csvdata = require('csvlib').newCSV("id","step","maxStep","name","description","target","money","xp")
for _, c in ipairs(milestoneConfigs) do
for s = 1, (c.maxStep or 1) do
@/lua/vehicle/powertrain/combustionEngineThermals.lua
exhaustTrees = {}
for _, n in ipairs(exhaustStartNodes) do
--build exhaust tree recursively
local tmpExhaustConnectedNodes = {}
for _, t in ipairs(exhaustTrees) do
--find initial exhaust end points
local exhaustEndNodeDeDuplicate = {}
for _, v in ipairs(tmpExhaustEndNodes) do
if not exhaustEndNodeDeDuplicate[v.finish] then
local exhaustConnectedNodeDeDuplicate = {}
for _, v in ipairs(tmpExhaustConnectedNodes) do
if not exhaustConnectedNodeDeDuplicate[v] then
local tmpExhaustConnectedNodes = {}
for _, t in ipairs(exhaustTrees) do
--break off a tree branch
local exhaustEndNodeDeDuplicate = {}
for _, v in ipairs(tmpExhaustEndNodes) do
if not exhaustEndNodeDeDuplicate[v.finish] then
local exhaustConnectedNodeDeDuplicate = {}
for _, v in ipairs(tmpExhaustConnectedNodes) do
if not exhaustConnectedNodeDeDuplicate[v] then
local tmpExhaustConnectedNodes = {}
for _, t in ipairs(exhaustTrees) do
--break off a tree branch
local exhaustNodeDeDuplicate = {}
for _, v in ipairs(tmpExhaustEndNodes) do
if not exhaustNodeDeDuplicate[v.finish] then
local exhaustConnectedNodeDeDuplicate = {}
for _, v in ipairs(tmpExhaustConnectedNodes) do
if not exhaustConnectedNodeDeDuplicate[v] then
@/lua/ge/extensions/gameplay/drag/general.lua
-- Initialize phases
for _, phase in ipairs(dragData.phases) do
table.insert(racer.phases, {
if racer.phases then
for _, phase in ipairs(racer.phases) do
phase.started = false
local successCount = 0
for _, d in ipairs(dials) do
if d and d.racerId and d.value then
local timers = {}
for _, timeLabel in ipairs(timerKeys) do
timers[timeLabel] = string.format("%0.3f", racer.timers[timeLabel].value)
local velocities = {}
for _, velLabel in ipairs(velocityKeys) do
velocities[velLabel..'_km/h'] = string.format("%0.3f", racer.timers[velLabel].value * 3.6)
local ret = {}
for _, key in ipairs({"stripInfo","tree","env","racerInfos"}) do
ret[key] = slip[key]
local tab = slip.timesTable
for _, l in ipairs(tab[1]) do
table.insert(grid.labels, l)
for i, file in ipairs(settingsFiles) do
local dragData = gameplay_drag_saveSystem.loadDragStripData(file)
for i, lane in ipairs(data.strip.lanes) do
local stagePos = nil
@/lua/ge/extensions/flowgraph/nodes/ui/missionEndScreen.lua
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
local contained = false
for _, op in ipairs(self.oldOptions) do
if pn.name == op or pn.name == op.."_active" then
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
if self.mgr.activity and self.mgr.activity.nextMissions then
for _, mid in ipairs(self.mgr.activity.nextMissions or {}) do
local mission = gameplay_missions_missions.getMissionById(mid)
for _, btn in ipairs(self.options) do
if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
if self.pinIn.customBtnsFirst.value then
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
else
else
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
end
@/lua/vehicle/props.lua
if deformGroupMap[deformGroup] then
for _, prop in ipairs(deformGroupMap[deformGroup]) do
if not prop.disabled then
if breakGroupMap[breakGroup] then
for _, prop in ipairs(breakGroupMap[breakGroup]) do
if not (prop.hidden and prop.disabled) then
@/lua/ge/extensions/gameplay/backgroundActivities/g2g.lua
log("I","","deactivating g2g backrgound activity")
for _, data in ipairs(vehicleIds) do
local obj = scenetree.findObjectById(data.vehId)
vehicleOptions = {}
for _, v in ipairs(vehs) do
local passType = true
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenBegin.lua
local remove = nil
for i, btn in ipairs(self.options) do
local txt = im.ArrayChar(64, btn)
local contained = false
for _, op in ipairs(self.oldOptions) do
if pn.name == op or pn.name == op.."_active" then
self.oldOptions = {}
for i, btn in ipairs(self.options) do
self:createPin("in", "string", btn, btn)
for _, lnk in ipairs(flowLinks) do
if lnk.sourcePin.name and self.pinOut[lnk.sourcePin.name] then
end
for _, lnk in ipairs(strLinks) do
if lnk.targetPin.name and self.pinInLocal[lnk.targetPin.name] then
table.sort(attributesSorted, career_branches.sortAttributes)
for _, key in ipairs(attributesSorted) do
if entryFee[key] > 0 then
for _, btn in ipairs(self.options) do
if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
local buttonsTable = {}
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(customBtns) do table.insert(buttonsTable, btn) end
for _, btn in ipairs(defaultBtns) do table.insert(buttonsTable, btn) end
if self.mgr.activity and self.mgr.activity.nextMissions then
for _, mid in ipairs(self.mgr.activity.nextMissions or {}) do
local mission = gameplay_missions_missions.getMissionById(mid)
@/lua/ge/extensions/flowgraph/pin.lua
if im.MenuItem1("Show all links") then
for _, link in ipairs(self.links) do
link.hidden = false
if im.MenuItem1("Hide all links") then
for _, link in ipairs(self.links) do
link.hidden = true
--else
for i, lnk in ipairs(self.links) do
if lnk == link then
@/lua/ge/extensions/gameplay/parking.lua
if not psList or type(psList[1]) ~= "table" then return psList end
for i, v in ipairs(psList) do
psList[i].squaredDistance = pos:squaredDistance(v.ps.pos)
for _, psData in ipairs(psList) do
local ps = psData.ps
repeat -- randomize which parking spots are selected, with a bias towards nearer parking spots
for i, ps in ipairs(psList) do
local minValue = min(fallbackValue, lerp(ratio, 1, square(i / psCount))) -- minValue is lower for nearer parking spots
for _, id in ipairs(vehIds) do
forceTeleport(id, randomPsList)
if M.debugLevel > 0 then
for _, v in ipairs(vehData.psList) do
local ps = v.ps
local bestPs
for _, v in ipairs(vehData.psList) do -- nearest parking spot
if v.ps:vehicleFits(vehId) and (not v.ps.vehicle or v.ps.vehicle == vehId) then
valid, result.corners = bestPs:checkParking(vehId, vars.precision) -- checks if all vehicle corners are inside the parking spot with respect to the precision
for _, v in ipairs(result.corners) do
if v then
if M.debugLevel >= 2 then
for i, v in ipairs(result.corners) do
local dColor = v and ColorF(0.3, 1, 0.3, 0.5) or ColorF(1, 0.3, 0.3, 0.5)
for _, psData in ipairs(currParkingSpots) do
local ps = psData.ps
for _, id in ipairs(vehIds) do
insertVehicle(id)
transforms = {}
for _, ps in ipairs(psList) do
table.insert(transforms, {pos = ps.ps.pos, rot = ps.ps.rot})
if parkedVehData[vehId]._teleport then -- force teleport if flag exists
for _, otherVeh in ipairs(getAllVehicles()) do
local otherId = otherVeh:getId()
for _, id in ipairs(parkedVehIds) do
parkedVehData[id].searchFlag = false -- reset search flag for all parked cars
for _, veh in ipairs(getAllVehicles()) do
if not veh.isTraffic and not veh.isParked and map.objects[veh:getId()] then
activate(data.parkedVehIds, true)
for _, v in ipairs(data.trackedVehIds) do
enableTracking(v)
@/lua/ge/extensions/flowgraph/manager.lua
self.modules = { }
for _, m in ipairs({'missionReplay', 'drift', 'vehicle', 'level', 'prefab', 'timer', 'button', 'action', 'camera', 'file', 'traffic', 'mission', 'foreach', 'thread', 'ui', 'aiRecording'}) do
self.modules[m] = require('/lua/ge/extensions/flowgraph/modules/' .. m .. 'Module').create(self)
-- find target pin.
for index, pin in ipairs(inPins) do
if pin.name == link.targetPin.name then
-- find target pin.
for index, pin in ipairs(outPins) do
if pin.name == link.sourcePin.name then
local storedPreviousInstance = self.recentInstance:getChildPosition()
for _, graphID in ipairs(graphIds) do
local graph = self.graphs[graphID]
local graphsToBeDeleted = {}
for _, graphID in ipairs(graphIds) do
local graph = self.graphs[graphID]
if dir == 'in' then
for _, lnk in ipairs(sources) do
nextEdge[lnk.targetNode.id] = true
if dir == 'out' then
for _, lnk in ipairs(targets) do
nextEdge[lnk.sourceNode.id] = true
function C:unselectAll()
for nId, _ in ipairs(self.selectedNodes) do
ui_flowgraph_editor.DeselectNode(nId)
table.clear(self.selectedNodes)
for lId, _ in ipairs(self.selectedLinks) do
ui_flowgraph_editor.DeselectLink(lId)
local lookup = {}
for i, filename in ipairs(FS:findFiles(macroPath, '*.json', -1, true, false)) do
local dirname, fn, e = path.split(filename)
local customNodePath = self.savedDir .. "customNodes/"
for _, filename in ipairs(FS:findFiles(customNodePath, '*Node.lua', -1, true, false)) do
local dirname, fn, e = path.split(filename)
table.sort(graphKeys)
for _, graphKey in ipairs(graphKeys) do
local graph = self.graphs[graphKey]
table.sort(macroKeys)
for _, macroKey in ipairs(macroKeys) do
local macro = self.macros[macroKey]
for _, mID in ipairs(dependencyMap) do
local macroID = self:getGraphNodeOffset() + tonumber(mID)
for _, graphId in ipairs(graphKeys) do
local graphData = data.graphs[graphId]
table.sort(graphKeys)
for _, graphKey in ipairs(graphKeys) do
local graph = self.graphs[graphKey]
end
for i, graph in ipairs(tGraphs) do
log("D", logTag, "Auto State for graph: " .. graph.name)
-- remove resolved from the list of others
for _, res in ipairs(resolved) do
for id, list in pairs(map) do
end
for _, mod in ipairs(self.moduleOrder) do
self.modules[mod]:onUpdate(dtReal, dtSim, dtRaw)
local moduleHooks = {}
for _, mod in ipairs(self.moduleOrder) do
local m = self.modules[mod]
local m = self.modules[mod]
for _, h in ipairs(m.hooks or {}) do
moduleHooks[h] = moduleHooks[h] or {}
hooks[h] = function(mh, ...)
for _, m in ipairs(ms) do
local status, err, res = xpcall(m[h], debug.traceback, m, ...)
for _, node in pairs(graph.nodes) do
for _, dep in ipairs(node.dependencies or {}) do
depKeys[dep] = true
for _, m in pairs(self.modules) do
for _, dep in ipairs(m.dependencies or {}) do
depKeys[dep] = true
local contained = false
for _, dc in ipairs(dualColorChecked) do
local same = true
local same = true
for idx, id in ipairs(dc) do
same = same and id == insert[idx]
local warning = 'Multiple root nodes for a section of this graph detected.\nThe following nodes share nodes which they will reach:\n'
for _, nd in ipairs(triggerNodes) do
warning = warning .. " - " .. nd:toString() .. "\n"
end
for _, mod in ipairs(self.moduleOrder) do
self.modules[mod]:executionStarted()
self.variables:_onClear()
for _, mod in ipairs(self.moduleOrder) do
self.modules[mod]:onClear()
self.variables:_executionStopped()
for _, mod in ipairs(self.moduleOrder) do
self.modules[mod]:executionStopped()
for _, ext in ipairs(self.extToUnload or {}) do
extensions.unload(ext)
if self.activity and self.activity.layers and type(self.activity.layers) == "table" then
for _, layer in ipairs(self.activity.layers) do
table.insert(folders, layer.dir)
for _, folder in ipairs(folders) do
for _, path in ipairs(paths) do
for _, folder in ipairs(folders) do
for _, path in ipairs(paths) do
local file = folder..path
end
for _, path in ipairs(files) do
if FS:fileExists(path) then
@/lua/ge/extensions/gameplay/drag/utils.lua
for _, racer in ipairs(winnerList) do
if racer.disqualified then
for _, racer in ipairs(qualifiedRacers) do
if racer.dialDiff < 0 then
winnerList = {}
for _, racer in ipairs(positiveRacers) do
table.insert(winnerList, racer)
end
for _, racer in ipairs(negativeRacers) do
table.insert(winnerList, racer)
end
for _, racer in ipairs(disqualifiedRacers) do
table.insert(winnerList, racer)
racer.wheelsCenter[k].pos:set(0, 0, 0)
for _, wheel in ipairs(offset) do
racer.wheelsCenter[k].pos:setAdd(racer.vehRot * wheel)
for _, value in ipairs(data) do
dialsData[value.vehId] = value.dial
@/lua/common/extensions/ui/imguiUtils.lua
--imgui.SetColumnOffset(-1, 40)
for _, k in ipairs(sortedKeys) do
local val = data[k]
for _, k in ipairs(sortedKeys) do
local val = data[k]
@/lua/ge/extensions/gameplay/rally/util/normalizer.lua
for _,mapping in ipairs(word_map) do
local from, to = mapping[1], mapping[2]
@/lua/ge/extensions/flowgraph/variableStorage.lua
local mgrTypes = ui_flowgraph_editor.getTypes()
for _, t in ipairs(types) do
t.color = mgrTypes[t.name].color
table.sort(list, function(a,b) return a.index < b.index end)
for i, elem in ipairs(list) do
self.sortedVariableNames[i] = elem.name
end)
for _, element in ipairs(data.list) do
self:addVariable(element.name, element.value, element.type, element.mergeStrat, element.fixedType, element.undeletable)
@/lua/ge/extensions/gameplay/missions/missionScreen.lua
local ownAggregate = {}
for i, label in ipairs(prog.ownAggregate.labels) do
table.insert(ownAggregate, {
--info.activeStars = M.getActiveStarsForUserSettings(m.id, info.defaultUserSettings)
for _, s in ipairs(info.userSettings) do
if (m.lastUserSettings and m.lastUserSettings[s.key] ~= nil) then
if m._lastUserSettingsOutsideOfMission then
for _, s in ipairs(info.userSettings) do
for _, l in ipairs(m._lastUserSettingsOutsideOfMission) do
for _, s in ipairs(info.userSettings) do
for _, l in ipairs(m._lastUserSettingsOutsideOfMission) do
if l.key == s.key then
for _, attKey in ipairs(additionalAttributesSortedKeys) do
local att = additionalAttributes[attKey]
end
for _, customAtt in ipairs(m.customAdditionalAttributes or {}) do
table.insert(info.additionalAttributes, customAtt)
local ownAggregate = {}
for i, label in ipairs(prog.ownAggregate.labels) do
table.insert(ownAggregate, {
for _, m in ipairs(currentInteractableElements) do
if m.missionId then
end
for _, m in ipairs(gameplay_missions_missions.get()) do
--table.insert(dataToSend, M.formatMission(gameplay_missions_missions.getMissionById(m.id)))
local activeMission = nil
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.id == gameplay_missions_missionManager.getForegroundMissionId() then
if hasCustomMissionList then
for _, id in ipairs(openMenuWithCustomMissionList) do
table.insert(missions, M.formatMission(gameplay_missions_missions.getMissionById(id)))
local ids = {}
for _, m in ipairs(missions) do ids[m.id] = true end
local missionUserSettingByKey = {}
for _, setting in ipairs(missionUserSettings) do
missionUserSettingByKey[setting.key] = setting
local viaCustomKey = nil
for _, setting in ipairs(userSettings) do
if setting.key == "setupModuleVehicles" and missionUserSettingByKey[setting.key] then
table.sort(attributesSorted, career_branches.sortAttributes)
for _, key in ipairs(attributesSorted) do
if entryFee[key] > 0 then
if userSettings[1] then
for _, setting in ipairs(userSettings) do
flatSettings[setting.key] = setting.value
-- fallback: default stars need same, bonus stars always on
for _, key in ipairs(starKeys) do
local info = {
local flatSettings = {}
for _, setting in ipairs(userSettings) do
flatSettings[setting.key] = setting.value
id = id or gameplay_missions_missionManager.getForegroundMissionId()
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.id == id then
local flatSettings = {}
for _, setting in ipairs(settings) do
flatSettings[setting.key] = setting.value
local ownAggregate = {}
for i, label in ipairs(prog.ownAggregate.labels) do
table.insert(ownAggregate, {
}
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.careerSetup.showInCareer and m.startTrigger.level == getCurrentLevelIdentifier() and m.startTrigger.type == "league" then
local setting, settingIdx = nil, nil
for _, s in ipairs(settings) do
if s.key == settingKey then
if m._lastUserSettingsOutsideOfMission then
for _, s in ipairs(m._lastUserSettingsOutsideOfMission) do
if s.key == settingKey then
if s.key == settingKey then
for _, option in ipairs(setting.values) do
if option.type == "custom" and option.viaUserSettingsKey == 'setupModuleVehiclesCustom' then
s.value = option.v
for _, l in ipairs(m._lastUserSettingsOutsideOfMission) do
if l.key == option.viaUserSettingsKey then
for _, m in ipairs(gameplay_missions_missions.get()) do
if not ids then
local flatSettings = {}
for _, setting in ipairs(settings or {}) do
flatSettings[setting.key] = setting.value
M.savedLayouts = {}
for _, file in ipairs(FS:findFiles("/gameplay/testing", "*.json", 1, false, true)) do
local layout = jsonReadFile(file)
-- Table rows
for i, layout in ipairs(layouts) do
im.PushID1("layout:"..i)
@/lua/ge/extensions/gameplay/markers/crawlMarker.lua
if interactData.canInteract and self.anyOverlap then
for _, elem in ipairs(self.cluster.elemData) do
table.insert(interactableElements, elem)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
local poisByObjectNames = {}
for _, poi in ipairs(pois) do
local cm = poi.markerInfo.crawlMarker
}
for _, poi in ipairs(poisInCluster) do
table.insert(cluster.elemData, poi.data)
@/lua/ge/extensions/gameplay/discover.lua
local discoverFiles = FS:findFiles("lua/ge/extensions/gameplay/discover/", "*.lua", 0, false, false)
for _, file in ipairs(discoverFiles) do
local dir, fn, ext = path.splitWithoutExt(file)
if discover.experiences then
for _, experience in ipairs(discover.experiences) do
discoversById[experience.id] = experience
page.order = pageInfo.order
for _, section in ipairs(pageInfo.sections) do
section.cards = {}
section.cards = {}
for _, id in ipairs(section.discoverIds) do
local discover = discoversById[id]
local cmdArgs = Engine.getStartingArgs()
for i, v in ipairs(cmdArgs) do
if v == "-discover" then
local function findIndex(arr, val)
for i, v in ipairs(arr) do
if v == val then return i end
table.insert(devices, {device = "fallback", imagePack = "fallback"})
for i, v in ipairs(devices) do
local popup = "basicDriving_"..v.imagePack
@/lua/ge/extensions/scenario/waypointAction.lua
if state == 'onRaceWaypointReached' and scenario.state == 'running' and scenario.raceState == 'racing' then
for _,instance in ipairs(M.instances) do
if next(instance.value.wayPointNum) == nil then
M.instances = {}
for _,instance in ipairs(scenario.goals.vehicles) do
if instance.id == 'wayPointAction' then
@/lua/ge/extensions/gameplay/rally/notebook/systemPacenotes.lua
-- for i, sp in ipairs(spCopy) do
-- local notes = {}
-- for _,lang in ipairs(langs) do
-- notes[lang.language] = {
@/lua/vehicle/bdebugImpl.lua
-- check adjacent cells for entries
for k, v in ipairs(cellsToCheck) do
local hash = getPosHash(tempVec, v[1] * overlapSize, v[2] * overlapSize, v[3] * overlapSize)
local displayAtNode = entries[1]
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local displayAtNode = entries[1]
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local displayAtNode = entries[1]
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local groupAvgWeight = 0
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local ar, ag, ab, aa = 0,0,0,0
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local displayAtNode = entries[1]
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local ar, ag, ab, aa = 0,0,0,0
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local displayAtNode = entries[1]
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
local displayAtNode = entries[1]
for k, i in ipairs(entries) do
local node = v.data.nodes[i]
if requestDrawnNodesCallbacks and next(requestDrawnNodesCallbacks) ~= nil then
for _, geFuncName in ipairs(requestDrawnNodesCallbacks) do
obj:queueGameEngineLua(geFuncName .. "(" .. serialize(nodesDrawn) .. "," .. nodeScale .. ")")
-- check adjacent cells for entries
for k, v in ipairs(cellsToCheck) do
local hash = getPosHash(tempVec, v[1] * overlapSize, v[2] * overlapSize, v[3] * overlapSize)
local pos = beamPositions[entries[1]]
for k, i in ipairs(entries) do
local beam = v.data.beams[i]
local pos = beamPositions[entries[1]]
for k, i in ipairs(entries) do
local beam = v.data.beams[i]
local pos = beamPositions[entries[1]]
for k, i in ipairs(entries) do
local beam = v.data.beams[i]
if requestDrawnBeamsCallbacks and next(requestDrawnBeamsCallbacks) ~= nil then
for _, geFuncName in ipairs(requestDrawnBeamsCallbacks) do
obj:queueGameEngineLua(geFuncName .. "(" .. serialize(beamsDrawn) .. "," .. beamScale .. ")")
-- Draw Slidenodes
for _, slidenode in ipairs(slidenodes) do
obj.debugDrawProxy:drawNodeSphere(slidenode.id, slideNodeScale, defaultCol)
for k, beam in ipairs(beams) do
if obj:beamIsBroken(beam.cid) then
@/lua/ge/extensions/scenario/raceMarkers/overhead.lua
function C:clearMarkers()
for _, id in ipairs(self._ids or {}) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/freeroam/gasStations.lua
local center, count = vec3(0,0,0), 0
for _, pair in ipairs(f.pumps or {}) do
local obj = scenetree.findObject(pair[1])
local maxDistSqr = 0
for _, pair in ipairs(f.pumps or {}) do
local obj = scenetree.findObject(pair[1])
if career_career.isActive() or settings.getValue("enableGasStationsInFreeroam") then
for i, gasStation in ipairs(facilities.gasStations or {}) do
table.insert(elements, formatGasStationPoi(gasStation))
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
if elem.type == "gasStation" then
local invalidTanks = {}
for _, tank in ipairs(ret[1]) do
if not ignoreFuelTypes[tank.energyType] then
if not allSuccess then
for _, fuelType in ipairs(tableKeysSorted(invalidTanks)) do
guihooks.trigger('Message',{msg = {txt = "ui.freeroam.refuel.notFilled", context = {fuelType = translateLanguage("ui.general.fuelType."..fuelType, fuelType, true)}}, category = "refueling-"..fuelType, icon = "warning", ttl=8})
@/lua/ge/extensions/editor/crawlEditor/waypoints.lua
for i, pathnode in ipairs(sortedWaypoints) do
if pathnode.id == deletedIndex then
for i, pathnode in ipairs(trail.path.pathnodes.sorted) do
local isSelected = pathnode.id == self.index
if self.path and self.path.pathnodes and self.path.pathnodes.sorted then
for i, node in ipairs(self.path.pathnodes.sorted) do
if node.id == index then
local remove
for i, name in ipairs(fields.names) do
if fields.types[name] == 'string' then
@/lua/ge/extensions/gameplay/missions/startTrigger.lua
elseif type(trigger.level) == 'table' then
for _, lvl in ipairs(trigger.level) do
table.insert(locations, {level=lvl, pos=nil, radius=nil, check=defaultLocationCheck, displayMarker=defaultLocationDisplayMarker})
local missingFields = {}
for _, field in ipairs(startTriggerRequiredFields[trigger.type] or {}) do
if trigger[field] == nil then
local clusterId = ""
for _, c in ipairs(cluster) do
weightedCenter = weightedCenter + c.radius * c.pos
local sumWeights = 0
for _, c in ipairs(cluster) do
local w = weightedCenter:distance(c.pos) + 1
local radius = 0
for _, c in ipairs(cluster) do
radius = math.max(radius, c.radius + newCenter:distance(c.pos))
local locationsByLevel = {}
for _, m in ipairs(missions) do
local isVisible = true -- gameplay_missions_missionManager.isVisible(m)
local locs = gameplay_missions_missions.getLocations(m)
for i, l in ipairs(locs) do
if l.type == 'coordinates' then
local count = 0
for i, loc in ipairs(locations) do
qt:preLoad(i, quadtree.pointBBox(loc.pos.x, loc.pos.y, (mergeRadius or loc.radius)))
-- remove all the elements in the cluster from the qt and the locations list
for _, c in ipairs(cluster) do
qt:remove(c._qtId, locations[c._qtId].pos.x, locations[c._qtId].pos.y)
@/lua/ge/extensions/editor/raceEditor/segments.lua
local closest = nil
for i, cap in ipairs(segment.capsulePoints) do
local dist = self:mouseDistanceTo(cap, self.mouseInfo)
im.BeginChild1("segments", im.ImVec2(125 * im.uiscale[0], 0), im.WindowFlags_ChildWindow)
for i, segment in ipairs(self.path.segments.sorted) do
local problem = (segment:getFrom().missing or segment:getTo().missing) and " (!)" or ""
if im.BeginCombo("From:##fromSegment", segment:getFrom().name) then
for i, node in ipairs(self.path.pathnodes.sorted) do
if im.Selectable1('#'..i .. " - " .. node.name, segment:getFrom().id == node.id) then
if im.BeginCombo("To:##fromSegment", segment:getTo().name) then
for i, node in ipairs(self.path.pathnodes.sorted) do
if im.Selectable1('#'..i .. " - " .. node.name, segment:getTo().id == node.id) then
im.BeginChild1("capsules", im.ImVec2(125 * im.uiscale[0], 0), im.WindowFlags_ChildWindow)
for i, cap in ipairs(segment.capsulePoints) do
if im.Selectable1("# " .. i, i == self.capsuleIndex) then
@/lua/ge/extensions/flowgraph/groupHelper.lua
local rect = {math.huge, math.huge, -math.huge, -math.huge} -- minX, minY, maxX, maxY
for _, node in ipairs(nodes) do
local nodeSize = ui_flowgraph_editor.GetNodeSize(node.id)
local r, center = self:getRectCenter(nodes)
for _, node in ipairs(nodes) do
local nodeSize = ui_flowgraph_editor.GetNodeSize(node.id)
-- move all middleLinks and all selectedNodes to the new graph
for _, id in ipairs(selectedNodes) do
local nd = oldGraph.nodes[id]
end
for _, lnk in ipairs(middleLinks) do
oldGraph.links[lnk.id] = nil
local inPin, outPin = groupNode.pinInLocal.flow, groupNode.pinOut.success
for _, lnk in ipairs(inLinks) do
if not pinHasBeenLinked[lnk.targetPin.id] then
end
for _, lnk in ipairs(outLinks) do
if not pinHasBeenLinked[lnk.sourcePin.id] then
local selectedNodesNodes = {}
for _, id in ipairs(selectedNodes) do
table.insert(selectedNodesNodes, groupGraph.nodes[id])
-- move all innerNodes and middleLinks to the current graph
for _, id in ipairs(innerNodes) do
local nd = groupedGraph.nodes[id]
end
for _, lnk in ipairs(middleLinks) do
groupedGraph.links[lnk.id] = nil
-- make a link for every source of gInLinks to every target of inLinks
for _, gi in ipairs(gInLinks) do
for _, i in ipairs(inLinks) do
for _, gi in ipairs(gInLinks) do
for _, i in ipairs(inLinks) do
newGraph:createLink(gi.sourcePin, i.targetPin)
-- make a link for every target of gOutLinks to every source of outLinks, depending on the setting of the stateExit node they reach
for _, o in ipairs(outLinks) do
local oLabel = o.targetNode.transitionName
local oLabel = o.targetNode.transitionName
for _, go in ipairs(gOutLinks) do
local goLabel = go.sourcePin.name
-- remove all gIn and gOut links
for _, lnk in ipairs(gInLinks) do newGraph:deleteLink(lnk) end
for _, lnk in ipairs(gOutLinks) do newGraph:deleteLink(lnk) end
for _, lnk in ipairs(gInLinks) do newGraph:deleteLink(lnk) end
for _, lnk in ipairs(gOutLinks) do newGraph:deleteLink(lnk) end
local innerNodesNodes = {}
for _, id in ipairs(innerNodes) do
table.insert(innerNodesNodes, newGraph.nodes[id])
@/lua/ge/extensions/util/resaveMaterials.lua
--log('E', '', '# objects existing: ' .. tostring(#scenetree.getAllObjects()))
for _, objName in ipairs(objs) do
local o = scenetree.findObject(objName)
local files = FS:findFiles('/', 'materials.cs\tmanaged*Data.csNOP', -1, true, false)
for _, fn in ipairs(files) do
local dir, basefilename, ext = path.splitWithoutExt(fn)
for _, obj in ipairs(objects) do
-- the old material files can also contain other stuff ...
for _, obj in ipairs(objects) do
obj:delete()
@/lua/ge/extensions/career/modules/spawnPoints.lua
if levelData and levelData.spawnPoints then
for _, spawnPointData in ipairs(levelData.spawnPoints) do
if spawnPointData.objectname == spawnPointName then
levelInfo = nil
for _, info in ipairs(core_levels.getList()) do
if string.lower(info.levelName) == string.lower(currentLevel) then
@/lua/ge/extensions/editor/raceEditor/pathnodes.lua
im.BeginChild1("keynodes", im.ImVec2(125 * im.uiscale[0], 0 ), im.WindowFlags_ChildWindow)
for i, node in ipairs(self.path.pathnodes.sorted) do
local name = node.name
local transforms = node:getSideTransforms(self.raceEditor.getToolsWindow():getSideTransformParameters())
for _, e in ipairs(transforms) do
if e then
local remove
for i, name in ipairs(fields.names) do
if fields.types[name] == 'string' then
end
for i, sp in ipairs(self.path.startPositions.sorted) do
if im.Selectable1('#'..i .. " - " .. sp.name, node[fieldName] == sp.id) then
@/lua/vehicle/extensions/dynamicVehicleData.lua
local powerCurve = {}
for _, td in ipairs(torqueData) do
local engineCurves = td.curves[td.finalCurveName]
local actualDiffs = {} --diffs minus the duallies
for _, diff in ipairs(diffs) do
if diff.mode == "dually" then
@/lua/ge/extensions/editor/rallyEditor/missionSettings.lua
for _,thepath in ipairs(self.rallyEditor.listNotebooks()) do
local _, basename, _ = path.split(thepath)
local codrivers = {}
for _,codriver in ipairs(notebook.codrivers.sorted) do
table.insert(codrivers, codriver.name)
if im.BeginCombo(name..'##filename', self.settings.notebook.filename or '') then
for _, notebookData in ipairs(self.missionSettingsFormData.notebooks) do
local notebookBasename = notebookData.basename
if im.BeginCombo(name..'##codriver', (self.settings.notebook.codriver) or '') then
for _, codriver in ipairs(self.codrivers or {}) do
local current = self.settings.notebook.codriver == codriver
for _, style_name in ipairs(self.recce_settings:cornerCallStyleNames()) do
local current = self.recce_settings:getCornerCallStyleName() == style_name
@/lua/ge/extensions/statistics/statistics.lua
for _, fieldName in ipairs(ignoreInstanceFields) do
if statData[fieldName] ~= nil then
if #altitudeProperties > 0 then
for i,entry in ipairs(altitudeProperties) do
-- dump(entry)
if #damageProperties > 0 then
for i,entry in ipairs(damageProperties) do
-- log('D',logTag, 'damage count: ' .. i)
if #distanceProperties > 0 then
for i,entry in ipairs(distanceProperties) do
-- dump(entry)
if #speedProperties > 0 then
for i,entry in ipairs(speedProperties) do
-- dump(entry)
if #timeProperties > 0 then
for i,entry in ipairs(timeProperties) do
if entry.target == vehicleName then
@/lua/ge/extensions/editor/flowgraph/references.lua
if nodeData.node.pinSchema then
for _, pin in ipairs(nodeData.node.pinSchema) do
if pin.dir == "in" then
function C:fillNodeTable(flowgraphDirectory)
for _, filename in ipairs(flowgraphDirectory) do
local data = jsonReadFile(filename)
local alreadyExist = false
for _, n in ipairs(res) do
if self.nodeTable[n.nodeName].displayName == node.name then
if direction == 'in' then
for _, pin in ipairs(self.nodeTable[nodeName].pins.inPins) do
if pin.name == pinName then
else
for _, pin in ipairs(self.nodeTable[nodeName].pins.outPins) do
if pin.name == pinName then
if im.BeginCombo("##paths", self.filterMode) then
for _, modeData in ipairs(filterModes) do
if im.Selectable1(modeData.mode) then
local rowCount = 1
for _, p in ipairs(self.sortedProjects) do
@/lua/ge/extensions/gameplay/rawPois.lua
extensions.hook("onGetRawPoiListForLevel",levelIdentifier, elementsUnchecked)
for _, e in ipairs(elementsUnchecked) do
-- sanity check
@/lua/ge/extensions/core/vehicleTriggers.lua
local inputDevices = WinInput.getRegisteredDevices()
for _, d in ipairs(inputDevices) do
if d ~= 'mouse0' and d ~= 'keyboard0' then
local function findKeyboardBindingForAction(actionStr, desiredInverted)
for _, device in ipairs(core_input_bindings.bindings or {}) do
local contents = device.contents or {}
if contents.devicetype == "keyboard" then
for _, b in ipairs(contents.bindings or {}) do
if b.action == actionStr and ((b.isInverted or false) == (desiredInverted or false)) then
@/lua/ge/extensions/editor/missionEditor/playbookUtils.lua
local instruction = {type = "missionAttempt", missionId = self.mission.id, stars = {}}
for _, key in ipairs(self.missionInstance.careerSetup._activeStarCache.sortedStars) do
instruction.stars[key] = true
local instruction = {type = "missionAttempt", missionId = self.mission.id, stars = {}}
for _, key in ipairs(self.missionInstance.careerSetup._activeStarCache.defaultStarKeysSorted) do
instruction.stars[key] = true
local instruction = {type = "missionAttempt", missionId = self.mission.id, stars = {}}
for _, key in ipairs(self.missionInstance.careerSetup._activeStarCache.bonusStarKeysSorted) do
instruction.stars[key] = true
local instruction = {type = "missionAttempt", missionId = self.mission.id, stars = {}}
for _, key in ipairs(self.missionInstance.careerSetup._activeStarCache.sortedStars) do
instruction.stars[key] = math.random() > 0.5
local stars = {}
for _, key in ipairs(self.missionInstance.careerSetup._activeStarCache.sortedStars) do
stars[key] = true
local stars = {}
for _, key in ipairs(self.missionInstance.careerSetup._activeStarCache.defaultStarKeysSorted) do
stars[key] = true
arrayShuffle(keys)
for _, key in ipairs(keys) do
local instruction = {type = "missionAttempt", missionId = self.mission.id, stars = {[''..key] = true}}
@/lua/ge/extensions/gameplay/rally/transcripts/entry.lua
local style_data = nil
for _,style in ipairs(corner_angles_data.pacenoteStyles) do
if style.name == cornerAnglesStyle then
-- for i, color in ipairs(gradientColors) do
-- print("Step " .. i .. ": RGB(" .. color.r .. ", " .. color.g .. ", " .. color.b .. ")")
sortedAngles = {}
for i,angle in ipairs(style_data.angles) do
table.insert(sortedAngles, angle)
local gradientColors = createGradient(steps)
for i,angle in ipairs(sortedAngles) do
angle.color = gradientColors[i]
for _,cap in ipairs(capture_data.captures) do
local captures = subgroups[#subgroups].captures
for _,grp in ipairs(subgroups) do
local label_i = round(#grp.captures / 2)
-- calc the corner call for each grp>cap
-- for _,grp in ipairs(subgroups) do
-- for _,cap in ipairs(grp.captures) do
-- for _,grp in ipairs(subgroups) do
-- for _,cap in ipairs(grp.captures) do
-- -- for _,angle in ipairs(self.sortedAngles) do
-- for _,cap in ipairs(grp.captures) do
-- -- for _,angle in ipairs(self.sortedAngles) do
-- cap.cornerCall_calc = rallyUtil.determineCornerCall(self.sortedAngles, cap.steering)
-- log('D', 'wtf', '===')
-- for _,grp in ipairs(subgroups) do
-- for i,cap in ipairs(grp.captures) do
-- for _,grp in ipairs(subgroups) do
-- for i,cap in ipairs(grp.captures) do
-- if i == grp.label_point then
-- Draw the wheels
for _, wheelPos in ipairs(wheelPositions) do
local worldWheelPos = toWorldPosition(wheelPos[2])
for i_grp,grp in ipairs(groups) do
for _,cap in ipairs(grp.captures) do
for i_grp,grp in ipairs(groups) do
for _,cap in ipairs(grp.captures) do
clr = cap.calc.angle_data.color
-- for _,capture in ipairs(captures) do
-- {
for i,cap in ipairs(captures) do
local marker = {
-- extract all its markers
for i, markerData in ipairs(pathJsonObj.markers) do
local marker = {
@/lua/common/libs/luamqtt/mqtt/ioloop.lua
-- search an index of client to remove
for i, item in ipairs(clients) do
if item == client then
self.timeouted = false
for _, client in ipairs(self.clients) do
if type(client) ~= "function" then
@/lua/ge/extensions/editor/raceEditor/testing.lua
if enableAi then
for _, id in ipairs(vehIds) do
self.race:startAiVehicle(id, 0.8)
for i, sp in ipairs(self.path.startPositions.sorted) do
if im.SmallButton("Move to " .. sp.name) then
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
if im.Button("Stop") then
for _, id in ipairs(self.race.vehIds) do
self.race:abortRace(id)
@/lua/ge/extensions/core/repository.lua
data.missingList = {}
for k,v in ipairs(updateQueue) do
if v.state == "done" then
@/lua/ge/extensions/flowgraph/nodes/types/color.lua
if im.BeginCombo("##cameraToMode" .. self.id, self.mode) then
for _, m in ipairs(self.modes) do
if im.Selectable1(m, m == self.mode) then
@/lua/ge/extensions/util/rectangleGen.lua
local rectangles = {}
for _,r in ipairs(params.startingRects) do
if not r.noSplit then
for _,r in ipairs(params.startingRects) do
if r.noSplit then
-- get neighbours
for _,rect in ipairs(rectangles) do
for i,other in ipairs(rectangles) do
if other ~= rect then
-- set center points and fill nodes from graph.
for i,r in ipairs(rectangles) do
for i,r in ipairs(rectangles) do
for _,n in ipairs(r.neighbours) do
for i,r in ipairs(rectangles) do
for _,n in ipairs(r.neighbours) do
graph.nodes[i].neighbours[#graph.nodes[i].neighbours+1]= {index = n.index, dist = n.dist }
-- determine closest neighbours and add to graph nodes.
for i,r in ipairs(rectangles) do
r.closestNeighbourDist = 1000000
r.closestNeighbourDist = 1000000
for _,n in ipairs(r.neighbours) do
if n.dist < r.closestNeighbourDist then
@/lua/ge/extensions/editor/sensorConfigurationEditor.lua
if not config then return nil end
for i, preview in ipairs(config.openPreviews) do
if preview.vehicleIdx == vehicleIdx and preview.sensorIdx == sensorIdx then
for _, config in pairs(previewConfigs) do
for _, preview in ipairs(config.openPreviews) do
editor.hideWindow(preview.winName)
@/lua/ge/extensions/freeroam/freeroamConfigurator.lua
local generatorFiles = FS:findFiles('lua/ge/extensions/freeroam/configuratorOptions/', '*.lua', 1, true, false)
for _, filePath in ipairs(generatorFiles) do
-- Get relative path from configuratorOptions folder and convert to extension name format
if level then
for _, file in ipairs(level.previews) do
table.insert(validationFiles, file)
-- Update option values with current configuration
for _, group in ipairs(options) do
if group.key then
if group.options then
for _, option in ipairs(group.options) do
if option.key then
end
for _, file in ipairs(validationFiles) do
-- check if file is a directory or a file
@/lua/ge/extensions/scenario/raceMarkers/attention.lua
function C:clearMarkers()
for _, id in ipairs(self._ids or {}) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/flowgraph/nodes/scene/camera/setCameraPosition.lua
if im.BeginCombo("##cameraToMode" .. self.id, self.mode) then
for _, m in ipairs(self.modes) do
if im.Selectable1(m, m == self.mode) then
@/gameplay/missionTypes/dragStripRace/constructor.lua
local starInfo, message = {}, nil
for _, key in ipairs(starKeys) do
local info = {
if not isDisqualified then
for _, medal in ipairs({'Bronze','Silver','Gold'}) do
unlockedStars['time'..medal] = time <= self.fgVariables['time'..medal] and position == 1
@/lua/ge/extensions/editor/gen/utils.lua
local astar = {}
for _,ie in ipairs(v4e[n2]) do
if dbg then U.dump(e4v[ie], '??***** for_edge:'..ie) end
if dbg then U.dump(e4v[ie], '??***** for_edge:'..ie) end
for i,n in ipairs(e4v[ie]) do
if n.ind == n2 then
--[[
for _,i in ipairs(e4v[ie]) do
if i.ind == iv then
lo('?? for_edge:'..i)
for k,n in ipairs(list) do
if n.done == 0 then
local adir = {} -- set of directions from vertex
for j,e in ipairs(v4e[iv]) do
local vlist = e4v[e]
break
-- for j,av in ipairs(vlist) do
-- U.dump(,'?? for_vlist:')
--[[
for i,l in ipairs(av) do
if l.ind == k then
--- build star
for _,ie in ipairs(v4e[inext]) do
U.dump(e4v[ie], '?? for_edge:'..ie)
@/lua/ge/extensions/freeroam/facilities/fuelPrice.lua
for i=1, #v2.displayObjects do
for _,objName in ipairs(v2.displayObjects[i]) do
_set7CharDisplay(objName, "-")
end
for _,objName in ipairs(v2.displayObjects[i]) do
_set7CharDisplay(objName, char)
for i=1, #v2.displayObjects do
for _,objName in ipairs(v2.displayObjects[i]) do
local obj = scenetree.findObject(objName)
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
elem.valueChangedCallback = function(e)
for _, element in ipairs(hideElementList) do
element.hidden = not e.ptr[0]
-- move hideElement list to after the elem
for _, e in ipairs(hideElementList) do
local idx = arrayFindValueIndex(self.elements, e)
local fileTags = {}
for _, e in ipairs(allowedExtensions or {}) do
local dir, fn, ext = path.split(e[2], true)
end
for _, file in ipairs(filepathsInMissionfolder) do
local dir, fn, ext = path.split(file, true)
-- gather all default fields for all self:elements
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
ret[val.fieldName] = val.value
self.mission = m
for _, element in ipairs(self.elements) do
(setMissionFuntions[element.type] or nop)(element, m.missionTypeData)
local foundFile = nil
for _, file in ipairs(e.filepathsInMissionfolder) do
if FS:fileExists(m.missionFolder .. file) then
local fieldsChecked = {}
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
for _, element in ipairs(self.elements) do
for _, val in ipairs((newDataFunctions[element.type] or nop)(element) or {}) do
if mtd[val.fieldName] == nil and val.value ~= nil then
if checkMissionFunctions[element.type] then
for _, i in ipairs(checkMissionFunctions[element.type](element, mtd, m) or {}) do
table.insert(issues, i)
for _, field in ipairs(tableKeysSorted(mtd)) do
if not fieldsChecked[field] then
local fixed = false
for _, val in ipairs(issues) do
if val.fixable then
if im.BeginCombo('##dropdown'..e.fieldName, "") then
for _, v in ipairs(e.displayOptions.dropdownValues) do
if im.Selectable1(v, v == mtd[e.fieldName]) then
if e.foundFile == nil then
for _, file in ipairs(e.filepathsInMissionfolder) do
if FS:fileExists(mission.missionFolder .. file) then
if not (editor_camPathEditor and editor_camPathEditor.currentPath) then im.BeginDisabled() end
for _, fl in ipairs(e.filepathsInMissionfolder) do
if im.Selectable1("Save current campath from editor to " .. fl) then
if im.BeginCombo('##'..e.fieldName, mtd[e.fieldName] or "(None!)") then
for _, v in ipairs(e.values) do
if im.Selectable1(v, v == mtd[e.fieldName]) then
for _, e in ipairs(self.elements) do
if e.clickable then
for _, e in ipairs(transformsToCheck) do
function C:editingAnyTransform()
for _, e in ipairs(self.elements) do
if e.transform and e.transform:correctEditMode() then
editEnded = im.BoolPtr(false)
for index, element in ipairs(self.elements) do
local show = not filterOptions
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
end
for _, field in ipairs(ret) do
field.type = ui_flowgraph_editor.getAutoTypeFromName(field.label)
local fieldNamesWithType = {}
for _, elem in ipairs(self.elements) do
for _, fnElem in ipairs((customFieldNameTypeFunctions[elem.type] or genericFieldNameTypeGetter)(elem) or {}) do
for _, elem in ipairs(self.elements) do
for _, fnElem in ipairs((customFieldNameTypeFunctions[elem.type] or genericFieldNameTypeGetter)(elem) or {}) do
table.insert(fieldNamesWithType, fnElem)
@/lua/ge/extensions/editor/driftDataEditor.lua
local s = ""
for _, n in ipairs(stuntZonePreset.presets) do
s = s .. tostring(n) .. "\0"
-- "cast" scl, pos and rot to vec/quat
for _, elem in ipairs(json.stuntZones or {}) do
if elem.pos and type(elem.pos) == "table" and elem.pos.x and elem.pos.y and elem.pos.z then elem.pos = vec3(elem.pos) end
im.Text("Drift Stunt Zones:")
for i, elem in ipairs(driftData.stuntZones) do
if im.Selectable1(string.format("%d - %s", i, elem.type), i == selectedStuntZoneIndex) then
-- then debug drawing
for i, elem in ipairs(driftData.stuntZones) do
if elem.type == "donut" then
-- List existing marker objects
for i, markerObj in ipairs(lineData.markerObjects) do
local imVal = im.ArrayChar(2048, markerObj)
for _, objective in ipairs(info.objectives or {}) do
im.PushID1(objective.id)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
@/lua/vehicle/powertrain/hydraulicPump.lua
for _, consumer in ipairs(device.connectedConsumers) do
local consumerFlow, tankFlow = consumer:update(device.accumulatorPressure, dt)
local function updateGFX(device, dt)
for _, consumer in ipairs(device.connectedConsumers) do
consumer:updateGFX(device.accumulatorPressure, dt)
for _, consumer in ipairs(device.connectedConsumers) do
consumer:updateSounds(dt)
for _, consumer in ipairs(device.connectedConsumers) do
if consumer.initSounds then
for _, consumer in ipairs(device.connectedConsumers) do
if consumer.resetSounds then
for _, consumer in ipairs(device.connectedConsumers) do
consumer:reset(device.consumerJbeamData[consumer.name])
@/lua/ge/extensions/flowgraph/nodes/vehicle/special/vehicleAction.lua
if self.model and modelA then
for i, name in ipairs(modelA.sorted) do
local action = modelA.actions[name]
end
for i, name in ipairs(allA.sorted) do
local action = allA.actions[name]
@/lua/ge/extensions/scenario/scenariosLoader.lua
local ext
for _, prefabPath in ipairs(foundFiles) do
if string.endswith(prefabPath, ".json") then
prefabsToFind[string.lower(scenarioData.scenarioName)] = true
for _, prefabPath in ipairs(scenarioData.prefabs) do
if not string.find(prefabPath,".prefab") then -- checking if this is a short name entry in the table. Checking for ".prefab" also cover ".prefab.json"
local otherScenarios = {}
for i,v in ipairs(matchedScenarios) do
local otherScenarioName = string.gsub(v, "(.*/)(.*)%.json", "%2")
local foundClash = false
for i,otherScenarioName in ipairs(otherScenarios) do
if imageFilename == otherScenarioName then
scenarioData.lapConfig = {}
for i, v in ipairs(scenarioData.BranchLapConfig) do
if type(v) == 'string' then
local paths = {}
for _, path in ipairs(levelPaths) do
if subdirectory ~= nil then
-- find all normal scenarios.
for _, path in ipairs(paths) do
local subfiles = FS:findFiles(path, '*.json', -1, true, false)
local subfiles = FS:findFiles(path, '*.json', -1, true, false)
for _, scenarioFilename in ipairs(subfiles) do
local newScenario = loadScenario(scenarioFilename)
-- find all Scenario-enabled flowgraphs.
for _, p in ipairs(paths) do
local fgFiles = FS:findFiles(p, '*.flow.json', -1, true, false)
local fgFiles = FS:findFiles(p, '*.flow.json', -1, true, false)
for _, fgPath in ipairs(fgFiles) do
local fgData = jsonReadFile(fgPath)
if not skipMissions then
for _, m in ipairs(gameplay_missions_missions.get()) do
if m.startTrigger.level and core_levels.getLevelByName(m.startTrigger.level) and m.isAvailableAsScenario then
local list = getList()
for _, v in ipairs(list) do
if v.name == name then
for _, levelName in ipairs(levelList) do
local path = '/levels/' .. levelName .. '/scenarios/' .. subdirectory
local busScenarios = {}
for i,filepath in ipairs(foundFiles) do
local ext = string.match(filepath, "(%.%w+)")
@/lua/ge/extensions/editor/rallyEditor/pacenotes/structuredForm.lua
table.insert(corners, { "-", -1 })
for i, cornerCall in ipairs(mapping.cornerSeverity) do
table.insert(corners, { cornerCall.name, cornerCall.value })
for i, cornerLen in ipairs(mapping.cornerLength) do
table.insert(lengths, { cornerLen.name or '-', cornerLen.value })
for i, cornerRad in ipairs(mapping.cornerRadiusChange) do
table.insert(changes, { cornerRad.name or '-', cornerRad.value })
local reverseMapping = {}
for _, entry in ipairs(mapping) do
reverseMapping[entry[2]] = entry[1]
for i,fname in ipairs(fnames) do
if FS:fileExists(fname) then
if im.BeginCombo('##structuredCorner', currSev, im.ComboFlags_HeightLarge) then
for i, cornerCall in ipairs(cornerSeveritiesForDropdown) do
local name, severity = cornerCall[1], cornerCall[2]
if im.BeginCombo('##structuredCornerLength', currLength) then
for i, cornerLength in ipairs(cornerLengthsForDropdown) do
local name, value = cornerLength[1], cornerLength[2]
if im.BeginCombo('##structuredCornerRadiusChange', currRadiusChange) then
for i, cornerRadiusChange in ipairs(cornerRadiusChangesForDropdown) do
local name, value = cornerRadiusChange[1], cornerRadiusChange[2]
if im.BeginCombo('##structuredCaution', currCaution) then
for i, caution in ipairs(cautionForDropdown) do
local name, value = caution[1], caution[2]
@/lua/vehicle/extensions/gameplayStatistic.lua
local function removeSchedule(fn)
for i in ipairs(statSchedule) do
if statSchedule[i] == fn then
@/lua/ge/extensions/flowgraph/nodes/scene/storeStatics.lua
local sortedObjectIds = {}
for _, v in ipairs(editor.selection.object or {}) do
if scenetree[v] and scenetree[v].className == 'TSStatic' then
local ids = {}
for _, o in ipairs(self.storedObjects) do
if o.currentId and o.currentId ~= -1 then
local remove = nil
for i, e in ipairs(self.storedObjects) do
if hoverStore then
local newObjects = {}
for _, id in ipairs(ids) do
local obj = scenetree[id]
end
for _, id in ipairs(ids) do
local obj = scenetree[id]
local idx = nil
for i,o in ipairs(self.objects) do
if o:getId() == obj:getId() then
function C:_executionStarted()
for _, o in ipairs(self.storedObjects) do
if o.currentId and scenetree and scenetree[o.currentId] then
for _, obj in ipairs(self.objects) do
if obj then
table.clear(self.objects)
for _, v in ipairs(self.storedObjects) do
v.currentId = nil
--dump("Preparuing to spawn.")
for _, o in ipairs(self.storedObjects) do
o.currentId = self:createObject(o.pos, o.rot, o.scl, o.shapeName)
self.storedObjects = nodeData.storedObjects or {}
for _, v in ipairs(self.storedObjects) do
v.currentId = nil
@/lua/ge/extensions/editor/missionEditor/genericTypeData.lua
table.sort(self.missionTypes)
for _, missionType in ipairs(self.missionTypes) do
self.missionTypeEditors[missionType] = gameplay_missions_missions.getMissionEditorForType(missionType)
local fieldNameUsed = {}
for idx, elem in ipairs(self._vars) do
fieldNameUsed[elem.fieldName] = true
end
for _, varName in ipairs(mgr.variables.sortedVariableNames) do
if not fieldNameUsed[varName] then
if im.Button("Add all "..#self._sortedVars.missing.." missing Variables", im.ImVec2(-1,0)) then
for _, elem in ipairs(self._sortedVars.missing) do
mgr.variables:addVariable(elem.fieldName, fg_utils.getDefaultValueForType(elem.type), elem.type)
if im.Button("Fix all "..#self._sortedVars.mismatch.." type-mismatched Variables", im.ImVec2(-1,0)) then
for _, elem in ipairs(self._sortedVars.mismatch) do
mgr.variables:updateType(elem.fieldName, elem.type)
im.SetColumnWidth(0,50)
for i, elem in ipairs(self._sortedVars.missing) do
if im.Button("Add##"..elem.fieldName.."--"..i) then
im.SetColumnWidth(0,50)
for i, elem in ipairs(self._sortedVars.mismatch) do
if im.Button("Fix##"..elem.fieldName.."--"..i) then
--im.SetColumnWidth(0,50)
for i, elem in ipairs(self._sortedVars.found) do
im.Text(elem.elemLabel)
--im.SetColumnWidth(0,50)
for i, elem in ipairs(self._sortedVars.other) do
mgr:DrawTypeIcon(elem.type, false, 1, 20/scale)
if im.BeginCombo('Mission Type##MissionType',self.mission.missionType or "None!") then
for _, mType in ipairs(self.missionTypes) do
if im.Selectable1(mType, mType == self.mission.missionType) then
for _, mType in ipairs(self.missionTypes) do
if self.missionTypeEditors[mType] and self.missionTypeEditors[mType].toolsFunctions then
function C:drawViewsMenu()
for _, mType in ipairs(self.missionTypes) do
if self.missionTypeEditors[mType] and self.missionTypeEditors[mType].viewFunctions then
function C:drawViews()
for _, mType in ipairs(self.missionTypes) do
if self.missionTypeEditors[mType] and self.missionTypeEditors[mType].drawViews then
local issues = {}
for _, i in ipairs(gameplay_missions_missions.getMissionEditorForType(m.missionType):checkContainer(m)) do
table.insert(issues, i)
if success then
for _, i in ipairs(customIssues) do
table.insert(issues, i)
@/lua/ge/extensions/editor/assemblySpline/molecule.lua
local assemblyKit, ctr = {}, 1
for _, path in ipairs(meshPaths) do
assemblyKit[ctr] = {
local attachData, joinGroups = {}, {}
for _, anchorName in ipairs(anchorNames) do
if anchorName:sub(1, 5) == anchorPrefixStrWithDot then
-- Process each bridge, in turn.
for i, bridge in ipairs(molecule.bridges) do
local bridgeAttachData = molecule.bridgeAttachments[i]
local baseToVariations = {}
for _, mesh in ipairs(assemblyKit) do
if mesh.fileName:lower():find(variationFilenameStr) then
local baseMeshes = {}
for _, mesh in ipairs(assemblyKit) do
if not mesh.fileName:lower():find(variationFilenameStr) then
local rigids, bridges = {}, {}
for _, mesh in ipairs(baseMeshes) do
local entry = {
-- Copy variations with new unique ids for this bridge instance.
for _, variation in ipairs(bridge.variations) do
local newVariation = deepcopy(variation)
local rootIdx = nil
for i, m in ipairs(rigids) do
if m.mesh.fileName:lower():find(rootFilenameStr) then
if spline then
for _, rigid in ipairs(rigids) do
if spline.rigidEnabledStates == nil or spline.rigidEnabledStates[rigid.mesh.id] == nil then
end
for _, variation in ipairs(rigid.variations) do
if spline.rigidEnabledStates == nil or spline.rigidEnabledStates[variation.id] == nil then
end
for _, bridge in ipairs(expandedBridges) do
if spline.bridgeEnabledStates == nil or spline.bridgeEnabledStates[bridge.mesh.id] == nil then
end
for _, variation in ipairs(bridge.variations) do
if spline.bridgeEnabledStates == nil or spline.bridgeEnabledStates[variation.id] == nil then
if spline then
for _, rigid in ipairs(rigids) do
local enabledVariations = {}
local enabledVariations = {}
for _, variation in ipairs(rigid.variations) do
if getRigidEnabled(spline, variation.id) then
end
for _, bridge in ipairs(expandedBridges) do
local enabledVariations = {}
local enabledVariations = {}
for _, variation in ipairs(bridge.variations) do
if getBridgeEnabled(spline, variation.id) then
local isSagEnabled = false
for _, bridge in ipairs(expandedBridges) do
if bridge.isSag then
if molecule.rigids and spline.rigidEnabledStates then
for _, rigid in ipairs(molecule.rigids) do
if spline.rigidEnabledStates[rigid.mesh.id] ~= nil then
end
for _, variation in ipairs(rigid.variations) do
if spline.rigidEnabledStates[variation.id] ~= nil then
if molecule.bridges and spline.bridgeEnabledStates then
for _, bridge in ipairs(molecule.bridges) do
if spline.bridgeEnabledStates[bridge.mesh.id] ~= nil then
end
for _, variation in ipairs(bridge.variations) do
if spline.bridgeEnabledStates[variation.id] ~= nil then
@/lua/ge/extensions/ui/apps/minimap/additionalInfo.lua
else
for _, lvl in ipairs(core_levels.getList()) do
if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/lua/ge/extensions/flowgraph/nodes/types/setVariable.lua
if im.BeginCombo("##selectVar".. self.id, current) then
for _, name in ipairs(names) do
if im.Selectable1(name, name==current) then
self.varName = name
for _,lnk in ipairs(links) do
if self.graph:pinsCompatible(lnk.sourcePin, self.pinInLocal[self.varName]) then
for _,lnk in ipairs(links) do
if self.graph:pinsCompatible(lnk.sourcePin, self.pinInLocal[self.varName]) then
@/lua/ge/extensions/ui/liveryEditor/tools/group.lua
local parentUid
for k, layerUid in ipairs(selectedLayerUids) do
local uiLayer = uiLayersApi.getLayerByUid(layerUid)
local newOrder = 1
for k, layerUid in ipairs(selectedLayerUids) do
local uiLayer = uiLayersApi.getLayerByUid(layerUid)
for k, childLayer in ipairs(uiLayer.children) do
table.insert(childLayerUids, childLayer.uid)
local layerIndex = uiLayer.order
for k, layerUid in ipairs(childLayerUids) do
local layer = uiLayersApi.getLayerByUid(layerUid)
@/lua/ge/extensions/scenario/raceMarkers/ringMarker.lua
function C:clearMarkers()
for _, id in ipairs(self._ids or {}) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/flowgraph/states.lua
-- find all hooks of all nodes in hooks.
for _, node in ipairs(hooks) do
for k, func in pairs(node) do
for _, child in ipairs(graph:getChildren()) do self:gatherNodesAndLinksRecursion(child, nodes, links, group, deepcopy(currentDepth)) end
end
local regular, shorten, sourced = {},{},{}
for _, lnk in ipairs(links) do
if lnk.doShorten then
local virtualLinks = {}
for _, lnk in ipairs(sourced) do
--dump("current from sourced: " .. lnk.simple)
local successors = {}
for _, current in ipairs(open) do
--dump("current from open: " .. current.simple)
local newUnvisited = {}
for _, unv in ipairs(unvisited) do
local insert = false
for _, sel in ipairs(selected) do
--dump("Found sel! " .. sel.simple)
-- now we have filled the targets list. add one virtual links for each target.
for _, tgt in ipairs(targets) do
local vlnk = {
for _, lnk in ipairs(links) do
local pName = lnk.link.sourcePin.name
end
for _, root in ipairs(rootNodes) do
for name, port in pairs(root.ports or {}) do
for name, port in pairs(root.ports or {}) do
for _, targetId in ipairs(port.targets) do
validNodes[targetId].startingState = true
-- find out all states that need to be turned on/off over all transitions.
for _, t in ipairs(self.queuedTransitions) do
log("D","",string.format("Resolving %d -> %s", t.sourceStateId or -1, t.transitionName or ""))
if #port.targets == 0 then log("W","","Empty Port for transition: " .. dumpsz(t,3)) end
for _, targetId in ipairs(port.targets) do
--tData.link:doFlow()
log("D","","Exiting groupstate. Stopping these states: " .. dumps(ids) .. " because of stopdepth: " .. dumps(port.stopDepth))
for _, id in ipairs(ids) do
if not offStates[id] then
table.sort(onSorted)
for _, id in ipairs(offSorted) do
self:stopState(id)
end
for _, id in ipairs(onSorted) do
if onStates[id] then
@/lua/ge/extensions/render/openxr.lua
local changed = forced
for _,triggerField in ipairs(fieldsTriggeringGuiHook) do
if M.state[triggerField] ~= lastKnownUIState[triggerField] then
@/lua/vehicle/controller/pneumatics/actuators.lua
g.averagePressure = 0
for _, b in ipairs(g.beams) do
g.averagePressure = g.averagePressure + b.currentPressure
local count = 0
for _, name in ipairs(groupNames) do
sum = sum + getAverageFlowRate(name)
@/lua/ge/extensions/flowgraph/nodes/util/routePointToPoint.lua
local mapNodes = map.getMap().nodes
for _, v in ipairs({'posA', 'posB'}) do
pos:setFromTable(self.pinIn[v].value)
@/lua/ge/extensions/ui/vehicleSelector/tileGrouping.lua
if rangeGroups then
for _, group in ipairs(rangeGroups) do
table.insert(groupsForConfig, group)
@/lua/common/libs/lustach/src/lustache/renderer.lua
local token, section
for i, token in ipairs(tokens) do
local t = token.type
for i,token in ipairs(tokens) do
if token.type == "#" or token.type == "^" then
local txtStartIndex, txtEndIndex
for _, v in ipairs(tokens) do
if v.type == "text" then
for i,v in ipairs(value) do
buffer = buffer .. callback(context:push(v), self)
@/lua/ge/extensions/editor/flowgraph/variables.lua
if im.BeginCombo("##variableTarget","Add to: "..self.targets[self.addVariableSettings.target].name) then
for i, t in ipairs(self.targets) do
if im.Selectable1("Add to: " ..t.name, i == self.addVariableSettings.target ) then
im.Separator()
for _,typename in ipairs(ui_flowgraph_editor.getSimpleTypes()) do
self.mgr:DrawTypeIcon(typename, false, 1, 20/scale)
local insertPositions = {}
for i, nm in ipairs(target.customVariableOrder) do
if self.dragPayload then
local mousePos = im.GetMousePos()
for i, y in ipairs(insertPositions) do
if math.abs(mousePos.y - y) < dragReleaseVerticalDistance and mousePos.x > mouseXMin and mousePos.x < mouseXMax then
table.sort(ret, function(a,b) return a.id < b.id end)
for _, gr in ipairs(ret) do
self:drawRecursive(gr)
table.sort(ret)
for _, id in ipairs(ret) do
self:drawRecursive(source[id])
@/lua/vehicle/controller.lua
local ranks = {}
for k, v in ipairs(powertrain.getOrderedDevices()) do
ranks[v.name] = k * 100
local ranks = {}
for k, v in ipairs(powertrain.getOrderedDevices()) do
ranks[v.name] = k * 100
local ranks = {}
for k, v in ipairs(powertrain.getOrderedDevices()) do
ranks[v.name] = k * 100
for _, controller in ipairs(sortedControllers) do
cacheControllerFunctions(controller)
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.updateFixedStep ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.update ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.updateGFX ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.updateWheelsIntermediate ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.beamBroke ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.beamDeformed ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.nodeCollision ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.onCouplerFound ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.onCouplerAttached ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.onCouplerDetached ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.onGameplayEvent ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.debugDraw ~= nil then
print(" --Controllers not in this list do not have a matching method to call")
for i, controller in ipairs(sortedControllers) do
if controller.settingsChanged ~= nil then
local data = {}
for _, controller in ipairs(sortedControllers) do
if controller.serialize then
for _, controller in ipairs(sortedControllers) do
if controller.setState then
local data = {}
for _, controller in ipairs(sortedControllers) do
if controller.getState then
@/lua/ge/extensions/flowgraph/nodes/logic/booleanExpression.lua
local currentTemplate = nil
for _, template in ipairs(self.templateExpressions) do
if template.expression == expr then
if im.BeginCombo("##templateExpressions", currentTemplate and currentTemplate.name or "Custom Expression") then
for _, template in ipairs(self.templateExpressions) do
if im.Selectable1(template.name, template.expression == expr) then
im.Text(currentTemplate.description)
for _, pin in ipairs(currentTemplate.pinInfo) do
self.mgr:DrawTypeIcon(pin.type, true, 1)
if self.data.safeMode then
for _, p in ipairs(self.activePinList or {}) do
if self.pinIn[p].value == nil then return end
@/lua/ge/extensions/campaign/photoSafari.lua
M.photoSafarimissions = tableKeys(M.photoSafariData)
for _,k in ipairs(M.photoSafarimissions) do
subLocationsHints[k]= M.photoSafariData[k].hints
@/lua/ge/extensions/editor/objectToSplineEditor.lua
for _, v in ipairs(points) do
if presetIds and presetIds[i] then
local function createObjectsUndo(data)
for _, id in ipairs(data.objectIds) do
editor.deleteObject(id)
local count = #savedPoints
for i, v in ipairs(savedPoints) do
local c = rainbowColor(count, i, 1)
@/lua/ge/extensions/gameplay/rally/notebook/structured/libCompositor.lua
for _,entry in ipairs(valuesList) do
local value = tonumber(entry.value)
local count = 0
for i, mod in ipairs(prioritizedModifiers) do
local modValue = fields[mod.modName]
for _,modPhrase in ipairs(modifierPhrases) do
phrase = postProcessPhrase(modPhrase, config.punctuation.phraseEnd)
-- Caution phrases
for _,rawDistanceBefore in ipairs(rawDistanceBeforeValues) do
for caution,cautionText in pairs(config.caution) do
-- Corner phrases
for _,rawDistanceBefore in ipairs(rawDistanceBeforeValues) do
for _,cornerSeverity in ipairs(config.cornerSeverity) do
for _,rawDistanceBefore in ipairs(rawDistanceBeforeValues) do
for _,cornerSeverity in ipairs(config.cornerSeverity) do
for cornerDirection,_ in pairs(config.cornerDirection) do
-- corner phrases with square
for _,rawDistanceBefore in ipairs(rawDistanceBeforeValues) do
-- for _,cornerSquare in ipairs({true, false}) do
for _,rawDistanceBefore in ipairs(rawDistanceBeforeValues) do
-- for _,cornerSquare in ipairs({true, false}) do
for cornerDirection,_ in pairs(config.cornerDirection) do
-- modifier phrases
for _,rawDistanceBefore in ipairs(rawDistanceBeforeValues) do
for modName,modData in pairs(config.modifiers) do
-- finish line
-- for _,phrase in ipairs(config.finishLine.variants) do
-- table.insert(enumeratedPhrases, phrase.text)
-- for _,sp in ipairs(sp) do
-- table.insert(enumeratedPhrases, sp.text)
local totalWeight = 0
for _, item in ipairs(items) do
totalWeight = totalWeight + (item.weight or 1)
local cumulativeWeight = 0
for _, item in ipairs(items) do
-- Calculate normalized weight
@/lua/vehicle/controller/drivingDynamics/actuators/adaptiveDampers.lua
for _, cid in ipairs(dampBeams) do
local beam = v.data.beams[cid]
@/lua/ge/extensions/editor/crawlEditor/presets.lua
if path.nodes then
for i, n in ipairs(path.nodes) do
table.insert(serializedData.nodes, {
}
for i, n in ipairs(data.nodes or {}) do
table.insert(path.nodes, {
}
for i, n in ipairs(data.path.nodes or {}) do
table.insert(p.nodes, {
else
for _, component in ipairs(trailComponents) do
if im.MenuItem1(component.name) then
else
for _, component in ipairs(boundaryComponents) do
if im.MenuItem1(component.name) then
else
for _, component in ipairs(pathnodeComponents) do
if im.MenuItem1(component.name) then
else
for _, component in ipairs(trailComponents) do
im.Text(component.name)
else
for _, component in ipairs(boundaryComponents) do
im.Text(component.name)
else
for _, component in ipairs(pathnodeComponents) do
im.Text(component.name)
@/lua/ge/extensions/gameplay/sites/zone.lua
local verts = {}
for i, v in ipairs(self.vertices) do
table.insert(verts,v.pos:toTable())
self.vertices = {}
for i, v in ipairs(data.vertices) do
table.insert(self.vertices,{pos = vec3(v)})
end
for i, v in ipairs(self.vertices) do
v.index = i
if self.top.active or self.bot.active then
for i, v in ipairs(self.vertices) do
-- expand AABB by planes.
local zMin, zMax = math.huge, -math.huge
for i, v in ipairs(self.vertices) do
zMin = math.min(zMin, v.pos.z)
local fenceVertices = {}
for _, v in ipairs(self.vertices) do
local a, b, c, d = vec3(), vec3(), vec3(), vec3()
local hitDist = math.huge
for _, vertices in ipairs(fenceVertices) do
local hitDist1 = intersectsRay_Triangle(rayPos, rayDir, vertices.a, vertices.b, vertices.c)
local verts = self.vertices
for _, cur in ipairs(self.vertices) do
local nexpos = verts[cur.next].pos
local drawSqDist = square(editor.isEditorActive() and editor.getPreference("gizmos.visualization.visualizationDrawDistance") or 500)
for _, v in ipairs(self.vertices) do
if camPos:squaredDistance(v.pos) < drawSqDist or camPos:squaredDistance(self.vertices[v.next].pos) < drawSqDist
if drawMode ~= 'faded' then
for i, v in ipairs(self.vertices) do
debugDrawer:drawLine((self.labelPos), (v.pos+vec3(0,0,5)), ColorF(clr[1],clr[2],clr[3],shapeAlpha))
if drawMode == 'highlight' then
for i, v in ipairs(self.vertices) do
debugDrawer:drawCylinder((v.pos), (v.pos+vec3(0,0,5)), 0.5, ColorF(clr[1],clr[2],clr[3],shapeAlpha))
for i, v in ipairs(self.vertices) do
local usePlanes = true
if #self.vertices > 1 then
for i, v in ipairs(self.vertices) do
debugDrawer:drawLine((plane.pos), (self:vertexPlaneIntersection(v.pos,plane)), clrF)
function C:drawMinimap(td)
for i_, v in ipairs(self.vertices) do
ui_apps_minimap_utils.worldToMapXYZ(t1, v.pos)
if vCount > 1 then
for i, v in ipairs(self.vertices) do
local cur, nex = v.pos, self.vertices[v.next].pos
@/lua/ge/extensions/core/recoveryPrompt.lua
-- add garage tow buttons
for i, garage in ipairs(garages) do
if not garage.noQuickTravel then
-- add garage taxi buttons
for i, garage in ipairs(garages) do
if not garage.noQuickTravel then
local add = true
for key, cond in ipairs(option.includeConditions or {}) do
add = cond(target.type, target.vehId)
local reason = nil
for key, cond in ipairs(option.enableConditions or {}) do
local en, rs = cond(target.type, target.vehId)
local targets = getRecoveryTargets()
for i, target in ipairs(targets) do
for _, btn in ipairs(getButtonsForTarget(target)) do
for i, target in ipairs(targets) do
for _, btn in ipairs(getButtonsForTarget(target)) do
table.insert(buttons, btn)
end
for _, btn in ipairs(getButtonsForTarget({type="none"})) do
table.insert(buttons, btn)
local function addButtonsForLevel(level)
for _, context in ipairs({
{
if not popupData then return end
for _, button in ipairs(popupData.buttons or {}) do
if button.path == level then
@/lua/vehicle/controller/driveModes.lua
--dump(mode)
for _, settingsKey in ipairs(mode.settingsOrder) do
local setting = mode.settings[settingsKey]
if driveModes[requestedDefaultMode] then
for k, modeName in ipairs(enabledDriveModes) do
if modeName == requestedDefaultMode then
@/lua/ge/extensions/core/input/bindings.lua
local result = { bindings = {}, removed = {} }
for _,path in ipairs(paths) do
-- read and normalize/upgrade bindings from a single file on disk
if k == "bindings" then
for i, b in ipairs(v) do
if b.control == nil then
elseif k == "removed" then
for i, b in ipairs(v) do
if ignoreRemoved then
log("D", "", "Inverting curve path: "..dumps(path))
for n,v in ipairs(responseCurve) do
v[2], v[1] = v[1], v[2]
local result = {}
for _,dir in ipairs(dirs) do
for _,prefix in ipairs(prefixes) do
for _,dir in ipairs(dirs) do
for _,prefix in ipairs(prefixes) do
for _,path in ipairs(FS:findFiles(dir, prefix:lower().."*."..suffix, recursion, true, false)) do
for _,prefix in ipairs(prefixes) do
for _,path in ipairs(FS:findFiles(dir, prefix:lower().."*."..suffix, recursion, true, false)) do
if tech_license.isAllowedInputmapPath(path) then
local res = {}
for _,e in ipairs(list) do
res[e] = true
-- first check for new or modified devices (using devname as the id)
for _,device in ipairs(newDevicesList) do
local guid, productName, pidvid = getDeviceInfo(device)
for i, devname in ipairs(sortedNodeKeys) do
local info = devices[devname] or {}
-- now append all new bindings
for _,b in ipairs(vehicleContents.bindings) do
table.insert(contents.bindings, deepcopy(b))
for _,b in ipairs(contents.bindings) do b.player = player end
table.insert(result, {devname = devname, contents = contents})
actionToControl = {}
for _, device in ipairs(M.bindings) do
for _, binding in ipairs(device.contents.bindings) do
for _, device in ipairs(M.bindings) do
for _, binding in ipairs(device.contents.bindings) do
if not actionToControl[binding.action] then
for i,s in pairs(ActionMap:getList())do
for j,v in ipairs(s) do
if v.name:endswith("ActionMap") then -- skip the editor (and similar) action maps
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))..")")
local function resetDeviceBindings(devname, guid, name, pidvid, vehicleName)
for _,suffix in ipairs({"json", "diff"}) do
for _,path in ipairs(getInputmapPaths(devname, guid, name, pidvid, vehicleName, suffix)) do
for _,suffix in ipairs({"json", "diff"}) do
for _,path in ipairs(getInputmapPaths(devname, guid, name, pidvid, vehicleName, suffix)) do
FS:removeFile(path) -- will only be removed if stored in user folder (game install folder is read-only)
local function saveBindingsToDisk(data)
for _,binding in ipairs(data.bindings or {}) do
fixBuggyBindingFromUISide(binding)
-- then we add them with whatever 'data' came from the UI side
for _,b in ipairs(data.bindings) do
local vehicleName = core_input_actions.getActiveActions()[b.action].vehicle
table.insert(allEntries, 1, baseDir)
for _, entry in ipairs(allEntries) do
local stat = FS:stat(entry)
local guids = jsonReadFile(settingsFile)
for _, info in ipairs(guids) do
if not info.skipMigration and type(info.id) == "string" then
end
for _, p in ipairs(candidatePaths) do
if FS:fileExists(p) then
-- translate the two trigger buttons that we removed from the controller
for _, binding in ipairs(data.bindings) do
if controlTranslations[binding.control] then
@/gameplay/missionTypes/scatterPickup/customNodes/scatterResetNode.lua
function C:workOnce()
for i, p in ipairs(self.mgr.scatterPickup.states) do
for _, icon in ipairs(self.mgr.scatterPickup.icons) do
icon.remaining = icon.points
@/lua/vehicle/controller/drivingDynamics/actuators/adaptiveTorsionBars.lua
for _, cid in ipairs(torsionBars) do
local spring = v.data.torsionbars[cid].spring * mode.springCoef
@/lua/vehicle/extensions/vehiclePerformanceData.lua
local power = 0
for _, propulsionDevice in ipairs(recordingData[M.recordingTypes.power].wheelPropulsionDevices) do
if propulsionDevice.combustionTorque then
local torque = 0
for _, propulsionDevice in ipairs(recordingData[M.recordingTypes.torque].wheelPropulsionDevices) do
if propulsionDevice.combustionTorque then
local function startRecording(recordingTypes)
for _, recordingType in ipairs(recordingTypes) do
recordingData[recordingType] = {}
local function stopRecording(recordingTypes)
for _, recordingType in ipairs(recordingTypes) do
activeRecordingTypes[recordingType] = nil
local data = {}
for _, recordingType in ipairs(recordingTypes) do
data[recordingType] = recordingData[recordingType]
-- local powerCurve = {}
-- for _, td in ipairs(torqueData) do
-- local engineCurves = td.curves[td.finalCurveName]
@/lua/ge/extensions/editor/rallyEditor/pacenotes/pacenoteForm.lua
local types = {}
for _,k in ipairs(keys) do
table.insert(types, { k, RallyEnums.slowCornerReleaseTypeName[k] })
local types = {}
for _,k in ipairs(keys) do
table.insert(types, { k, RallyEnums.triggerTypeName[k] })
-- local issues = "Issues (".. (#pacenote.validation_issues) .."):\n"
-- for _, issue in ipairs(pacenote.validation_issues) do
-- issues = issues..'- '..issue..'\n'
local issues = ""
for _, issue in ipairs(pacenote.validation_issues) do
issues = issues..'- '..issue..'\n'
if im.BeginCombo("Audio Mode Override##pacenoteAudioMode", pacenoteAudioModeSetting) then
for _, mode in ipairs(RallyEnums.pacenoteAudioModeNames) do
if im.Selectable1(mode, mode == pacenoteAudioModeSetting) then
if im.BeginCombo('Slow Corner Release Type##slowCornerReleaseType', currVal) then
for _,triggerType in ipairs(dropdownSlowReleaseTypes()) do
local k = triggerType[1]
if im.BeginCombo('Trigger Type##triggerType', currVal) then
for _,triggerType in ipairs(dropdownTriggerTypes()) do
local k = triggerType[1]
@/lua/ge/extensions/editor/api/genericInspector.lua
local function displayFields(fields)
for _, val in ipairs(fields) do
-- simple field
if imgui.CollapsingHeader1("[" .. tostring(i - 1) .. "]", nodeFlags) then
for _, arrayField in ipairs(val.sortedFields) do
if not arrayField.hidden then
local function getFieldType(fieldName, fields)
for _, field in ipairs(fields) do
if string.lower(field.name) == string.lower(fieldName) then
local passFilter = false
for _, val in ipairs(fields) do
if imgui.ImGuiTextFilter_PassFilter(self.fieldNameFilter, val.name) then
-- display the groups and their fields
for _, group in ipairs(groupedSortedFields) do
displayGroup(group.groupName, group.fields)
@/lua/ge/extensions/gameplay/rally/util/jsonlUtils.lua
for _, line in ipairs(lines) do
line = rallyUtil.trimString(line)
@/gameplay/missionTypes/rallyLoop/constructor.lua
local waypoints = {}
for i, nId in ipairs(path.config.linearSegments or {}) do
local node = path.pathnodes.objects[nId]
local stageNumbers = {1, 2, 3, 4}
for _, stageNum in ipairs(stageNumbers) do
-- Get road section for this stage
local waypoints = loadWaypointsFromRace(raceFile)
for _, wp in ipairs(waypoints) do
table.insert(allWaypoints, wp)
local waypoints = loadWaypointsFromRace(raceFile)
for _, wp in ipairs(waypoints) do
table.insert(allWaypoints, wp)
local waypoints = loadWaypointsFromRace(raceFile)
for _, wp in ipairs(waypoints) do
table.insert(allWaypoints, wp)
@/lua/ge/extensions/flowgraph/nodes/events/customizedTriggerBox.lua
local inside = false
for _, pos in ipairs(self.points) do
if self.trigger.type == 'Box' then
self.zOffset:set(veh:getDirectionVectorUp() * oobb:getHalfExtents().z) -- vertical midpoint of vehicle
for i, v in ipairs(self.bbPoints) do
self.points[i]:set(oobb:getPoint(v) + self.zOffset)
-- draw all faces in a loop
for _, face in ipairs({{x,y,z},{x,z,y},{y,z,x}}) do
local a,b,c = face[1],face[2],face[3]
if im.BeginCombo("##triggerType", self.triggerType) then
for _,triggerType in ipairs(triggerTypeNames) do
if im.Selectable1(triggerType, triggerType == self.triggerType) then
@/lua/ge/extensions/gameplay/race/path.lua
for _, f in ipairs(idFields) do
self[f] = -1
end
for _, p in ipairs(prefabFields) do
self[p] = {}
local done = {}
for _, p in ipairs(elem.predecessors) do
table.insert(open, config.graph[p])
-- add all predecessors we have node done yet
for _, p in ipairs(cur.predecessors) do
if not done[p] then
for _, elem in pairs(config.graph) do
for _, nvs in ipairs(elem.nextVisibleSegments) do
for _, succ in ipairs(config.graph[nvs].successors) do
for _, nvs in ipairs(elem.nextVisibleSegments) do
for _, succ in ipairs(config.graph[nvs].successors) do
-- add all nextVisibleSegments of the successors of the initial nextVisibleSegments into overNextVisibleSegments.
-- add all nextVisibleSegments of the successors of the initial nextVisibleSegments into overNextVisibleSegments.
for _, n in ipairs(config.graph[succ].nextVisibleSegments) do
table.insert(elem.overNextVisibleSegments, n)
config.segmentToPacenotes[id] = {}
for _, pn in ipairs(self.pacenotes.sorted) do
if self.segments.objects[pn.segment].missing or pn.segment == id then
local ret = {}
for _, seg in ipairs(self.segments.sorted) do
if seg:isValid() then
for i, e in ipairs(self.aiDetailedPath) do
local clr = rainbowColor(#self.aiDetailedPath, i, 1)
function C:findStartPositionByName(name)
for _, sp in ipairs(self.startPositions.sorted) do
if sp.name == name then
for _, f in ipairs(idFields) do
ret[f] = self[f]
end
for _, p in ipairs(prefabFields) do
ret[p] = self[p]
self.pacenotes:onDeserialized(data.pacenotes, oldIdMap)
for _, f in ipairs(idFields) do
self[f] = oldIdMap[data[f]] or -1
end
for _, p in ipairs(prefabFields) do
self[p] = data[p] or {}
-- parse all branches and all cps from the config to get all CP infos
for _, cp in ipairs(lapConfig) do
if not nodeToId[cp] then
-- parse all branches and all cps from the config to get all CP infos
for _, cp in ipairs(list) do
if cp then
local merged = {}
for _, p in ipairs(trackInfo.prefabs or {}) do table.insert(merged, p) end
for _, p in ipairs(trackInfo.forwardPrefabs or {}) do table.insert(merged, p) end
for _, p in ipairs(trackInfo.prefabs or {}) do table.insert(merged, p) end
for _, p in ipairs(trackInfo.forwardPrefabs or {}) do table.insert(merged, p) end
for _, p in ipairs(trackInfo.reversePrefabs or {}) do table.insert(merged, p) end
for _, p in ipairs(trackInfo.forwardPrefabs or {}) do table.insert(merged, p) end
for _, p in ipairs(trackInfo.reversePrefabs or {}) do table.insert(merged, p) end
for list, suf in pairs(autoPrefabs) do
for _, ext in ipairs(prefabExt) do
local file = trackInfo.directory..trackInfo.trackName..suf..ext
end
for _, p in ipairs(merged) do
local name = generateObjectNameForClass('Prefab',"fromTrackPrefab_")
for _, fcp in ipairs({{'startLineCheckpoint','startNode'},{'finishLineCheckpoint','endNode'}}) do
if trackInfo[fcp[1]] then
log("E","","Could not find node for conversion from track! " .. dumps(cp))
for _, p in ipairs(spawnedPrefabs) do
p:delete()
--dumpz(trackInfo.originalInfo.lapConfig,1)
for idx, cp in ipairs(trackInfo.originalInfo.lapConfig) do
if not nodeToId[idx] then
log("E","","Could not find node for conversion from track! " .. dumps(cp))
for _, p in ipairs(spawnedPrefabs) do
p:delete()
local order = {}
for i, _ in ipairs(trackInfo.originalInfo.lapConfig) do
table.insert(order, i)
if trackInfo.originalInfo then
for _, field in ipairs({'authors','date','description','difficulty','forwardPrefabs','name','prefabs','reversePrefabs'}) do
if trackInfo.originalInfo[field] ~= nil then
--copy start positions if possible
for _, spInfo in ipairs({{'standing','defaultStartPosition'}, {'standingReverse','reverseStartPosition'}, {'rolling','rollingStartPosition'}, {'rollingReverse','rollingReverseStartPosition'}}) do
local spawnObj = scenetree.findObject(trackInfo.spawnSpheres[spInfo[1]])
for _, p in ipairs(spawnedPrefabs) do
p:delete()
@/lua/ge/extensions/util/procTrack.lua
--extract nodes from nodes.
for i,n in ipairs(nodes) do
for _,e in ipairs(n.points) do
path[#path+1] = e
end
for i,n in ipairs(path) do
if i > 1 then
local noSplits = 0
for _,r in ipairs(params.startingRects) do
if not r.noSplit then
-- debug lines between the nodes.
for _,r1 in ipairs(graph.nodes) do
for _,r2i in ipairs(r1.neighbours) do
for _,r1 in ipairs(graph.nodes) do
for _,r2i in ipairs(r1.neighbours) do
local r2 = graph.nodes[r2i.index]
--dump(r.name .." : ".. #r.neighbours)
--for _,n in ipairs(r.neighbours) do
local roadTS = [[
local sortNodes = {}
for i,n in ipairs(graph.nodes) do
sortNodes[i] = {x=n.x,y=n.y,i=i}
local pstr = "["
for _,p in ipairs(path) do pstr = pstr.. " " .. p.name .. " " end
log("I",logTag,pstr .. "]")
local pstr = "["
for _,p in ipairs(path) do pstr = pstr.. " " .. p.name .. " " end
--log("I",logTag,pstr .. "]")
-- cleanup :)
for i,n in ipairs(path) do
n.nextIndex = nil
-- collect all nodes not in the path or the next node.
for _,n in ipairs(nodes) do
if n ~= nextNode and not M.isInList(path,n) then
-- otherwise add all neighbours, which are not the next node, not in the path and not already floodfilled to the open list.
for _,n in ipairs(open[currentIndex].neighbours) do
local neighbour = nodes[n.index]
local function isInList(list, element)
for _,p in ipairs(list) do
if p == element then
cPath[1] = path[#path]
for _,p in ipairs(path) do
cPath[#cPath+1] = p
local cNodes = {}
for i,n in ipairs(nodes) do
if i ~= 1 and i ~= #nodes then
--first, loop over all nodes and gather information about distances, points, vectors, angles etc.
for i,p in ipairs(path) do
--for all nodes, get the point of the pylon.
local function determineInOutAngle(nodes)
for i,n in ipairs(nodes) do
-- for all pairs of consecutive nodes:
local function getPathRoadNodes(nodes)
for i,n in ipairs(nodes) do
local mat = {"tread_marks_clean","road_orange_markings"}
for i,m in ipairs(mat) do
local path = {}
--extract nodes from nodes.
for i,n in ipairs(nodes) do
if #n.points == 0 then
if params.path.closed and (i ~= 1 and i ~= #nodes) or not params.path.closed then
for _,e in ipairs(n.points) do
path[#path+1] = e
local ret = ''
for _,p in ipairs(path) do
local pos = M.getPosition(p.x,p.y,0)
for i,spot in ipairs(spots) do
local nv = {
local function createPylons(nodes)
for i,n in ipairs(nodes) do
if params.path.closed and i ~= 1 and i ~= #nodes or not params.path.closed then
scenario.nodes = {}
for i,n in ipairs(nodes) do
if params.path.closed and (i ~= 1 and i ~= #nodes) or not params.path.closed then
local newLapConfig = {}
for i,l in ipairs(scenario.lapConfig) do
newLapConfig[(i+#scenario.lapConfig-2)%#scenario.lapConfig +1] = l
@/lua/vehicle/controller/drivingDynamics/supervisors/yawControl.lua
local function updateIsEnabled(isEnabled)
for _, v in ipairs(yawProviders) do
v.setParameters({isEnabled = controlParameters.isEnabled})
end
for _, v in ipairs(yawControlComponents) do
v.setParameters({["yawControl.isEnabled"] = controlParameters.isEnabled})
@/lua/common/libs/slaxml/slaxml.lua
local charbytes = {}
for bytes,vals in ipairs(utf8markers) do
if decimal<=vals[1] then
@/lua/ge/extensions/editor/terrainAndRoadImporter.lua
for _, peak in ipairs(peaks) do
local px, py, pz = peak.x, peak.y, peak.z
@/lua/ge/extensions/gameplay/rally/tools/loopToolbox.lua
for _, mission in ipairs(missions) do
local translatedName = translateLanguage(mission.name, mission.name, true)
if savedMissionId then
for i, displayName in ipairs(self.missionDropdownItems) do
local missionId = displayName:match("%((.+)%)$")
if success and dynFields then
for _, fieldName in ipairs(dynFields) do
if fieldName == "flag" then
if im.BeginCombo('##rallyLoopMission', currentSelection, im.ComboFlags_HeightLarge) then
for i, missionName in ipairs(self.missionDropdownItems) do
if im.Selectable1(missionName, i == self.selectedMissionIndex[0] + 1) then
-- -- im.TextColored(colorYellow, "Splits")
-- -- for i, split in ipairs(raceDataSummary.splits) do
-- -- local splitTimeStr = self:formatDuration(split.time, true)
-- Iterate through schedule and display each mission
for i, entry in ipairs(schedule) do
-- Get mission name
if events then
for eventIdx, event in ipairs(events) do
-- Only display events for this mission
-- Draw cached signboards
for _, signboard in ipairs(self.signboards) do
local success = pcall(function()
@/lua/vehicle/protocols.lua
end
for _,protocol in ipairs(protocols) do
if protocol.physicsStepUsed then
--guihooks.graph({"Acc Roll", M.rollAcc, 1, "", true}, {"Acc Pitch", M.pitchAcc, 1, "", true}, {"Acc Yaw", M.yawAccSmoothed, 1, "", true})
for _,protocol in ipairs(protocols) do
if not protocol.physicsStepUsed then
smoothersReset()
for _,protocol in ipairs(protocols) do
if type(protocol.module.reset) == "function" then
local function destroy()
for _,protocol in ipairs(protocols) do
log("D", "", string.format("Shutdown of protocol %q for vehicle "..objectId.." ("..vehiclePath..") at %s:%d with an update rate of %d Hz (%s)", protocol.name, protocol.ip, protocol.port, protocol.updateRate, tostring(protocol)))
filesCache = filesCache or FS:findFiles(protocolsDir, "*.lua", 0, false, false) -- optimization, do not hit FS for new files (until you ctrl-R)
for _,filepath in ipairs(filesCache) do
local filename = filepath:match("[^/]*.lua$")
@/lua/ge/extensions/gameplay/taxi.lua
end
for _, vehId in ipairs(taxisToDiscard) do
blinkerStates[vehId] = nil
-- find the first valid waypoint
for i, marker in ipairs(path) do
if marker.wp then
if not firstWpAdded then
for _, marker in ipairs(path) do
if marker.wp and startDist - marker.distToTarget > 25 then
end
for _, vehId in ipairs(missingVehIds) do
taxiIdsList[vehId] = nil
@/lua/ge/extensions/util/trackBuilder/basicCenters.lua
for _, faceList in ipairs(shape.faces) do
for vIndex = 2, #faceList -1 do
local vOff = 0
for _, faceList in ipairs(shape.faces) do
local vOff = 0
local endCap = {}
for i,face in ipairs(shape.cap) do
startCap[(i-1)*3 + 1] = { v = face[1]-1, n = 0, u = 0}
local minWidth = 50
for _,p in ipairs(segment.points) do
if p.width and p.width > maxWidth then
local scaledWidthsNeeded = {}
for _,s in ipairs(widthsNeeded) do
for i = s*LUTDetail, (s+1) * LUTDetail do
-- now comes actual lookuptable calculation:
for _,s in ipairs(scaledWidthsNeeded) do
-- This is the actual width of the track we are dealing with in this step.
-- caluclate the normals
for _, faceList in ipairs(shape.faces) do
-- normal for the first point is always sharp
vertices[#vertices].uvX = len
for i, faceList in ipairs(shape.faces) do
local uvCenterOff = vertices[shape.uvCenterIndex[i]].uvX
local uvCenterOff = vertices[shape.uvCenterIndex[i]].uvX
for _,fIndex in ipairs(faceList) do
vertices[fIndex].uvX = vertices[fIndex].uvX - uvCenterOff
vertexLUT = shape.vertexLUT[LUTindex]
for i,p in ipairs(vertexLUT.vertices) do
tmpVec3:set(
end
for i,p in ipairs(vertexLUT.normals) do
tmpVec3:set(
local nOff = shape.faceInfo.normalCount * cpIndex
for i, f in ipairs(shape.faceInfo.faces) do
faces[i + cpIndex * shape.faceInfo.faceCount] = {v = f.v + vOff-1, n = f.n + nOff-1, u = f.u + vOff-1}
if startCap then
for i, f in ipairs(shape.faceInfo.startCap) do
faces[faceCount+i] = {v = f.v, n = normalCount-1, u = 0 }
if endCap then
for i, f in ipairs(shape.faceInfo.endCap) do
faces[faceCount+i] = {v = vertexCount +f.v, n = normalCount, u = 0 }
local function clearShapes()
for _,shape in ipairs(shapes) do
shape.vertexLUT = {}
@/lua/vehicle/controller/hydraulics/orbitrolSteering.lua
--iterate over steeringCylinders and track extend percentage
for _, cylinder in ipairs(steeringCylinders) do
currentSteering = currentSteering + cylinder.currentExtendPercent * cylinder.direction
for _, cylinderName in ipairs(jbeamData.steeringPositionCylinders or {}) do
local cylinder = powertrain.getHydraulicConsumer(cylinderName)
@/lua/ge/extensions/util/trackBuilder/borderWallMesh.lua
if side == -1 then
for i, f in ipairs(shape.faceInfo.faces) do
faces[(shape.faceInfo.faceCount+1-i) + (cpIndex * shape.faceInfo.faceCount)] = {
else
for i, f in ipairs(shape.faceInfo.faces) do
faces[i + cpIndex * shape.faceInfo.faceCount] = {
if segment.meshInfo[sideName].startCap or segment.meshInfo.forceStartCap then
for i, f in ipairs(shape[sideName].front) do
faces[faceCount+i] = {v = f.v, n = normalCount+f.n, u = uvCount+f.u }
if segment.meshInfo[sideName].endCap or segment.meshInfo.forceEndCap then
for i, f in ipairs(shape[sideName].back) do
faces[faceCount+i] = {v = vertexCount+f.v, n = normalCount+f.n, u = uvCount+f.u }
@/lua/vehicle/jbeam/stage2.lua
for _, v in ipairs(wheel.nodes) do
obj:addWheelNode(wid, v)
for i, nid in ipairs(rLinks) do
local lcapped = 0
@/lua/vehicle/extensions/tech/OBDEmulator.lua
if not hardwareDetected then
for _, response in ipairs(messages) do
if response == "OK" then
local torque = 0
for _, engine in ipairs(engines) do
torque = torque + engine.outputTorque1 or 0
engines = {}
for _, engine in ipairs(powertrain.getDevicesByCategory("engine")) do
table.insert(engines, engine)
@/lua/ge/extensions/core/online.lua
local items = split(str, delim, maxNb)
for _, i in ipairs(items) do
res[i] = value or 1
local hidden_ids = split(settings.getValue("OnlineHiddenMessageIDs", ''), ',')
for _, id in ipairs(hidden_ids) do
if uid == id then
@/lua/ge/extensions/career/modules/tuning.lua
local function isOnBlackList(varData)
for _, blackListItem in ipairs(shoppingCartBlackList) do
if blackListItem.name ~= varData.name then goto continue end
for _, vehicleData in ipairs(menuData.vehiclesInGarage) do
local computerFunctionData = {
@/lua/vehicle/controller/drivingDynamics/supervisors/tractionControl.lua
local tractionControlledMotors = jbeamData.tractionControlledMotors or {}
for _, motorName in ipairs(tractionControlledMotors) do
local motor = powertrain.getDevice(motorName)
}
for _, wheel in ipairs(childWheels) do
local wheelData = {
local function updateIsEnabled(isEnabled)
for _, v in ipairs(slipProviders) do
v.setParameters({["tractionControl.isEnabled"] = isEnabled})
end
for _, v in ipairs(tractionControlComponents) do
v.setParameters({["tractionControl.isEnabled"] = isEnabled})
@/lua/ge/extensions/career/modules/milestones/generalMilestones/missions.lua
local missionsByBranch = {}
for i, mission in ipairs(gameplay_missions_missions.get()) do
if mission.careerSetup.showInCareer then
M.makeAllMissionStarMilestones(careerMissions, milestonesList)
for _, branchKey in ipairs(tableKeysSorted(missionsByBranch)) do
M.makeBranchMissionStarMilestones(missionsByBranch[branchKey], branchKey , milestonesList)
local missionCount = 0
for _, m in ipairs(missions) do
defaultStarCount = defaultStarCount + m.careerSetup._activeStarCache.defaultStarCount
local count = 0
for _, m in ipairs(missions) do
count = count + tableSize(m.saveData.unlockedStars or {})
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
local count = 0
for _, m in ipairs(missions) do
count = count + (m.saveData.unlockedStars.defaultUnlockedStarCount and 1 or 0)
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
local count = 0
for _, m in ipairs(missions) do
count = count +
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
local missionCount = 0
for _, m in ipairs(missions) do
defaultStarCount = defaultStarCount + m.careerSetup._activeStarCache.defaultStarCount
local count = 0
for _, m in ipairs(missions) do
count = count + tableSize(m.saveData.unlockedStars or {})
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
local count = 0
for _, m in ipairs(missions) do
count = count + (m.saveData.unlockedStars.defaultUnlockedStarCount and 1 or 0)
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
local count = 0
for _, m in ipairs(missions) do
count = count +
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
for _, m in ipairs(missions) do
missionIdToMilestonesList[m.id] = missionIdToMilestonesList[m.id] or {}
M.onGeneralMilestonesSetupCallbacks = function()
for _, milestone in ipairs(milestoneConfigs) do
M.setNotificationTarget(milestone)
if state == "stopped" then
for _, milestone in ipairs(missionIdToMilestonesList[mission.id] or {}) do
if milestone.hooks.onAnyMissionChanged then
local function onMissionUnlocked(id)
for _, milestone in ipairs(milestoneConfigs) do
if milestone.hooks.onMissionUnlocked then
@/lua/ge/extensions/core/cameraModes/relative.lua
if #self > 0 then -- onboard/relative cameras were defined
for k, cr in ipairs(self) do
if cr.name then
@/lua/common/libs/LuLPeg/lulpeg.lua
Builder.ptcache = ptcache
for _, p in ipairs(patternwith.aux) do
ptcache[p] = weakval{}
end
for _, p in ipairs(patternwith.subpt) do
ptcache[p] = weakval{}
end
for _, p in ipairs(patternwith.both) do
ptcache[p] = {}
@/lua/vehicle/controller/couplings/fifthwheel.lua
controller.cacheAllControllerFunctions()
local cmdString = "for _,kingpin in ipairs(controller.getControllersByType('couplings/kingpin')) do kingpin.setKingpinVisibility(%q,%s) end"
BeamEngine:queueAllObjectLua(string.format(cmdString, fifthwheelKey, visible))
local kingpins = controller.getControllersByType("couplings/kingpin")
for _, kingpin in ipairs(kingpins) do
kingpin.sendDataToVehicle(%d, %q, %q)
table.clear(isCollidingWithLookup)
for _, id in ipairs(mapmgr.objectCollisionIds) do
isCollidingWithLookup[id] = true
--delete expired timeouts
for _, timeout in ipairs(kingpinTimeoutsToDelete) do
kingpinRequestTimeouts[timeout] = nil
if collisionCheckTimer <= 0 then
for _, id in ipairs(mapmgr.objectCollisionIds) do
requestKingpinData(id)
@/lua/ge/extensions/gameplay/util/sortedList.lua
table.sort(self.sorted, function(a,b) return a.sortOrder
table.clear(self.byName)
for _, zone in ipairs(self.sorted) do
if not self.byName[zone.name] then
function C:drawDebug(drawMode)
for _,o in ipairs(self.sorted) do
o:drawDebug(drawMode)
local ret = {}
for i, o in ipairs(self.sorted) do
if not o.isProcedural then
self:clear()
for _, d in ipairs(data or {}) do
local o = self:create(d.name)
@/lua/ge/extensions/gameplay/drift/stuntZones/nearPole.lua
scoredFlag = false
for _, corner in ipairs(gameplay_drift_drift.getVehCorners()) do
cornerDist = corner:distance(self.data.zoneData.pos)
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veStaticRenderView.lua
for k, objData in ipairs(hitObjects) do
if k >= 2 then
local viewsSerialized = {}
for wndID, wndData in ipairs(wndsData) do
if wndData then
else
for id, wndData in ipairs(viewsSerialized) do
if wndData then
for id, wndData in ipairs(wndsData) do
if not wndData or (wndData and not editor.isWindowVisible(wndData.wndName)) then
--local rvNames = {}
--for k,v in ipairs(wndsData) do
-- table.insert(rvNames, v.mainRVData.name)
for k, arrowVec in ipairs(arrowVecs) do
-- Don't allow picking arrow if its pretty much inline with vector projected out of user's screen
-- Render and do stuff based on chosen one
for k, arrowVec in ipairs(arrowVecs) do
local arrowCol = nil
local function onPreRender()
for wndID, wndData in ipairs(wndsData) do
if wndData and wndData.mainRVData.renderView and wndData.axisGizmoRVData.renderView then
for wndID, wndData in ipairs(wndsData) do
if wndData and editor.isWindowRegistered(wndData.wndName) then
--local rvNames = {}
--for k,v in ipairs(wndsData) do
-- table.insert(rvNames, v.mainRVData.name)
local function destroyAllRenderViews()
for id, data in ipairs(wndsData) do
if data then
@/lua/ge/extensions/editor/gen/top.lua
local ref = base[1]
for _,b in ipairs(base) do
av[#av+1] = b
@/lua/ge/extensions/flowgraph/nodes/scene/spawnPrefab.lua
if self.pinIn.resetVeh.value then
for _, id in ipairs(self.objects) do
self.mgr.modules.prefab:restoreVehiclePositions(id)
@/lua/ge/extensions/editor/toolUtilities/util.lua
local wMin, wMax = huge, -huge
for _, node in ipairs(nodes) do
local width = node.width or 0
local posStart = 0
for _, v in ipairs(vertices) do
local gx, gy, gz = convertToGLTFCoords(v.x, v.y, v.z)
local idxStart = binByteLength
for _, i in ipairs(indices) do
binByteLength = packu16(i - 1, bin, binByteLength)
for i, path in ipairs(paths) do
local intensity = levels[(i - 1) % nLevels + 1] -- Cycle if too many
-- Draw each path using filled circles based on computed width
for i, path in ipairs(paths) do
local wPath = widths[i]
@/lua/vehicle/extensions/tech/tyreBarrier.lua
-- Write each row of numerical data, in turn. We write it out by key, so we can guarantee correct order.
for _, r in ipairs(cachedData) do
file:write(r.t .. ",")
@/lua/ge/extensions/editor/api/history.lua
-- run the redo funcs for the gathered actions
for _, action in ipairs(self.currentTransaction.actions) do
action.redo(action.data)
-- clear timestamps, these always change
for _, act in ipairs(topTrans.actions) do
act.timestamp = nil
end
for _, act in ipairs(crtTrans.actions) do
act.timestamp = nil
function C:updateRedoStackObjectId(oldObjectId, newObjectId)
for _, transaction in ipairs(self.redoStack) do
local action
@/lua/ge/extensions/gameplay/markers/invisibleTrigger.lua
local function cluster(pois, allClusters)
for _, poi in ipairs(pois) do
local cluster = {
@/lua/ge/extensions/editor/flowgraph/garbageDebug.lua
entry.historyLength = #(entry.history or {})
for _, h in ipairs(entry.history or {}) do
entry.minChange = math.min(entry.minChange, h)
end
for _, h in ipairs(entry.totalHistory or {}) do
entry.minTotal = math.min(entry.minTotal, h)
graphSum.total = graphSum.total + gr.total
for k, v in ipairs(gr.history) do graphSum.history[k] = (graphSum.history[k] or 0) + v end
for k, v in ipairs(gr.totalHistory) do graphSum.totalHistory[k] = (graphSum.totalHistory[k] or 0) + v end
for k, v in ipairs(gr.history) do graphSum.history[k] = (graphSum.history[k] or 0) + v end
for k, v in ipairs(gr.totalHistory) do graphSum.totalHistory[k] = (graphSum.totalHistory[k] or 0) + v end
end
if im.BeginCombo("garbageSort","Sort by: " .. valueLabels[editor.getPreference("flowgraph.debug.garbageSort")]) then
for _, key in ipairs(valueKeys) do
if im.Selectable1(valueLabels[key], key == editor.getPreference("flowgraph.debug.garbageSort")) then
im.Spacing()
for _, grId in ipairs(self.mgr.garbageData.graphIdsSortedByTotalGarbage or {}) do
local graph = self.mgr.graphs[grId]
im.Spacing()
for _, nId in ipairs(self.mgr.garbageData.nodeIdsSortedByTotalGarbage or {}) do
local entry = self.mgr.garbageData.nodes[nId]
@/lua/ge/extensions/gameplay/rally/test/testRouteFix.lua
local drawPath = function()
for i, pos in ipairs(path) do
debugDrawer:drawSphere(pos, 0.5, ColorF(1,1,1,1), false, false)
for i, pos in ipairs(route.path) do
local p1 = pos.pos
@/lua/ge/extensions/gameplay/drift/quickMessages.lua
local table = {}
for _, confirmConditionName in ipairs(data.confirmConditions) do
table[confirmConditionName] = {}
@/lua/common/jbeam/io.lua
local addedSlots = 0
for k, slotSectionRow in ipairs(slots) do
if slotSectionRow[1] == "type" then goto continue end -- ignore the header
-- now upgrade to the new slots2 data structure
for _, slot in ipairs(part.slots) do
slot.name = slot.name or slot.type
local res = table.new(0, #slots)
for _, slot in ipairs(slots) do
local s = {}
for partName, partData in pairs(cacheData.parts) do
for _, slotType in ipairs(partData.slotTypes) do
partSlotMap[cacheData.namespace] = partSlotMap[cacheData.namespace] or {}
lastStartLoadingStats = { total = 0, cachedHits = 0 }
for _, dir in ipairs(directories) do
local filenames = FS:findFiles(dir, "*.jbeam", -1, false, false)
local filenames = FS:findFiles(dir, "*.jbeam", -1, false, false)
for _, filename in ipairs(filenames) do
wasCached = _ensureJBeamFileLoaded(filename)
if not partName then return end
for _, dir in ipairs(ioCtx.preloadedDirs) do
local jbeamFilename = partFileMap[dir][partName]
if not isContextValid(ioCtx) then return end
for _, dir in ipairs(ioCtx.preloadedDirs) do
if partSlotMap[dir] and partSlotMap[dir]['main'] then
local loaded = false
for _, dir in ipairs(ioCtx.preloadedDirs) do
if not partSlotMap[dir] then
local loaded = false
for _, dir in ipairs(ioCtx.preloadedDirs) do
if not partSlotMap[dir] then
local partMap = slotsPartMap[slotName]
for _, partName in ipairs(partList) do
if partMap[partName] then
if denyTypesMap then
for _, denyType in ipairs(slotDef.denyTypes) do
denyTypesMap[denyType] = true
end
for _, slotType in ipairs(slotDef.allowTypes) do
-- get all parts that fit the slot allow type
local allowedParts = slotMap[slotType] or {}
for _, partName in ipairs(allowedParts) do
if not suitablePartsMap[partName] then
local allowed = true
for _, slotType in ipairs(part.slotType) do
if denyTypesMap[slotType] then
if slots then
for _, slotDef in ipairs(slots) do
local slotId = slotDef.name or slotDef.type
@/lua/common/libs/luasocket/socket/tp.lua
if base.type(ok) == "table" then
for i, v in base.ipairs(ok) do
if string.find(code, v) then
@/lua/console/bananabench-csv.lua
for vecname, v in pairs(res.tests) do
for i, test in ipairs(v.tests) do
local wDynCol = test.res[1]
@/lua/ge/extensions/editor/cosimulationSignalEditor.lua
-- if im.BeginCombo("##ModeDropdown", modes[currentMode[0] + 1]) then
-- for j, mode in ipairs(modes) do
-- if im.Button(mode) then
@/lua/ge/extensions/gameplay/markerInteraction.lua
for _, attKey in ipairs(additionalAttributesSortedKeys) do
local att = additionalAttributes[attKey]
end
for _, customAtt in ipairs(m.customAdditionalAttributes or {}) do
table.insert(info.additionalAttributes, customAtt)
if not currentInteractableElements then return end
for _, m in ipairs(currentInteractableElements or {}) do
if m.missionId then
table.sort(activityData, sortActivityData)
--for _, a in ipairs(activityData) do
-- dump(a.heading, (a.sorting and a.sorting.type) or "no type", a.sorting)
local anyMarkerIsInAreaChanged = false
for i, cluster in ipairs(gameplay_playmodeMarkers.getPlaymodeClusters()) do
local marker = gameplay_playmodeMarkers.getMarkerForCluster(cluster)
else
for _, decal in ipairs(marker.groundDecalData) do
decalCount = decalCount + 1
table.clear(currentInteractableElements)
for i, elem in ipairs(interactableElements) do
currentInteractableElements[i] = elem
-- Set all markers forceVisible to false
for i, cluster in ipairs(gameplay_playmodeMarkers.getPlaymodeClusters()) do
if string.startswith(cluster.id, "missionMarker") then
@/lua/ge/extensions/scenario/raceMarkers/cylinderMarker.lua
function C:clearMarkers()
for _, id in ipairs(self._ids or {}) do
local obj = scenetree.findObjectById(id)
@/lua/ge/extensions/career/modules/milestones/milestones.lua
table.clear(claimFunctions)
for i, elem in ipairs(list) do
elem.claimId = i
M.saveData.unclaimedMilestonesCount = 0
for _, milestone in ipairs(list) do
milestone.filter = milestone.filter or {missingFilter=true}
@/lua/vehicle/controller/drivingDynamics/actuators/electronicDiffLock.lua
turningCircleRatioOutput1 = 0
for _, wheel in ipairs(relevantWheels[-1].wheels) do
turningCircleRatioOutput1 = turningCircleRatioOutput1 + turningCircleSpeedRatios[wheel.name]
turningCircleRatioOutput2 = 0
for _, wheel in ipairs(relevantWheels[1].wheels) do
turningCircleRatioOutput2 = turningCircleRatioOutput2 + turningCircleSpeedRatios[wheel.name]
brakingCoefSmooth = min(brakingCoefSmooth, M.overrideMax)
for _, wd in ipairs(relevantWheels[diffSideToBrake].wheels) do --todo simple loop
if not wd.isBroken then
@/lua/ge/extensions/core/groundMarkers.lua
if M.debugPath then
for i, wp in ipairs(M.routePathTmp or {}) do
debugDrawer:drawSphere(vec3(wp), 0.25, ColorF(1, 0.4, 1,0.2))
end
for i, e in ipairs(M.routePlanner.path) do
debugDrawer:drawSphere(vec3(e.pos), 1, ColorF(0.23, 0.4, 0.1,0.6))
local id = 1
for i, e in ipairs(M.routePlanner.path) do
data.markers[id] = e.pos.x
table.insert(multiPath, vehiclePos)
for _, w in ipairs(M.endWP) do
if type(w) == 'string' then
@/lua/ge/extensions/util/docCreator.lua
for _, level in ipairs(levels) do
if type(level.size) == 'table' and #level.size > 1 then
local inputmapPaths = FS:findFiles('/settings/inputmaps/', '*.json', -1, true, false)
for _,inputmapPath in ipairs(inputmapPaths) do
local out = jsonReadFile(inputmapPath)
-- detect if ffb is enabled on this configuration
for _,binding in ipairs(out.bindings or {}) do
if binding.action == "steering" and binding.isForceEnabled then
end
for _,displayName in ipairs(info.displayNames) do
table.insert(names, displayName)
for _,name in ipairs(names) do
local e = deepcopy(entry)
for _, lang in ipairs(getLanguagesAvailable()) do
exportDataLangSpecific(job, lang)
@/lua/ge/extensions/gameplay/traffic.lua
if not ignoreAdjust then
for _, veh in ipairs(getAllVehiclesByType()) do
if veh.isParked ~= 'true' and veh:getActive() then
vehIds = vehIds or trafficAiVehsList -- all AI-controlled traffic by default
for _, id in ipairs(vehIds) do
forceTeleport(id, nil, nil, minDist, maxDist)
if idList then
for _, id in ipairs(idList) do
vehPool:insertVeh(id)
for _, id in ipairs(pool.inactiveVehs) do
if traffic[id] then
for _, id in ipairs(trafficAiVehsList) do
local veh = traffic[id]
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
for _, id in ipairs(vehList) do
if type(id) == 'number' then
local function deactivate(stopAi) -- deactivates traffic mode for all vehicles
for _, id in ipairs(tableKeysSorted(traffic)) do
removeTraffic(id, stopAi)
local aiVehsListSize = #trafficAiVehsList
for i, id in ipairs(trafficIdsSorted) do -- ensures consistent order of vehicles
vehCount = vehCount + 1
end
for _, veh in ipairs(getAllVehiclesByType()) do -- check for player vehicles to insert into traffic
checkPlayer(veh:getId())
@/lua/ge/extensions/editor/rallyEditor/measurementsTab.lua
local serializedPoints = {}
for i, point in ipairs(measurement.points) do
-- Store only position, convert vec3 to table
local deserializedPoints = {}
for i, point in ipairs(measurement.points or {}) do
-- Convert table to vec3
-- Draw points
for i, point in ipairs(measurement.points) do
local pos = point
if measurement.points and #measurement.points > 0 then
for i, point in ipairs(measurement.points) do
local dist = (point - mousePos):length()
for i, point in ipairs(points) do
local isPointSelected = i == self.selectedPointIndex
@/lua/ge/extensions/career/modules/insurance/history.lua
}
for _, historyEntry in ipairs(plHistory) do
if historyEntry.type == type then
-- effects contains {type = "money", label = "Money", changedBy = -amount, newValue = ...}
for _, effect in ipairs(historyEntry.effects or {}) do
if effect.type == "money" and effect.changedBy then
local total = 0
for _, historyEntry in ipairs(plHistory) do
if historyEntry.type == "insuranceRepairClaim" and historyEntry.other and historyEntry.other.deductible then
local totalDamageCost = 0
for _, historyEntry in ipairs(plHistory) do
if historyEntry.type == "insuranceRepairClaim" and historyEntry.other and historyEntry.other.vehDamagePrice then
@/lua/ge/extensions/util/trackBuilder/proceduralPrimitives.lua
local outerCenter = vec3(0,math.sin(-outerRad) * radius,math.cos(-outerRad)*radius)
for j,p in ipairs(innerRing) do
local n = quat:__mul(p.v)
for i = 0, #oldVertices-1 do vertexLookUp[i] = {} end
for i,t in ipairs(oldTriangles) do
local mid = {}
local verts = {}
for i,v in ipairs(vertexList) do
normals[i] = {x = v.x, y = v.y, z=v.z}
local faces = {}
for i,t in ipairs(triangleList) do
for x = 1,3 do
@/lua/ge/extensions/flowgraph/nodes/scene/singleMarker.lua
local t = {}
for _, v in ipairs(markerTypes) do
table.insert(t, {value = v})
@/lua/ge/extensions/career/modules/computer.lua
for _, inventoryId in ipairs(inventoryIds) do
local vehicleData = {}
local vehiclesForUI = deepcopy(menuData.vehiclesInGarage)
for i, vehicleData in ipairs(vehiclesForUI) do
vehicleData.thumbnail = career_modules_inventory.getVehicleThumbnail(vehicleData.inventoryId) .. "?" .. (vehicleData.dirtyDate or "")
@/lua/vehicle/controller/drivingDynamics/actuators/activeDiffLock.lua
turningCircleRatioOutput1 = 0
for _, wheel in ipairs(relevantWheels[-1].wheels) do
turningCircleRatioOutput1 = turningCircleRatioOutput1 + turningCircleSpeedRatios[wheel.name]
turningCircleRatioOutput2 = 0
for _, wheel in ipairs(relevantWheels[1].wheels) do
turningCircleRatioOutput2 = turningCircleRatioOutput2 + turningCircleSpeedRatios[wheel.name]
@/lua/vehicle/extensions/escMeasurement.lua
local function combineTestData()
-- for _, v in ipairs(measurementsTest1) do
-- data[v.speed] = data[v.speed] or {}
@/lua/ge/extensions/ui/vehicleSelector/tileClustering.lua
local sources = getSources(config, model.model, true)
for _, source in ipairs(sources) do
sourcesByIconCount[source] = (sourcesByIconCount[source] or 0) + 1
local sourceIcons = {}
for _, source in ipairs(sources) do
if string.endswith(source, ".svg") then
local sources = getSources(config, model.model, true)
for _, source in ipairs(sources) do
sourcesByIconCount[source] = (sourcesByIconCount[source] or 0) + 1
local sourceIcons = {}
for _, source in ipairs(sources) do
if string.endswith(source, ".svg") then
@/lua/ge/extensions/editor/vehicleEditor/veToolbar.lua
if im.BeginMenu("Layouts", imgui_true) then
for _, layoutPath in ipairs(editor_layoutManager.getWindowLayouts(vEditor.getEditorName())) do
if im.MenuItem1(string.match(layoutPath, ".+/(.+)"), nil, imgui_false, imgui_true) then
if editor.beginWindow(deleteLayoutWindowName, deleteLayoutWindowTitle) then
for _, layoutPath in ipairs(editor_layoutManager.getWindowLayouts(vEditor.getEditorName())) do
if im.MenuItem1(string.match(layoutPath, ".+/(.+)"), nil, imgui_false, imgui_true) then
if im.BeginMenu("Apps") then
for _, item in ipairs(vEditor.staticMenuItems.items) do
if item.group then
if im.BeginMenu("Apps") then
for _, item in ipairs(vEditor.liveMenuItems.items) do
if item.group then
if im.BeginMenu("Spawn") then
for k, vehData in ipairs(vehsList) do
if im.MenuItem1(vehData.model.key) then
for k, veh in ipairs(currVehs) do
local name = veh:getJBeamFilename() .. " (" .. veh:getID() .. ")"
local currVehs = getAllVehicles()
for k, veh in ipairs(currVehs) do
veh:delete()
for k, vehItem in ipairs(core_vehicles.getVehicleList().vehicles) do
if vehItem.model.Type == 'Car' or vehItem.model.Type == 'Truck' then
for k,v in ipairs(keysSorted) do
table.insert(vehsList, unsortedList[v])
@/lua/ge/extensions/ui/gridSelectorUtils/tilesModule.lua
if model and model.model and model.model.default_pc then
for _, tile in ipairs(group.tiles) do
if tile.config_key == model.model.default_pc then
if overrideDefaultSelectedTile then
for _, tile in ipairs(group.tiles) do
if tile.config_key == overrideDefaultSelectedTile.key then
local rangeGroups = groupingModule.getRangeGroupingFunction(groupMode)(value)
for _, group in ipairs(rangeGroups) do
validGroups[group.groupName] = true
@/lua/ge/extensions/freeroam/bigMapPoiProvider.lua
-- Set all default groups to visible
for _, groupKey in ipairs(defaultGroups) do
groupVisibilityState[groupKey] = true
if cachedGroupData then
for _, filter in ipairs(cachedFilters) do
for _, groupKey in ipairs(filter.groups) do
for _, filter in ipairs(cachedFilters) do
for _, groupKey in ipairs(filter.groups) do
if groupKey.visible then
if groupKey.visible then
for _, poiId in ipairs(groupKey.elements) do
table.insert(poiIds, poiId)
local icons = {money = 'beamCurrency', beamXP = 'beamXP', vouchers = 'voucherHorizontal3'}
for _, branch in ipairs(career_branches.getSortedBranches()) do
icons[branch.id] = branch.icon
for _, branch in ipairs(career_branches.getSortedBranches()) do
if branch and not branch.isDomain then
local distLabel = 'veryClose'
for _, filter in ipairs(distanceFilter) do
if filterData.sortingValues['distance'] >= filter[1] then
local distLabel = 'veryClose'
for _, filter in ipairs(distanceFilter) do
if filterData.sortingValues['distance'] >= filter[1] then
gameplay_rawPois.clear()
for _, poi in ipairs(gameplay_rawPois.getRawPoiListByLevel(level)) do
if poi.markerInfo.bigmapMarker then
local elementsAsPois = {}
for i, id in ipairs(gr.elements) do elementsAsPois[i] = poiData[id] end
table.sort(elementsAsPois,gameplay_missions_unlocks.depthIdSort)
table.sort(elementsAsPois,gameplay_missions_unlocks.depthIdSort)
for i, poi in ipairs(elementsAsPois) do gr.elements[i] = elementsAsPois[i].id end
end
}
for _, groupKey in ipairs(tableKeysSorted(groupData)) do
if string.startswith(groupKey,'missionType_') then
local domainFilters = {}
for _, domainId in ipairs(branchOrdered) do
local domain = career_branches.getBranchById(domainId)
for _, branchId in ipairs(branchOrdered) do
local branch = career_branches.getBranchById(branchId)
cachedFilters = {filterCareerPois}
for _, filter in ipairs(domainFilters) do
table.insert(cachedFilters, filter)
for _, lvl in ipairs(core_levels.getList()) do
if string.lower(lvl.levelName) == getCurrentLevelIdentifier() then
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
-- lo('?? nmat:'..#objects)
for _, obj in ipairs(objects) do
-- if true or U._PRD == 0 then lo('?? for_mat:'..tostring(obj.name)..':'..tostring(scenetree.findObject(obj.name))) end --..tostring(obj.doubleSided))
@/lua/ge/extensions/editor/raceEditor/tools.lua
for i, t in ipairs(transforms) do
local mode, obj = "none", "none"
local function setFieldsUndo(data)
for idx, _ in ipairs(data.oldDataMap) do
data.self.path.pathnodes.objects[idx][data.field] = data.oldDataMap[idx]
if im.BeginCombo('Rotation Mode', alignMode) then
for _, m in ipairs(alignModes) do
if im.Selectable1(m, m == alignMode) then
local transforms = pn:getSideTransforms(self:getSideTransformParameters())
for _, e in ipairs(transforms) do
if e then
end
for i, sp in ipairs(objects.sorted) do
if im.Selectable1('#'..i .. " - " .. sp.name, value == sp.id) then
@/lua/ge/extensions/editor/flowgraphEditor.lua
main:attach(mgr)
for _,win in ipairs(windows) do
win:attach(mgr)
local noneOpen = true
for _,w in ipairs(windows) do noneOpen = noneOpen and not editor.isWindowVisible(w.windowName) end
if noneOpen then
--print("previous mgr is " .. M.previousMgrName)
for _, m in ipairs(fgMgr.getAllManagers()) do
if not done and m.name == M.previousMgrName then
else
for idx, file in ipairs(recentFiles) do
if FS:fileExists(file) then
local filesByOriginal = {}
for _, fileName in ipairs(allFiles) do
local file = jsonReadFile(fileName)
restoreFiles = {names = originalFileNames, filesByName = filesByOriginal, newest = {}}
for idx, name in ipairs(restoreFiles.names) do
for idx, elem in ipairs(restoreFiles.filesByName[name].list) do
for idx, name in ipairs(restoreFiles.names) do
for idx, elem in ipairs(restoreFiles.filesByName[name].list) do
if #restoreFiles.newest < 5 then
else
for idx, elem in ipairs(restoreFiles.newest) do
if im.MenuItem1(idx.." - " ..elem.shortName.." - " .. elem.dateFormatted) then
im.Separator()
for i, name in ipairs(restoreFiles.names) do
if im.BeginMenu(name..'##restore'..i) then
if im.BeginMenu(name..'##restore'..i) then
for idx, elem in ipairs(restoreFiles.filesByName[name].list) do
if im.MenuItem1(idx.." - " .. elem.dateFormatted) then
table.sort(stateIds)
for _, id in ipairs(stateIds) do
im.BulletText(mgr.states.states[id].name)
if M.windowOpenInfo then
for _, win in ipairs( windows) do
if M.windowOpenInfo[win.windowName] then
local index = 0
for i, m in ipairs(fgMgr.getAllManagers()) do
if m == mgr then
ui_flowgraph_editor.SetCurrentEditor(M.ectx)
for _, m in ipairs(fgMgr.getAllManagers()) do
m:updateNodePositions()
res.windows = {}
for _, win in ipairs(windows) do
res.windows[win.windowName] = editor.isWindowVisible(win.windowName)
im.Text(tostring(tableSize(sortedNames)) .. " Custom Lua Nodes:")
for _, name in ipairs(sortedNames) do
if editor.uiIconImageButton(editor.icons.delete, im.ImVec2(20, 20)) then
local function windowsMenu()
for _, win in ipairs(windows) do
if win.windowName and win.windowDescription then
if im.MenuItem1("Open All") then
for _, win in ipairs(windows) do
win:open()
if im.MenuItem1("Close All") then
for _, win in ipairs(windows) do
win:close()
M.open()
--for _, win in ipairs( windows) do
-- win:open()
local winReferences = nil
for _, win in ipairs( windows) do
if win.windowName == 'fg_references' then
nodeA = node
for _, pin in ipairs(node.pinList) do
local link = pin:getFirstConnectedLink()
for _, pinB in ipairs(availableB) do
local matches = {}
local matches = {}
for _, pinA in ipairs(availableA) do
if mgr.graph:canCreateLink(pinA, pinB) then
end
for _, link in ipairs(linksToRemove) do
mgr.graph:deleteLink(link)
if list and list.active then
for _, e in ipairs(list.active) do
if e.name == map.."ActionMap" and e.enabled then
@/lua/ge/extensions/editor/missionEditor/dev.lua
if im.BeginCombo('##mode',self.mission.devNotes.mode) then
for _, mode in ipairs(modes) do
if im.Selectable1(mode,mode == self.mission.devNotes.mode) then
@/lua/ge/extensions/editor/roadTemplateEditor.lua
local clearSelection = false
for _, id in ipairs(decalRoads) do
editor.deleteRoad(id)
end
for _, id in ipairs(decorations) do
scenetree.findObjectById(id):deleteObject()
end
for _, id in ipairs(decals) do
editor.deleteRoad(id)
data.decals = {}
for i, id in ipairs(decalRoads) do
local roadInfo = {}
for i, id in ipairs(decorations) do
local decoInfo = {}
local decoObject = scenetree.findObjectById(id)
for _, field in ipairs(decoObject:getDynamicFields()) do
decoInfo[field] = decoObject:getField(field, "")
for i, id in ipairs(decals) do
local decalInfo = {}
local roadNames = {}
for i, id in ipairs(decalRoads) do
local name = editor.getFieldValue(id, "Material")
local decoNames = {}
for i, id in ipairs(decorations) do
local shapePath = editor.getFieldValue(id, "shapeName")
local cloneID = createDecoObject()
for _, field in ipairs(selectedDeco:getDynamicFields()) do
editor.setDynamicFieldValue(cloneID, field, editor.getFieldValue(selectedDeco:getID(), field))
local decalNames = {}
for i, id in ipairs(decals) do
local name = editor.getFieldValue(id, "Material")
@/lua/ge/extensions/editor/sitesEditor/parkingSpots.lua
function C:setSites(sites)
for _, ps in ipairs(sites.parkingSpots.sorted) do -- fixes rotations due to auto rotation adjustments of multispots
if ps.rotOrig then
if im.BeginCombo("##spotDirectionSelect", self.multiSpotData.spotDirection) then
for _, dir in ipairs({ "Left", "Right", "Front", "Back" }) do
if im.Selectable1(dir) then
@/lua/ge/extensions/util/maptiles.lua
for _, tile in ipairs(tilePositions) do
local x = cursorPos.x + tile.xIndex * cellWidth
@/lua/ge/extensions/flowgraph/modules/threadModule.lua
function C:onFlowgraphManagerPreUpdate()
for _, message in ipairs(self.messages) do
if message.hook then
function C:executionStopped()
for _, childData in ipairs(self.children) do
local fgId = childData.fgId
@/lua/ge/extensions/gameplay/rally/geometry.lua
-- get severity (based on velocity)
for severityId,severity in ipairs(severities) do
if n.vel < severity.velmax then
local slowestNode = origSlowestNode
for _,n in ipairs(pacenote.nodes) do
pacenote.time = pacenote.time + n.time
if pacenote.slowestNode.direction == pacenoteNext.slowestNode.direction then
for _,node in ipairs(pacenoteNext.nodes) do
nodesMoved = nodesMoved + 1
local color = slowestNode.severity.color
for i,node in ipairs(pacenote.nodes) do
if i == 1 then
local iClosest, jClosest, distClosest = nil, nil, 1e30
for i,pacenote in ipairs(pacenotes) do
for j,node in ipairs(pacenote.nodes) do
for i,pacenote in ipairs(pacenotes) do
for j,node in ipairs(pacenote.nodes) do
local dist = currentPosition:squaredDistance(node.pos)
local function renderAllPacenotes(pacenotes, showNodes)
for i,pacenote in ipairs(pacenotes) do
for j,node in ipairs(pacenote.nodes) do
for i,pacenote in ipairs(pacenotes) do
for j,node in ipairs(pacenote.nodes) do
if showNodes then
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamVariablesChecker.lua
if configsAndVals then
for k, configAndVal in ipairs(configsAndVals) do
local pcFilePath = configAndVal.pcFilePath
for _, vehDir in ipairs(dirPaths) do
local pcFilePaths = FS:findFiles(vehDir, "*.pc", -1, false, false)
for _, pcFilePath in ipairs(pcFilePaths) do
local vehConfig = extensions.core_vehicle_partmgmt.buildConfigFromString(vehDir, pcFilePath)
for _, jbeamFilePath in ipairs(jbeamFilePaths) do
local dir, fileName, _ = path.splitWithoutExt(jbeamFilePath)
@/lua/ge/extensions/flowgraph/nodes/math/math.lua
local currentTemplate = nil
for _, template in ipairs(self.templateExpressions) do
if template.expression == expr then
if im.BeginCombo("##templateExpressions", currentTemplate and currentTemplate.name or "Custom Expression") then
for _, template in ipairs(self.templateExpressions) do
if im.Selectable1(template.name, template.expression == expr) then
im.Text(currentTemplate.description)
for _, pin in ipairs(currentTemplate.pinInfo) do
self.mgr:DrawTypeIcon(pin.type, true, 1)
if self.data.safeMode then
for _, p in ipairs(self.activePinList or {}) do
if self.pinIn[p].value == nil then return end
@/lua/ge/extensions/core/input/actionFilter.lua
local template = {}
for _, entry in ipairs(templateNames) do
if actionTemplates[entry] then
else
for _, actionName in ipairs(actionTemplates[entry]) do
if not tableContains(actionWhitelist, actionName) then
if type(actionGroups[actionName]) == 'table' then
for i, a in ipairs(actionGroups[actionName]) do
ActionMap.addToFilter(filter, a, filtered )
@/lua/ge/extensions/core/settings/graphic.lua
local adapters = GFXInit.getAdapters()
for _,adapter in ipairs(adapters) do
if gpu ~= '' and adapter.gpu == gpu then return gpu end
local adapters = GFXInit.getAdapters()
for _,adapter in ipairs(adapters) do
if gfx ~= '' and adapter.gfx == gfx then return gfx end
graphicInformation.outputs = {}
for k, a in ipairs(adapters) do
if a.gpu == graphicInformation.gpu and a.gfx == graphicInformation.api then
local modes = o.GraphicDisplayModes.getModes()
for _,v in ipairs(modes.keys) do
if current == v then
for k, vm in ipairs(videoModeList) do
local key = getKey(vm)
local modes = o.GraphicDisplayResolutions.getModes()
for _,v in ipairs(modes.keys) do
if current == v then
local found = false
for _,v in ipairs(refreshRates.keys) do
if o.GraphicDisplayRefreshRates.hertz == v then
local videoModeList = GFXDevice.getDisplayVideoModes(o.GraphicDisplayDriver.get():gsub("/","\\"))
for k, vm in ipairs(videoModeList) do
if vm.width == resolutionWidth and vm.height == resolutionHeight then
local modes = o.GraphicDisplayRefreshRates.getModes()
for _,v in ipairs(modes.keys) do
if current == v then
local adapters = GFXInit.getAdapters()
for i, a in ipairs(adapters) do
if a.output == value then
local adapters = GFXInit.getAdapters()
for k, a in ipairs(adapters) do
if a.gpu == currentGPU and a.gfx == currentGFX then
local adapters = GFXInit.getAdapters()
for k, a in ipairs(adapters) do
if a.gpu == newGPU then
local adapters = GFXInit.getAdapters()
for k, a in ipairs(adapters) do
if not gpus[a.gpu] then
local matchFound = true
for _, presetKey in ipairs(presetKeys) do
local current = o[presetKey].get()
@/lua/vehicle/extensions/vehicleStatsLogger.lua
local line = "\n"
for statID, stat in ipairs(record[moduleID]) do
if settings.useStat[moduleID][statID] then
local header = ""
for _, stat in ipairs(record[moduleID]) do
header = header .. stat.csvDescription .. csvSeparator
for statID, _ in ipairs(record[moduleID]) do
settings.useStat[moduleID][statID] = true
for statID, stat in ipairs(record[moduleID]) do
local useStat = s.useStat[moduleID][stat.jsonID]
for statID, stat in ipairs(record[moduleID]) do
local useStat = settings.useStat[moduleID][stat.jsonID]
@/lua/ge/extensions/ui/apps/minimap/route.lua
if next(routeOverrides) then
for _, route in ipairs(routeOverrides) do
drawRoute(route, td, dpi)
@/lua/ge/extensions/career/modules/marketplace.lua
local function findVehicleListing(inventoryId)
for _, listing in ipairs(listedVehicles) do
if listing.id == inventoryId then
local timestamp = os.time()
for _, entry in ipairs(vehicles) do
local inventoryId = entry.inventoryId
local function removeVehicleListing(inventoryId)
for i, listing in ipairs(listedVehicles) do
if listing.id == inventoryId then
local function acceptOffer(inventoryId, offerIndex)
for i, listing in ipairs(listedVehicles) do
if listing.id == inventoryId then
local function deleteOffer(inventoryId, offerIndex)
for i, listing in ipairs(listedVehicles) do
if listing.id == inventoryId then
local count = 0
for _, listing in ipairs(listedVehicles) do
count = count + #listing.offers
for _, listing in ipairs(listedVehicles) do
if not listing.timeOfNextOffer then
local listingsCopy = deepcopy(listedVehicles)
for i, listing in ipairs(listingsCopy) do
local currentValue = career_modules_valueCalculator.getInventoryVehicleValue(listing.id)
for _, offer in ipairs(listing.offers) do
if offer.expiredViewCounter then
local expiredOffersCount = 0
for i, listing in ipairs(listedVehicles) do
for offerIndex = #listing.offers, 1, -1 do
@/lua/ge/extensions/core/metrics.lua
local bg = ColorI(64, 64, 64, 0.9*255)
for i,line in ipairs(lines) do
debugDrawer:drawTextAdvanced(pos, line, fg, true, true, bg)
@/lua/ge/extensions/editor/shortcutLegend.lua
if editor.editMode and editor.editMode.actionMap then
for _,device in ipairs(extensions.core_input_bindings.bindings) do
if device.devname == "keyboard0" or device.devname == "mouse0" then
if device.devname == "keyboard0" or device.devname == "mouse0" then
for _, binding in ipairs(device.contents.bindings) do
local actionmap = extensions.core_input_actions.getActiveActions()[binding.action].actionMap
local completeNeededSpace = 0
for _, action in ipairs(compoundedActionInfos) do
local controlName = prettyNames[action.control] or action.control
for _, action in ipairs(compoundedActionInfos) do
local restOfSpace = im.GetContentRegionAvailWidth()
@/lua/ge/extensions/editor/sitesEditor/sortedListDisplay.lua
for _, o in pairs(self.objects) do
for _, tag in ipairs(o.customFields.sortedTags) do
if not self.currTags[tag] then
o._drawMode = 'normal'
for _, s in ipairs(self.selections) do
if o.id == s then
-- go through all selections
for _, id in ipairs(self.selections) do
-- go through all their tags
for _, tag in ipairs(self.objects[id].customFields.sortedTags) do
-- check if all selections share this tag
for _, compareId in ipairs(self.selections) do
if not tableContains(self.objects[compareId].customFields.sortedTags, tag) then
local function setFieldUndo(data)
for _, id in ipairs(data.sel) do
data.objects[id][data.field] = data.old
local function setFieldRedo(data)
for _, id in ipairs(data.sel) do
data.objects[id][data.field] = data.new
local remove = nil
for i, obj in ipairs(self.sorted) do
if not obj.isProcedural and ((filter == nil) or (filter and string.find(string.lower(obj.name), filter) or self.currentElement == obj)) then
local remove
for i, name in ipairs(fields.names) do
if fields.types[name] == 'string' then
if editEnded[0] then
for _, id in ipairs(self.selections) do
self.objects[id].customFields.values[name] = ffi.string(self.fields[name])
if editEnded[0] then
for _, id in ipairs(self.selections) do
self.objects[id].customFields.values[name] = (self.fields[name])[0]
if remove then
for _, id in ipairs(self.selections) do
self.objects[id].customFields:remove(remove)
if im.Button("New String") then
for _, id in ipairs(self.selections) do
self.objects[id].customFields:add(ffi.string(self.addFieldText), 'string', "value")
if im.Button("New Number") then
for _, id in ipairs(self.selections) do
self.objects[id].customFields:add(ffi.string(self.addFieldText), 'number', 0)
--local cfData = fields:onSerialize()
--for _, o in ipairs(self.sorted) do
--o.customFields:onDeserialized(cfData)
if removeTag then
for _, id in ipairs(self.selections) do
self.objects[id].customFields:removeTag(removeTag)
for _, id in ipairs(self.selections) do
self.objects[id].customFields:addTag(tag)
@/lua/ge/extensions/gameplay/missions/locationsDetector.lua
if p then p:add("getMissionsAtLocation") end
for _, cluster in ipairs(gameplay_missions_clustering.getAllClusters(freeroam_bigMapMode.bigMapActive() and freeroam_bigMapMode.clusterMergeRadius)) do
if defaultLocationCheck(cluster, level, playerPosition) then
if defaultLocationCheck(cluster, level, playerPosition) then
for i, mId in ipairs(cluster.containedIds) do
table.insert(nearbyLocations.missions, {type = cluster.elemData[i].type, mission = gameplay_missions_missions.getMissionById(cluster.elemData[i].missionId), location = cluster, id = mId})
--[[
for _,mission in ipairs(gameplay_missions_missions.get()) do
local isNearby = false
if accessible and gameplay_missions_missionManager.isVisible(mission) and not gameplay_missions_missionManager.isOngoing(mission) then
for _,location in ipairs(gameplay_missions_missions.getLocations(mission)) do
isNearby = location.check(location, level, playerPosition, mission)
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veVehicleSpawner.lua
local function despawnVehicles()
for _, vehData in ipairs(vehsData) do
vehData.veh:delete()
table.clear(vehsList)
for k, vehItem in ipairs(core_vehicles.getVehicleList().vehicles) do
if vehItem.model.Type == 'Car' or vehItem.model.Type == 'Truck' then
@/lua/ge/server/server.lua
local jsonFilesToLoad = {}
for _, filename in ipairs(foundfiles) do
if string.find(filename, 'datablocks.json') then
@/lua/ge/extensions/flowgraph/modules/missionReplayModule.lua
local result = {}
for i, file in ipairs(FS:findFiles(dir, '*.rpl', 0, false, false)) do
table.insert(orderedReplays, {date = FS:stat(file).createtime, file = file})
table.sort(orderedReplays, function(a,b) return a.date < b.date end)
for i, file in ipairs(orderedReplays) do
table.insert(result, file.file)
local totalSize = 0
for i, file in ipairs(files) do
totalSize = totalSize + getFileSize(file) / 1000000
end
for i, file in ipairs(files) do
if totalSize < settings.getValue('maxSizeReplayCapMode') then return end
-- Check if current replay file exists in mission replays
for _, replayInfo in ipairs(currentMissionReplayFiles) do
if replayInfo.replayFile == state.loadedFile then
@/lua/ge/extensions/gameplay/rally/recce.lua
for _,point in ipairs(self.cuts) do
local pos = point.pos
-- Draw the wheels
for _, wheelPos in ipairs(wheelPositions) do
local worldWheelPos = toWorldPosition(wheelPos[2])
for i,cut in ipairs(self.cuts) do
local note = cut.transcript.text
@/lua/ge/extensions/editor/dynamicDecals/textures.lua
local sel = editor.selection["dynamicDecalTexture"]
for _, filePath in ipairs(filePaths) do
if not tableContains(sel, filePath) then
for _, filePath in ipairs(sel) do
if textures.sidecarFileExists(filePath) then
for k,v in ipairs(texturesFiles) do
if sel[1] == v then a = k end
for k, filePath in ipairs(textureFilePaths) do
-- im.SeparatorText("Tags")
-- for _, tag in ipairs(tags) do
-- im.TextUnformatted(string.format("%s [%d]", tag, #tagsWithReferences[tag]))
-- im.SeparatorText("Tags With References")
for _, tag in ipairs(tags) do
if im.TreeNodeEx1(string.format("%s [%d]##BrowserTagsTab", tag, #tagsWithReferences[tag])) then
for k, tag in ipairs(bulkChangeTemplate.tags) do
if editor.uiIconImageButton(editor.icons.delete, tool.getIconSizeVec2(), nil, nil, nil, "DynamicDecals_Browser_Textures_BulkChange_RemoveTextureTag") then
if im.Button("Apply##dynDecalTexturesInspector_bulkChange") then
for _, f in ipairs(sel) do
selectedTexturesSidecarContent[f].type = bulkChangeTemplate.type
im.BeginChild1("dynDecalTexturesInspector_Child", nil, true)
for _, file in ipairs(sel) do
if selectedTexturesSidecarContent and selectedTexturesSidecarContent[file] and im.TreeNodeEx1(file .. "##dynamicDecalTextureInspector", im.TreeNodeFlags_DefaultOpen) then
im.NextColumn()
for k, tag in ipairs(selectedTexturesSidecarContent[file].tags) do
if editor.uiIconImageButton(editor.icons.delete, tool.getIconSizeVec2(), nil, nil, nil, "DynamicDecals_Browser_Textures_RemoveTextureTag_" .. file) then
im.Indent()
for _, file in ipairs(missingSidecarFiles) do
if im.SmallButton("Select##DynamicDecalsTextures_" .. file) then
im.Indent()
for _, file in ipairs(missingSidecarFiles) do
if im.SmallButton("Select##DynamicDecalsTextures_" .. file) then
if editor.selection["dynamicDecalTexture"] then
for k, path in ipairs(editor.selection["dynamicDecalTexture"]) do
if path == filepath then
@/lua/ge/extensions/ui/liveryEditor/resources.lua
for k, texture in ipairs(texturesApi.getTextureFiles()) do
local sidecarFile = texturesApi.readSidecarFile(texture)
M.getTexturesByCategory = function(category)
for key, textureCategory in ipairs(M.textures) do
if textureCategory.value == category then
@/lua/ge/extensions/ui/appSelector/general.lua
if app.types then
for _, t in ipairs(app.typesTranslated) do
if not filterByProp["Type"] then
if propName == "Type" then
for _, t in ipairs(options) do
table.insert(commonFilters, {propName, t})
-- Check filters
for _, filter in ipairs(validFilters or {}) do
if filter.propName == "Type" then
local anyEnabled = false
for _, t in ipairs(item.typesTranslated or {}) do
-- Check if this type is enabled in the filter
local categoryGroups = {}
for _, app in ipairs(items) do
local category = app.category or "General"
local categoryOrderLookup = {}
for i, cat in ipairs(categoryOrder) do
categoryOrderLookup[cat] = i
-- first add categories in specified order
for _, category in ipairs(categoryOrder) do
if categoryGroups[category] then
for _, category in ipairs(remainingCategories) do
table.insert(sortedGroups, {
@/lua/ge/extensions/editor/dynamicDecals/notification.lua
if im.CollapsingHeader1(string.format("%s##NotificationSection", sectionName), im.TreeNodeFlags_DefaultOpen) then
for k, notification in ipairs(sectionData) do
if editor.uiIconImageButton(editor.icons.delete, im.ImVec2(tool.getIconSize(), tool.getIconSize()), nil, nil, nil, string.format("%s_%d", sectionName, k)) then
@/lua/ge/extensions/editor/resourceChecker/resourceUtil.lua
local matTable = {}
for _, fn in ipairs(files) do
if abort(job) then return matTable end
if list then
for _,p in ipairs(list) do
count = count + 1
local objs = scenetree.getAllObjects()
for _, objName in ipairs(objs) do
local o = scenetree.findObject(objName)
if not tableIsEmpty(objects) then
for _, obj in ipairs(objects) do
if obj.___type == "class" then
job.sleep(0.001)
for _, fn in ipairs(materialFiles) do
if abort(job) then return end
log('I', '', 'parsing all materials file: ' .. tostring(fn))
for _, obj in ipairs(objects) do
if abort(job) then return end
if abort(job) then return end
for _, fn in ipairs(materialFiles) do
if abort(job) then return end
job.yield()
for _, obj in ipairs(objects) do
if abort(job) then return end
job.sleep(0.001)
for _, fn in ipairs(materialFiles) do
if abort(job) then return end
log('I', '', 'parsing all materials file: ' .. tostring(fn))
for _, obj in ipairs(objects) do
job.yield()
job.sleep(0.001)
for _, fn in ipairs(materialFiles) do
if abort(job) then return end
log('I', '', 'parsing all materials file: ' .. tostring(fn))
for _, obj in ipairs(objects) do
if job.progress < 50 then job.progress = job.progress + 0.001 end
local meshFiles = FS:findFiles(convertdata, "*.dae\t*.dts\t*.cdae\t*.cached.dts", -1, true, false)
for k,v in ipairs(meshFiles) do
local dir, basefilename, ext = path.splitWithoutExt(v)
job.sleep(0.001)
for i,v in ipairs(meshNames) do
if abort(job) then return end
job.sleep(0.001)
for _,v in ipairs(meshNames) do
if abort(job) then return end
job.sleep(0.001)
for _,v in ipairs(meshNames) do
if abort(job) then return end
join(prefabs, missionPrefabs)
for _, fn in ipairs(prefabs) do
if abort(job) then return end
local matTable = {}
for _, fn in ipairs(materialFiles) do
job.yield()
job.yield()
for _,b in ipairs(blacklist) do
if fn:find(b) then
end
for _, fn in ipairs(prefabs) do
if abort(job) then return end
join(prefabs, missionPrefabs)
for _, fn in ipairs(prefabs) do
if abort(job) then return end
job.yield()
for _,b in ipairs(blacklist) do
if v:find(b) then
local meshFiles = FS:findFiles(convertdata, "*.dds", -1, true, false)
for _, v in ipairs(meshFiles) do
if job.progress < 98 then job.progress = job.progress + 0.1 end
local s = {}
for _, p in ipairs(list or {}) do s[p] = true end
return s
local otherFiles = {}
for _, p in ipairs(allFiles or {}) do
if not (texSet[p] or meshSrcSet[p] or meshCacheSet[p] or terSet[p] or audSet[p] or dbSet[p]) then
local t = {}
for _, p in ipairs(files or {}) do
if abort(job) then return {} end
local allFilesSized = {}
local function appendAll(lst) for _,it in ipairs(lst or {}) do allFilesSized[#allFilesSized+1] = it end end
appendAll(texturesL); appendAll(meshSrcL); appendAll(meshCacheL)
end
for _, fn in ipairs(prefabs) do
if abort(job) then return end
local tsList = scenetree.findClassObjects('TSStatic') or {}
for _,name in ipairs(tsList) do
if abort(job) then return end
local list = scenetree.findClassObjects(className) or {}
for _,name in ipairs(list) do
if abort(job) then return end
if o then
for _,fld in ipairs(fields) do
local v = o:getField(fld,0)
local tsList = scenetree.findClassObjects('TSStatic') or {}
for _,name in ipairs(tsList) do
if abort(job) then return end
local tbList = scenetree.findClassObjects('TerrainBlock') or {}
for _,name in ipairs(tbList) do
if abort(job) then return end
local mr = scenetree.findClassObjects('MeshRoad') or {}
for _,name in ipairs(mr) do
if abort(job) then return end
@/lua/ge/extensions/util/terrainGenerator.lua
dir = dir or self.userDir
for _, map in ipairs(FS:findFiles(dir, '*heightMap.png', -1, false, true)) do
FS:removeFile(map)
end
for _, map in ipairs(FS:findFiles(dir, '*holeMap.png', -1, false, true)) do
FS:removeFile(map)
end
for _, map in ipairs(FS:findFiles(dir, '*layerMap_*.png', -1, false, true)) do
FS:removeFile(map)
if core_terrain.getTerrain() then
for _, m in ipairs(core_terrain.getTerrain():getMaterials()) do -- get all existing materials from terrain
if m:getInternalName() ~= 'warning_material' then -- always ignore warning material
for _, key in ipairs(keysSorted) do
local data = json[key]
for _, map in ipairs(materialTextureSetMaps) do
for _, prop in ipairs(materialTextureProperties) do
for _, map in ipairs(materialTextureSetMaps) do
for _, prop in ipairs(materialTextureProperties) do
local field = string.format(prop, map)
self.materialsToTextureMaps = {}
for i, key in ipairs(self.materials) do
self.materialsToTextureMaps[key] = false
for _, map in ipairs(FS:findFiles(self.userDir, '*_layerMap_*.png', -1, false, true)) do
local matName = string.match(map, 'layerMap_%d*_(.*)%.(%w*)$')
local processedMaterials = {}
for _, v in ipairs(self.textureMaps) do -- proper material order
table.insert(processedMaterials, v.material)
self.materials = deepcopy(processedMaterials)
for i, mat in ipairs(self.materials) do
terrain:addMaterial(mat, -1)
@/lua/ge/extensions/career/modules/milestones/generalMilestones/delivery.lua
milestones = career_modules_milestones_milestones
for _, config in ipairs(deliveryCounterConfigs) do
local milestoneConfig = {
for _, config in ipairs(parcelModConfigs) do
local milestoneConfig = {
M.onGeneralMilestonesSetupCallbacks = function()
for _, milestoneConfig in ipairs(milestoneConfigs) do
M.setNotificationTarget(milestoneConfig)
local function onDeliveryFacilityProgressStatsChanged()
for _, milestoneConfig in ipairs(milestoneConfigs) do
local step = milestones.saveData.general[milestoneConfig.id].notificationStep +1
@/lua/ge/extensions/career/modules/delivery/parcelMods.lua
local r = math.random()
--for _, modKey in ipairs(tableKeysSorted(modifiers)) do
for _, modKey in ipairs(tableKeysSorted(parcelTemplate.modChance)) do
--for _, modKey in ipairs(tableKeysSorted(modifiers)) do
for _, modKey in ipairs(tableKeysSorted(parcelTemplate.modChance)) do
if r <= parcelTemplate.modChance[modKey] then
local function trackModifierStats(cargo)
for _, mod in ipairs(cargo.modifiers or {}) do
progress[mod.type] = progress[mod.type] or {}
unlocks[tier] = unlocks[tier] or {}
for _, value in ipairs(list) do
table.insert(unlocks[tier], {type="text", label = value})
@/lua/vehicle/thrusters.lua
local t
for _, thruster in ipairs(autoThrusters) do
local vel = -obj:getNodeVelocity(thruster.id2, thruster.id1)
for _, thruster in ipairs(thrusterState) do
-- applyForce(node1, node2, forceMagnitude)
table.clear(thrusterState)
for _, thruster in ipairs(activeThrusters) do
if thruster.control then
local function applyImpulse(n1, n2, force, dt)
for _, thruster in ipairs(impulseState) do
if thruster[1] == n1 and thruster[2] == n2 then
local n1, n2 = v.data.refNodes[0].ref, v.data.refNodes[0].back
for _, thruster in ipairs(impulseState) do
if thruster[1] == n1 and thruster[2] == n2 then
@/lua/common/extensions.lua
-- Note(AK): DO not mess with package tables e.g. package.preload
for _, searcher in ipairs(package.searchers or package.loaders) do
local state, loader = xpcall(function() return searcher(extPath) end, debug.traceback)
if m.dependencies then
for _, dname in ipairs(m.dependencies) do
if not resolvedNameToModule[dname] then
local toPrint = {}
for _, mname in ipairs(toResolveModules) do
local m = luaMods[mname]
if m.dependencies then
for _, dname in ipairs(m.dependencies) do
if not luaMods[dname] then
for fName, fList in pairs(luaExtensionFuncs) do
for i, _ in ipairs(fList) do
if useProfiledHooks then
-- Note(AK) 27/10/2020 IMPORTANT - call hooks all at once to prevent reloading modules that were previous unloaded
for _, extName in ipairs(extNames) do
local m = rawget(M, extName)
if knownChildExtensions then
for _, e in ipairs(knownChildExtensions) do
if e ~= m then
-- Note(AK) 27/10/2020 IMPORTANT - unload everything together to prevent ping pong loading of unloaded modules again
for _, extName in ipairs(extNames) do
local m = rawget(M, extName)
local found = false
for _,name in ipairs(extrasToUnloadModuleName) do
if name == extName then
for _,mName in ipairs(exceptionList) do
expandedExceptionDict[mName] = true
if m and m.dependencies then
for _, depName in ipairs(m.dependencies) do
if not expandedExceptionDict[depName] then
if m.dependencies then
for _, depName in ipairs(m.dependencies) do
-- log('I', logTag, 'Loading dependency for '..extName..': '..depName)
local function wrapAllExtensionsForProfiler()
for j, m in ipairs(resolvedModules) do
for name, value in pairs(m) do
local moduleDataArray = {}
for _,entry in ipairs({...}) do
if type(entry) == 'string' then
else
for _, v in ipairs(entry) do
if type(v) == 'string' then
local extPath
for _, extName in ipairs(moduleDataArray) do
if string.find(extName, "/") then -- loading from directory path
deserializedData = deserializedData or {}
for i, moduleName in ipairs(loadedFreshModules) do
-- Because modules can load other modules from within onExtensionLoaded, we do the nil clear to prevent reentrant issues
if vmType == 'game' then
for i, moduleName in ipairs(modulesToInit) do
if moduleName then
local processed = {}
for _, file in ipairs(filePaths) do
local skip = false
for _, file in ipairs(filePaths) do
-- find the lua module files now
local function hookSingleFrameProfiled(funcName, ... )
for _, m in ipairs(resolvedModules) do
if type(m) == "table" then
luaExtensionFuncs[funcName] = hookFuncs
for _, m in ipairs(resolvedModules) do
local func = m[funcName]
else
for _, funcInfo in ipairs(funcList) do
if not profileAllExtensionFunctions then profilerPushEvent(funcInfo.extCallName) end
local function hookDebug(funcName, ... )
for _, m in ipairs(resolvedModules) do
if type(m) == "table" then
luaExtensionFuncs[funcName] = hookFuncs
for _, m in ipairs(resolvedModules) do
local func = m[funcName]
else
for _, func in ipairs(funcList) do
func(...)
log("I", "", "Full list of loaded extensions:")
for j, m in ipairs(resolvedModules) do
log("I", "", " - ".. m.__extensionName__ .. " : " .. dumps(m.dependencies))
local hasHook = false
for _, m in ipairs(resolvedModules) do
if type(m) == "table" then
local exceptionDict = {}
for _,value in ipairs(exceptionList) do
exceptionDict[value] = true
for _, m in ipairs(resolvedModules) do
if not exceptionDict[m.__extensionsModulePath__] then
-- Try to make this table only hold unique entries, no duplicates
for _,entry in ipairs({...}) do
if type(entry) == 'string' then
else
for _, v in ipairs(entry) do
if type(v) == 'string' then
for _, v in ipairs(tempResolvedModules) do
local ignoreExtension = tableContains(doNotSerializeModules, v.__extensionName__)
for _, v in ipairs(tempResolvedModules) do
local k = v.__extensionName__
@/lua/ge/extensions/core/environment.lua
M.timeOfDayKeyToTime = {}
for _, v in ipairs(M.defaultTimeOfDayOptions) do
M.timeOfDayKeyToTime[v.key] = v.value
for _, name in ipairs(names) do
local newName = string.upper(name)
-- submit all other ground models afterwards in alphabetical order
for _, name in ipairs(sortedGmNames) do
submitGroundModel(name, gms[name])
local t = max(tempCurve[1][1], min(tempCurve[#tempCurve][1], tod.time))
for i, v in ipairs(tempCurve) do
if v[1] > t or i == #tempCurve then
@/lua/ge/extensions/career/modules/milestones/generalMilestones/speedTraps.lua
--[[
for _, trap in ipairs(speedTraps.getSpeedTrapsInCurrentLevel("speed")) do
local milestoneId = "velocityMilestone_" .. trap:getName()
@/lua/ge/extensions/flowgraph/nodes/mission/selectHeistMissionSpots.lua
--SPLIT THE SPOTS USING TAGS
for s,_ in ipairs(self.names) do
if string.find(self.spots.byName[self.names[s]].customFields.sortedTags[1], "start") then
@/lua/ge/extensions/util/compileMeshes.lua
local function isPathIgnored(filepath)
for _,i in ipairs(ignorePath)do
if string.startswith(filepath, i) then return true end
for i, v in ipairs(cmdArgs) do
if v == '-compileMeshesCustomPaths' then
@/lua/ge/extensions/c2/panelPlugins/vehicleManager.lua
if trafficIds then
for _, tid in ipairs(trafficIds) do
if tid == vehId then
local alreadyAdded = false
for _, d in ipairs(vehicleData) do
if d.id == veh:getID() then alreadyAdded = true break end
local targetVid = sub.vid or be:getPlayerVehicleID(0)
for _, d in ipairs(vehicleData) do
if d.id == targetVid then
@/lua/common/libs/luamqtt/mqtt/protocol4.lua
local payload = combine()
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "table", "expecting .subscriptions["..i.."] to be a table")
local payload = combine()
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "string", "expecting .subscriptions["..i.."] to be a string")
@/lua/ge/extensions/editor/decalSpline.lua
if im.BeginTabBar("decalComponentTabs") then
for _, compIdx in ipairs(enabledComponents) do
local tabName = "Comp "..tostring(compIdx)
@/lua/common/utils.lua
local h, r = v[1], v[k2]
for i, hv in ipairs(v[1]) do -- headers
r[hv] = r[i]
local lut = tableValuesAsLookupDict(set1)
for _, val in ipairs(set2) do
if not lut[val] then return false end
local lut = tableValuesAsLookupDict(dst)
for _,v in ipairs(src) do
if not lut[v] then
local srcByValue = table.new(0, #src)
for _, v in ipairs(src) do
srcByValue[v] = true
elseif vtype == 'table' then --tables
for k, v1 in ipairs(v) do
local vtype1 = type(v1)
--check actual datatypes for expected types and report potential issues
for k, expectedType in ipairs(expectedTypes) do
local isOptional = expectedType:sub(0,9) == "optional:"
-- process each batch: open all, then read and close all
for _, batch in ipairs(batches) do
profilerPushEvent("readFiles batch")
local ret = {}
for _, lvlPath in ipairs(FS:findFiles('/levels/', '*', 0, false, true)) do
table.insert(ret, string.lower(lvlPath:sub(9)))
@/lua/ge/extensions/editor/gen/mesh.lua
kid.kids[1].value = str
for i,a in ipairs(kid.attr) do
if a.name == 'count' then
end
for i,a in ipairs(kid.attr) do
-- lo('?? name:'.._..':'..kid.name..':'..a.name)
local imat = 0
for _,m in ipairs(kid.kids) do
if m.name == 'material' then
if m.attr ~= nil then
for i,a in ipairs(m.attr) do
if a.name == 'name' then
-- lo('?? for_TRI:'..#kid.kids..':'..#kid.attr) --..':'..#astr)
for i,a in ipairs(kid.attr) do
end
local imat = 0
for _,m in ipairs(kid.kids) do
if m.name == 'material' then
if m.attr ~= nil then
for i,a in ipairs(m.attr) do
if a.name == 'name' then
-- lo('?? for_TRI:'..#kid.kids..':'..#kid.attr) --..':'..#astr)
for i,a in ipairs(kid.attr) do
-- lo('?? for_attr:'..i..':'..tostring(a.name))
local astar = {}
for _,ie in ipairs(v4e[n2]) do
if dbg then U.dump(e4v[ie], '??***** for_edge:'..ie) end
if dbg then U.dump(e4v[ie], '??***** for_edge:'..ie) end
for i,n in ipairs(e4v[ie]) do
if n.ind == n2 then
--[[
for _,i in ipairs(e4v[ie]) do
if i.ind == iv then
-- U.lo('?? for_edge:'..i)
for k,n in ipairs(list) do
-- lo('?? if_n:'..k..':'..tostring(n.done == 0))
@/lua/ge/extensions/ui/extApp.lua
for _, evt in ipairs(events) do
--dump({"event: ", evt})
@/lua/ge/extensions/editor/api/forest.lua
local rotMtx = MatrixF(true)
for i, object in ipairs(editor.selection.forestItem) do
rotMtx:set(deltaEulerRotation, centerPoint)
@/lua/ge/extensions/editor/veMain.lua
for k,v in ipairs(temp.items) do
if v.group == currGroup then
for _, file in ipairs(luaFiles) do
local _, fn, _ = path.split(file)
for _, file in ipairs(staticLuaFiles) do
local _, fn, _ = path.split(file)
for _, file in ipairs(liveLuaFiles) do
local _, fn, _ = path.split(file)
for k,v in ipairs(extNames) do
table.insert(combinedExtNames, v)
end
for k,v in ipairs(staticExtNames) do
table.insert(combinedExtNames, v)
end
for k,v in ipairs(liveExtNames) do
table.insert(combinedExtNames, v)
-- Create Static Editor Apps Menu
for _, name in ipairs(staticExtNames) do
local ext = extensions[name]
end
for _, data in ipairs(externalStaticIMGUIs) do
entries[data.menuEntry] = data.open
for _, extMenuEntry in ipairs(sortedEntries) do
local extOpen = entries[extMenuEntry]
for _, name in ipairs(liveExtNames) do
local ext = extensions[name]
end
for _, data in ipairs(externalLiveIMGUIs) do
entries[data.menuEntry] = data.open
for _, extMenuEntry in ipairs(sortedEntries) do
local extOpen = entries[extMenuEntry]
@/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
for _, v in ipairs(suspectNodes) do
if v.couplerTag then
for _, v in ipairs(trailerNodes) do
if v.tag and v.tag == nodeTag then
@/lua/ge/extensions/flowgraph/modules/uiModule.lua
-- Process layout elements
for _, element in ipairs(self.uiLayout.layout) do
if element.pages then
local anyVisible = false
for _, star in ipairs(stars) do
star.order = star.globalStarIndex
star.rewards = change.starRewards.originalRewardsPerStar[star.key]
for _, reward in ipairs(star.rewards) do
reward.icon = career_branches.getBranchIcon(reward.attributeKey)
local rewardsStars = {}
for _, star in ipairs(stars) do
if star.unlockAttempt then
local ownAggregate = {}
for i, label in ipairs(prog.formattedProgress.ownAggregate.labels) do
local agg = {
if change then
for _, league in ipairs(change.unlockedLeagues or {}) do
for i, mId in ipairs(league.missions) do
for _, league in ipairs(change.unlockedLeagues or {}) do
for i, mId in ipairs(league.missions) do
local m = gameplay_missions_missions.getMissionById(mId)
end
for _, elem in ipairs(change.unlockedMissions or {}) do
local m = gameplay_missions_missions.getMissionById(elem.id)
table.sort(perfStatsGrid.rows, function(a, b) return a.order < b.order end)
for _, statData in ipairs(perfStatsGrid.rows) do
statData.order = nil
table.sort(tierGrid.rows, function(a, b) return a.order < b.order end)
for _, statData in ipairs(tierGrid.rows) do
statData.order = nil
local bestLapIndex = -1
for i, lap in ipairs(state.historicTimes) do
if lap.lapTime < bestLapTime then
local rows = {}
for i, lap in ipairs(state.historicTimes) do
local isBest = lap.lapTime == bestLapTime
@/lua/ge/extensions/flowgraph/nodes/vehicle/replay.lua
if im.BeginCombo("##repl" .. self.id, self.replayName) then
for _, t in ipairs(self.replays) do
if im.Selectable1(t.filename, t.filename == self.replayName) then
@/gameplay/missions/automation_test_track/flowgraph/001-Dam/customNodes/getClosestStaticObjectNode.lua
self.pos:setFromTable(self.pinIn.position.value)
for _, obj in ipairs(getObjectsByClass("TSStatic") or {}) do
if not internalName or internalName == tostring(obj:getInternalName()) then
@/lua/common/libs/slaxml/slaxdom.lua
local omit = {}
if opts.omit then for _,s in ipairs(opts.omit) do omit[s]=true end end
function ser.document(n)
for _,kid in ipairs(n.kids) do
if ser[kid.type] then ser[kid.type](kid,0) end
sorted = {}
for i,a in ipairs(n.attr) do sorted[i]=a end
table.sort(sorted,function(a,b)
local attrs = {}
for _,a in ipairs(sorted) do
if (not a.nsURI or not omit[a.nsURI]) and not (omit[a.value] and a.name:find('^xmlns:')) then
if n.kids and n.kids[1] then
for _,kid in ipairs(n.kids) do
if ser[kid.type] then ser[kid.type](kid,depth+1) end
@/lua/vehicle/extensions/tech/wheelForces.lua
--obj:getNodeForceVector()
for _, data in ipairs(wheelData) do
local smoothX
tmpVectorSum:set(0, 0, 0)
for _, rBeam in ipairs(data.rimBeamsNode1) do
local beamStress = obj:getBeamStress(rBeam)
tmpVectorSum:set(0, 0, 0)
for _, rBeam in ipairs(data.rimBeamsNode2) do
local beamStress = obj:getBeamStress(rBeam)
tmpVectorSum:set(0, 0, 0)
for _, sBeamData in ipairs(data.sidewallBeamsNode1) do
local beamStress = obj:getBeamStress(sBeamData.beamId)
tmpVectorSum:set(0, 0, 0)
for _, sBeamData in ipairs(data.sidewallBeamsNode2) do
local beamStress = obj:getBeamStress(sBeamData.beamId)
tmpVectorSum:set(0, 0, 0)
for _, sBeam in ipairs(data.suspensionBeamsNode1) do
local beamStress = obj:getBeamStress(sBeam)
tmpVectorSum:set(0, 0, 0)
for _, sBeam in ipairs(data.suspensionBeamsNode2) do
local beamStress = obj:getBeamStress(sBeam)
tmpVectorSum:set(0, 0, 0)
for _, tNode in ipairs(data.treadNodes) do
local forceVector = obj:getNodeForceVector(tNode):normalized()
--local forwardVector = obj:getDirectionVector()
for _, data in ipairs(wheelData) do
local axleNodePos1 = obj:getNodePosition(data.axleNode1)
for _, beam in ipairs(data.rimBeamsNode1) do
p1 = vehiclePos + obj:getNodePosition(v.data.beams[beam].id1)
end
for _, beam in ipairs(data.rimBeamsNode2) do
p1 = vehiclePos + obj:getNodePosition(v.data.beams[beam].id1)
for _, beamData in ipairs(data.sidewallBeamsNode1) do
p1 = vehiclePos + obj:getNodePosition(v.data.beams[beamData.beamId].id1)
end
for _, beamData in ipairs(data.sidewallBeamsNode2) do
p1 = vehiclePos + obj:getNodePosition(v.data.beams[beamData.beamId].id1)
for _, beamId in ipairs(data.suspensionBeamsNode1) do
p1 = vehiclePos + obj:getNodePosition(v.data.beams[beamId].id1)
end
for _, beamId in ipairs(data.suspensionBeamsNode2) do
p1 = vehiclePos + obj:getNodePosition(v.data.beams[beamId].id1)
for _, treadNodeId in ipairs(data.treadNodes) do
p1 = vehiclePos + obj:getNodePosition(treadNodeId)