getObjectByID
Definition
-- @/lua/ge/ge_utils.lua:447
function getObjectByID(id)
local veh = vehicleObjectsCache[id]
if veh == nil then -- nil means the cache hasn't been computed
veh = be:getObjectByID(id) or false -- false means the cache has been computed but there's no vehicle
vehicleObjectsCache[id] = veh
end
return veh or nil -- replaces "false" with nil
end
Callers
@/lua/ge/extensions/career/modules/painting.lua
local vehObjId = career_modules_inventory.getMapInventoryIdToVehId()[inventoryId]
local vehicleObject = getObjectByID(vehObjId)
extensions.core_vehicle_colors.setVehiclePaint(1, chosenPaints[1], vehObjId)
local vehId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
local veh = getObjectByID(vehId)
core_vehicleBridge.requestValue(veh, function()
@/lua/ge/extensions/tech/capturePlayer.lua
if lidar.vid then
local veh = getObjectByID(lidar.vid)
pcd:setViewpoint(veh:getPosition(), veh:getRefNodeRotation())
if radar.vid then
local veh = getObjectByID(radar.vid)
pcd:setViewpoint(veh:getPosition(), veh:getRefNodeRotation())
@/lua/vehicle/recovery.lua
local rot = quatFromDir(dirFront, dirUp)
obj:queueGameEngineLua("spawn.safeTeleport(getObjectByID("..obj:getId().."), vec3("..recPoint.pos.x..","..recPoint.pos.y..","..recPoint.pos.z.."), quat("..rot.x..","..rot.y..","..rot.z..","..rot.w.."), nil, nil, " .. tostring(moveTraffic) .. ")")
else
obj:requestReset(RESET_PHYSICS) -- fix vehicle + reset velocity
obj:queueGameEngineLua('getObjectByID('..tostring(obj:getId())..'):resetBrokenFlexMesh()')
setRecoveryPoint(M.homePoint, true, moveTraffic)
--obj:setMeshNameAlpha(1, "", true) -- show everything again
obj:queueGameEngineLua('getObjectByID('..tostring(obj:getId())..'):resetBrokenFlexMesh()')
obj:queueGameEngineLua('be.nodeGrabber:clearVehicleFixedNodes('..tostring(obj:getId())..')')
@/lua/ge/extensions/editor/trafficDebug.lua
if trafficAiVehsList[i] and scenetree.objectExistsById(trafficAiVehsList[i]) then
getObjectByID(trafficAiVehsList[i]):delete()
end
if parkedVehsList[i] and scenetree.objectExistsById(parkedVehsList[i]) then
getObjectByID(parkedVehsList[i]):delete()
end
txtColor = colors.red
elseif not getObjectByID(id):getActive() then
txtColor = colors.grey
im.PushStyleColor2(im.Col_Text, colors.silver)
if im.Selectable1("["..id.."] "..getObjectByID(id).jbeam, id == currId) then
currId = id
if currVeh then
local obj = getObjectByID(currId)
if im.Button("Reset Vehicle") then
local obj = getObjectByID(currVeh.id)
obj:queueLuaCommand("recovery.recoverInPlace()")
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/followPath.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
id = id or 0
local obj = getObjectByID(id)
if not obj then
getObjectByID(id):setMeshAlpha(1, '') -- force vehicle to be visible
local role = 'standard'
local obj = getObjectByID(self.id)
local modelData = core_vehicles.getModel(obj.jbeam).model
function C:resetValues()
self.pos = self.pos or getObjectByID(self.id):getPosition()
self.respawn = {
function C:resetElectrics()
local obj = getObjectByID(self.id)
obj:queueLuaCommand('electrics.set_lightbar_signal(0)')
function C:honkHorn(duration) -- set horn with duration
getObjectByID(self.id):queueLuaCommand('electrics.horn(true)')
self.queuedFuncs.horn = {timer = duration or 1, vLua = 'electrics.horn(false)'}
-- assumes that vehicle has a lightbar...
getObjectByID(self.id):queueLuaCommand('electrics.set_lightbar_signal(2)')
local cmd = disableAfterUse and 'electrics.set_lightbar_signal(0)' or 'electrics.set_lightbar_signal(1)'
local obj = getObjectByID(self.id)
obj:queueLuaCommand(string.format('ai.setMode("%s")', mode))
local obj = getObjectByID(self.id)
if params.aggression or params.baseAggression then
if not self.collisions[id] and isCurrentCollision then -- checks bounding boxes and creates a collision table
local bb1 = getObjectByID(self.id):getSpawnWorldOOBB()
local bb2 = getObjectByID(id):getSpawnWorldOOBB()
local bb1 = getObjectByID(self.id):getSpawnWorldOOBB()
local bb2 = getObjectByID(id):getSpawnWorldOOBB()
self.alpha = clamp(self.alpha + (rate or 0.1) * (isFadeOut and -1 or 1), 0, 1)
getObjectByID(self.id):setMeshAlpha(self.alpha, '')
table.clear(self.queuedFuncs)
getObjectByID(self.id):queueLuaCommand('electrics.setLightsState(0)') -- always turn off headlights
self.headlights = false
if self.role.flags.freeze then
getObjectByID(self.id):queueLuaCommand('controller.setFreeze(0)')
self.role.flags.freeze = false
if self.isAi then
local obj = getObjectByID(self.id)
self.queuedFuncs.headlights = nil
getObjectByID(self.id):queueLuaCommand('electrics.setLightsState(0)')
self.headlights = false
else
getObjectByID(self.id):queueLuaCommand(v.vLua)
end
@/lua/ge/extensions/core/vehicleActivePooling.lua
for k, v in pairs(self.inactiveVehs) do
local obj = getObjectByID(v)
if obj then obj:delete() end
function VehPool:insertVeh(vehId, forceInsert)
local obj = getObjectByID(vehId)
if not obj then return false end
if self:tryInsertActiveVeh(vehId, forceInsert) then
getObjectByID(vehId):setActive(1)
else
else
getObjectByID(vehId):setActive(0)
end
for id, state in pairs(self.allVehs) do
local obj = getObjectByID(id)
if map.objects[id] then
@/gameplay/missionTypes/aiRace/customNodes/multiVehicleLuaNode.lua
for _, id in ipairs(vehIds) do
getObjectByID(id):queueLuaCommand(self.pinIn.func.value or '')
end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/chase.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/stop.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/gameplay/traffic/roles/police.lua
local modeNum = 0
local obj = getObjectByID(self.veh.id)
self.veh:setAiMode('stop')
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_lightbar_signal(1)')
self:setAggression()
self.veh:setAiMode('chase')
getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
self.driveInLane = false
self.veh:setAiMode('flee')
getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("on")')
self.driveInLane = true
self.veh:setAiMode('stop')
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_lightbar_signal(2)')
end
local targetVeh = gameplay_traffic.getTrafficData()[targetId]
if not targetVeh.pursuit.roadblockPos or (targetVeh.pursuit.roadblockPos and getObjectByID(self.veh.id):getPosition():squaredDistance(targetVeh.pursuit.roadblockPos) > 400) then
-- ignores pursuit start if vehicle is at a roadblock
-- TODO: this is a hack; we should enable the vehicle AI to naturally overtake traffic in lane mode
getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
self.driveInLane = false
if targetVeh.pursuit.timers.main >= 8 or targetVeh.speed >= minSpeed + 5 then -- target is still driving, or target gained speed
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_lightbar_signal(2)') -- fully turn on lights and sirens
self.sirenTimer = -1
@/lua/ge/extensions/gameplay/taxi.lua
blinkerStates[vehId] = "pullingOver"
activatePullOverBlinkers(getObjectByID(vehId))
end
for vehId, state in pairs(blinkerStates) do
local veh = getObjectByID(vehId)
local taxiSpeed = veh:getVelocity():len() * 3.6
currentTaxiId = nearestTaxiId
local veh = getObjectByID(currentTaxiId)
if not veh then return end
gameplay_walk.removeVehicleFromBlacklist(currentTaxiId)
getObjectByID(currentTaxiId).playerUsable = true
local function leaveTaxi(message)
local veh = getObjectByID(currentTaxiId)
if not veh then return end
gameplay_walk.addVehicleToBlacklist(currentTaxiId)
getObjectByID(currentTaxiId).playerUsable = false
if not currentTaxiId then return end
local veh = getObjectByID(currentTaxiId)
if not veh then return end
if not currentTaxiId then return false end
local veh = getObjectByID(currentTaxiId)
if not veh then return false end
if currentStep == steps.taxiCalled and gameplay_walk.isWalking() and getObjectByID(currentTaxiId):getVelocity():len() < 1 then
local dist = be:getPlayerVehicle(0):getPosition():distance(map.objects[currentTaxiId].pos)
startTaxiWithCurrentRoute(true)
spawn.safeTeleport(getObjectByID(currentTaxiId), skipPosition, skipRotation, true, nil, false)
@/gameplay/missionTypes/aiRace/customNodes/collisionTrackingNode.lua
function C:checkBounds(vehId, targetVehId)
if not getObjectByID(vehId) or not getObjectByID(targetVehId) then return false end
function C:checkBounds(vehId, targetVehId)
if not getObjectByID(vehId) or not getObjectByID(targetVehId) then return false end
local bbA = getObjectByID(vehId):getSpawnWorldOOBB()
local bbB = getObjectByID(targetVehId):getSpawnWorldOOBB()
local bbA = getObjectByID(vehId):getSpawnWorldOOBB()
local bbB = getObjectByID(targetVehId):getSpawnWorldOOBB()
local centerA = bbB:getCenter()
@/gameplay/missions/italy/arrive/012-Field/script.lua
local veh = getObjectByID(self.vehId)
if not veh then return end
@/lua/ge/extensions/core/windowsConsole.lua
else if nameVidMap[context] then
local veh = getObjectByID(nameVidMap[context])
if veh then
@/lua/ge/extensions/gameplay/discover/newPlayerExperience.lua
for vehId, setup in pairs(setupVehs) do
local veh = getObjectByID(vehId)
if veh and veh:isReady() then
@/lua/ge/extensions/scenario/waypoints.lua
local bo = getObjectByID(vid)
local vehicleWaypointsData = M.state.vehicleWaypointsData
local vehicle = getObjectByID(vid)
end
local bo = getObjectByID(vid)
if not bo then return end
local vehWpData = M.state.vehicleWaypointsData[vehicleId]
local vehicle = getObjectByID(vehicleId)
if not scenario or not vehicle or not vehWpData then
for vid, vehWpData in pairs(vehicleWaypointsData) do
local vehicle = getObjectByID(vid)
local vehicleData = map.objects[vid]
@/lua/ge/extensions/gameplay/statistic.lua
else
currentPlayerVehicleObj = getObjectByID(newid)
end
@/lua/vehicle/ai.lua
obj:queueGameEngineLua(
"getObjectByID(" .. objectId .. "):resetBrokenFlexMesh();" ..
"vehicleSetPositionRotation(" .. objectId .. "," .. pos.x .. "," .. pos.y .. "," .. pos.z .. "," .. rot.x .. "," .. rot.y .. "," .. rot.z .. "," .. rot.w .. ")"
@/lua/ge/extensions/tech/adasUltrasonic.lua
local front = poiData.vehFront
front = util.posVS2Coeffs(front, getObjectByID(vid))
front = extensions.tech_pythonExport.coeffs2Python(front, getObjectByID(vid))
front = util.posVS2Coeffs(front, getObjectByID(vid))
front = extensions.tech_pythonExport.coeffs2Python(front, getObjectByID(vid))
local rear = poiData.vehRear
local rear = poiData.vehRear
rear = util.posVS2Coeffs(rear, getObjectByID(vid))
rear = extensions.tech_pythonExport.coeffs2Python(rear, getObjectByID(vid))
rear = util.posVS2Coeffs(rear, getObjectByID(vid))
rear = extensions.tech_pythonExport.coeffs2Python(rear, getObjectByID(vid))
local positions = {vec3(front.x + 0.3, front.y - 0.2, front.z - 0.25), vec3(front.x - 0.3, front.y - 0.2, front.z - 0.25), -- fl_near, fr_near
@/lua/vehicle/bdebugImpl.lua
obj:queueGameEngineLua("getObjectByID(" .. obj:getID() .. "):queueLuaCommand('bdebug.recieveViewportSize('.. ui_imgui.GetMainViewport().Size.x .. ',' .. ui_imgui.GetMainViewport().Size.y .. ')' )")
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
if args.useWarnSignal then
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_warn_signal(1)')
end
self.veh:setAiMode('stop')
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_warn_signal(1)')
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_lightbar_signal(0)')
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_warn_signal(1)')
getObjectByID(self.veh.id):queueLuaCommand('electrics.set_lightbar_signal(0)')
end
function C:setTarget(id) -- sets the target vehicle id
local obj = getObjectByID(self.veh.id)
if id and getObjectByID(id) then
local obj = getObjectByID(self.veh.id)
if id and getObjectByID(id) then
self.targetId = id
self.driver.aggression = clamp(baseAggression + modifier, 0.2, 1)
getObjectByID(self.veh.id):queueLuaCommand('ai.setAggression('..self.driver.aggression..')') -- slightly randomized aggression (mean 0.3)
end
local obj = getObjectByID(self.veh.id)
obj:queueLuaCommand('ai.setParameters('..serialize(params)..')') ]]--
@/lua/ge/extensions/core/checkpoints.lua
local function saveCheckpoint(vehicleId, vehicleName, cpData)
local vehicle = getObjectByID(vehicleId)
if not vehicle then
-- Queued for round trip to allow setpositionrotation to take effect
local callbackCommand = string.format('obj:queueGameEngineLua("if getObjectByID('..vehId..') then getObjectByID('..vehId..'):autoplace(false); core_checkpoints.completeReset(%u,%s) end")', vehId, "'"..vehicleName.."'")
vehicle:queueLuaCommand(callbackCommand)
-- Queued for round trip to allow setpositionrotation to take effect
local callbackCommand = string.format('obj:queueGameEngineLua("if getObjectByID('..vehId..') then getObjectByID('..vehId..'):autoplace(false); core_checkpoints.completeReset(%u,%s) end")', vehId, "'"..vehicleName.."'")
vehicle:queueLuaCommand(callbackCommand)
local function initialiseCheckpointData(vehicleId)
local vehicle = getObjectByID(vehicleId)
local scenario = scenario_scenarios and scenario_scenarios.getScenario()
data.checkTimer = data.checkTimer - 4
local vehicle = getObjectByID(vid)
if vehicle and not vehicle.playerUsable then
local function onVehicleSpawned(vehId)
-- local vehicle = getObjectByID(vehId)
-- local msg = 'onVehicleSpawned called... vehId: '..tostring(vehId)
local function onVehicleDestroyed(vid)
-- local vehicle = getObjectByID(vid)
-- local msg = 'onVehicleDestroyed called... vid: '..tostring(vid)
@/lua/ge/extensions/flowgraph/nodes/vehicle/touchingStatic.lua
function C:work()
if not self.pinIn.vehId.value or not getObjectByID(self.pinIn.vehId.value) then
self:reset()
local veh = getObjectByID(self.pinIn.vehId.value)
local oobb = veh:getSpawnWorldOOBB()
@/lua/ge/extensions/editor/tech/sensorConfiguration/conversions.lua
if not config.isStatic then
local veh = getObjectByID(config.vid)
if config.isDirWorldSpace == true then
@/lua/ge/extensions/career/modules/vehicleDeletionService.lua
else
local obj = getObjectByID(vehId)
if obj then
for vehId, data in pairs(flaggedVehicles) do
local obj = getObjectByID(vehId)
camPos:set(core_camera.getPositionXYZ())
@/lua/ge/extensions/core/sounds.lua
if player ~= 0 then return end
local newVehicle = getObjectByID(newId)
if not newVehicle then return end
@/lua/ge/extensions/ui/console.lua
if not vid then log("E","exec","Selected vehicle invalid");refreshCombo();goto skipcmd end
local v = getObjectByID(vid)
if not v then log("E","exec","Selected vehicle dosn't exist");refreshCombo();goto skipcmd end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/directlyTo.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/util/booster.lua
if event == 'enter' then
local veh = getObjectByID(data.subjectID)
if veh then
@/lua/ge/extensions/c2/panelPlugins/vehicleManager.lua
if sub.vid then
local veh = be:getObjectByID(sub.vid) or be:getPlayerVehicle(0)
if veh then
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/goToEndLine.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/gameplay/police.lua
for _, id in ipairs(vehIds) do
local veh = getObjectByID(id)
if veh then
for i, id in ipairs(vehIds) do
local veh = getObjectByID(id)
if veh then
for _, v in ipairs(policePropIds) do
getObjectByID(v):setActive(active and 1 or 0)
if reset then
if reset then
getObjectByID(v):queueLuaCommand("recovery.loadHome()")
end
local function insertProp(propId) -- adds a prop to use for roadblocks
local veh = getObjectByID(propId or 0)
if veh and not gameplay_traffic.getTrafficData()[propId] and not arrayFindValueIndex(policePropIds, propId) then
for id, veh in pairs(policeVehs) do
if getObjectByID(id):getActive() then
local target = veh.role.validTargets[targetId or 0] -- gets cached data
local function releaseVehicle(id, showMessages) -- unfreezes controls and lets a vehicle continue after an arrest
local obj = getObjectByID(id)
if not obj then return end
local obj = getObjectByID(newId)
if obj and obj:isPlayerControlled() then
if traffic[oldId] and traffic[newId] then
local prevObj = getObjectByID(oldId)
local inVeh = (prevObj and prevObj.jbeam == 'unicycle')
for otherId, otherVeh in pairs(policeVehs) do -- first, check for police vehicles that are out of sight
if getObjectByID(otherId):getActive() and otherVeh.role.validTargets[id] and otherVeh.role.validTargets[id].dist > 10000
and otherVeh.focusDist > minDist and veh.focus.dirVec:dot(otherVeh.pos - veh.focus.pos) < 0 then
for i = #policePropIds, 1, -1 do -- validation
if not getObjectByID(policePropIds[i]) then
removeProp(policePropIds[i])
for _, pid in ipairs(newPropIds) do
maxPropLength = max(maxPropLength, getObjectByID(pid).initialNodePosBB:getExtents().y)
end
if vehData.state == 'fadeIn' or vehData.state == 'fadeOut' then -- ensures that vehicles have full mesh alpha
getObjectByID(vid):setMeshAlpha(1, '')
vehData.alpha = 1
@/lua/ge/extensions/core/cameraModes/orbit.lua
local vehId = data.veh:getID()
local veh = getObjectByID(vehId)
local bottomRear = vec3()
@/lua/ge/extensions/flowgraph/nodes/vehicle/setActive.lua
if self.pinIn.vehId.value then
obj = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/trafficSpawnGroup.lua
for _, v in ipairs(vehIds) do
self.mgr.modules.vehicle:addVehicle(getObjectByID(v), {dontDelete = self.dontDelete})
end
@/lua/ge/extensions/core/trailerRespawn.lua
if not configInfo then
local veh = getObjectByID(objId)
local vehModel = core_vehicles.getModel(veh:getField('JBeam','0')).model
if trailerReg[vehId] then
getObjectByID(trailerReg[vehId].trailerId):setActive(active and 1 or 0)
log("D", logTag, "Trailer "..tostring(trailerReg[vehId].trailerId).." active state set to "..tostring(active))
if not trailerReg[vehId] then return end
local veh = getObjectByID(vehId)
if not veh then return end
for vID,c in pairs(core_vehicles.vehsCouplerOffset) do
local veh = getObjectByID(vID)
if veh then
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/flee.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/career/modules/vehiclePerformance.lua
if otherVehId then
local otherVeh = getObjectByID(otherVehId)
otherVeh:setActive(enabled and 1 or 0)
local vehVelocity = getObjectByID(vehId):getVelocity():length()
local fov = linearScale(vehVelocity, 2, maxVelocity, 20, 65)
zoomingCamera = true
maxVelocity = getObjectByID(vehId):getVelocity():length()
core_camera.setFOV(vehId, 65)
vehId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
vehicleInitialPos = getObjectByID(vehId):getPosition()
return true
career_modules_inventory.enterVehicle(inventoryId)
refuelCar(getObjectByID(vehId))
return true
function()
core_vehicleBridge.requestValue(getObjectByID(vehId), function(ret)
certificationData = ret
spawn.safeTeleport(getObjectByID(vehId), dragData.strip.lanes[1].waypoints.spawn.transform.pos, dragData.strip.lanes[1].waypoints.spawn.transform.rot, nil, nil, nil, true, false)
getObjectByID(vehId):queueLuaCommand('damageTracker.registerDamageUpdateCallback(function(damageData, damageDataDelta) obj:queueGameEngineLua("career_modules_vehiclePerformance.onVehicleDamaged(" .. serialize(damageData) .. ", " .. serialize(damageDataDelta) .. ")") end)')
function()
core_vehicleBridge.executeAction(getObjectByID(vehId), 'startRecording', "power")
return true
if not initialCheckPos then
local vehicle = getObjectByID(vehId)
initialCheckPos = vehicle:getPosition()
if lastCheckTime >= CHECK_INTERVAL then
local vehicle = getObjectByID(vehId)
local movement = (vehicle:getPosition() - initialCheckPos):length()
recordingDataRequested = true
core_vehicleBridge.executeAction(getObjectByID(vehId),'stopRecording', "power")
core_vehicleBridge.requestValue(getObjectByID(vehId), function(ret)
core_vehicleBridge.executeAction(getObjectByID(vehId),'stopRecording', "power")
core_vehicleBridge.requestValue(getObjectByID(vehId), function(ret)
recordingDataRetrieved = true
function()
local vehicle = getObjectByID(vehId)
local spawnPoint = scenetree.findObject("skidpadSpawn")
function()
local vehicle = getObjectByID(vehId)
if cancelTestRequested then
core_vehicleBridge.executeAction(getObjectByID(vehId),'stopRecording', "lateralAcceleration")
util_stepHandler.skipToLastStepOrCallback()
recordingDataRequested = true
core_vehicleBridge.executeAction(getObjectByID(vehId),'stopRecording', "lateralAcceleration")
core_vehicleBridge.requestValue(getObjectByID(vehId), function(ret)
core_vehicleBridge.executeAction(getObjectByID(vehId),'stopRecording', "lateralAcceleration")
core_vehicleBridge.requestValue(getObjectByID(vehId), function(ret)
recordingDataRetrieved = true
if vehicleInitialPos then
local vehObj = getObjectByID(vehId)
if vehObj then
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/raceAiParameters.lua
for id, state in pairs(self.pinIn.raceData.value.states) do
local veh = getObjectByID(id)
if veh and not veh:isPlayerControlled() then
@/lua/vehicle/extensions/dynoClient.lua
local js = jsonEncode(data):gsub('%"', '%\\\'') -- replace " with \'
local l = "getObjectByID("..objId.."):queueJSUITexture('"..textureName.."', '"..jsFunc.."(" .. js .. ");')"
obj:queueGameEngineLua(l)
@/lua/ge/extensions/flowgraph/nodes/vehicle/getActive.lua
if self.pinIn.vehId.value then
obj = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/gameplay/traffic/roles/suspect.lua
self.veh:setAiMode('flee')
getObjectByID(self.veh.id):queueLuaCommand('controller.setFreeze(0)')
getObjectByID(self.veh.id):queueLuaCommand('ai.setAggressionMode("off")')
getObjectByID(self.veh.id):queueLuaCommand('controller.setFreeze(0)')
getObjectByID(self.veh.id):queueLuaCommand('ai.setAggressionMode("off")')
getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
getObjectByID(self.veh.id):queueLuaCommand('ai.setAggressionMode("off")')
getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
getObjectByID(self.veh.id):queueLuaCommand('ai.setSpeedMode("off")')
getObjectByID(self.veh.id):queueLuaCommand('ai.driveInLane("off")')
getObjectByID(self.veh.id):queueLuaCommand('ai.setSpeedMode("off")')
self:setAggression(0.8)
arrest = function ()
getObjectByID(self.veh.id):queueLuaCommand('controller.setFreeze(1)')
self.flags.freeze = 1
clear = function ()
getObjectByID(self.veh.id):queueLuaCommand('controller.setFreeze(0)')
self.flags.freeze = nil
@/lua/ge/extensions/flowgraph/modules/aiRecordingModule.lua
print("Saving script AI recording to "..dir..fn)
local veh = getObjectByID(vehId)
@/lua/ge/extensions/editor/resourceChecker.lua
if vehid ~= -1 then
local veh = getObjectByID(vehid)
if veh then
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/random.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/career/modules/inspectVehicle.lua
if despawnPreviousVehMode == "despawn" then
local veh = getObjectByID(vehId)
if veh then
end
local veh = getObjectByID(vehId)
if veh then
local vehObj = getObjectByID(testDriveVehInfo.vehId)
local playerVehObj = getPlayerVehicle(0)
@/lua/ge/extensions/scenario/busdriver.lua
--wpList = scenario_scenarios.getScenario().lapConfig
--getObjectByID(vehicleId):queueLuaCommand("controller.getController('busNextStopDsp').onDepartedStop( "..dumps({unpack(wpList, 1,#wpList)}).." )")
@/lua/ge/extensions/freeroam/dragRace.lua
if v.lane == "right" and v.id == data.subjectID then
local rightVehicle = getObjectByID(v.id)
-- Updating right display
if v.lane == "left" and v.id == data.subjectID then
local leftVehicle = getObjectByID(data.subjectID)
-- Updating left display
if data.event == "enter" and not playerVehicle then
playerVehicle = getObjectByID(data.subjectID)
playerVehicleInsideTrigger = true
local vehicle = getObjectByID(vid)
if not vehicle then return end
@/lua/ge/extensions/career/modules/testDrive.lua
local function checkPlayerNotTooFarFromVeh()
local veh = getObjectByID(vehicleId)
if not veh then return end
local vehPos = veh:getPosition()
local playerPos = getObjectByID(be:getPlayerVehicleID(0)):getPosition()
if playerPos:distance(vehPos) > maxDistanceFromVeh then
vehicleId = _vehicleId
local vehObj = getObjectByID(vehicleId)
gameplay_walk.getInVehicle(vehObj)
--execute actions with the test drive vehicle
local vehicle = getObjectByID(vehicleId)
if vehicle then
@/lua/ge/extensions/gameplay/traffic/roles/standard.lua
self.veh:setAiMode('flee')
local obj = getObjectByID(self.veh.id)
obj:queueLuaCommand('ai.driveInLane("off")')
self.veh:setAiMode(args.isChase and 'chase' or 'follow')
local obj = getObjectByID(self.veh.id)
obj:queueLuaCommand('ai.driveInLane("off")')
@/lua/ge/extensions/career/modules/vehicleShopping.lua
if career_modules_playerAttributes.getAttributeValue("money") >= purchaseData.prices.finalPrice then
local vehObj = getObjectByID(purchaseData.vehId)
payForVehicle()
@/lua/ge/extensions/core/vehicleTriggers.lua
local vData = extensions.core_vehicle_manager.getVehicleData(highLightedTriggerVehId)
local veh = getObjectByID(highLightedTriggerVehId)
if veh and vData and vData.vdata.triggers then
-- highlight currently used trigger
local vehicleObj = getObjectByID(currentlyUsedTrigger.v)
if not vehicleObj then
@/gameplay/missionTypes/evade/customNodes/autoStartPositionsNode.lua
sp:moveResetVehicleTo(vehId, false, true)
getObjectByID(vehId):queueLuaCommand("recovery.saveHome()")
break
@/lua/ge/extensions/flowgraph/modules/missionModule.lua
if params.keepPlayer ~= nil and playerId then
getObjectByID(playerId):setActive(params.keepPlayer and 1 or 0)
mission.setupData.stashedVehicles[playerId] = not params.keepPlayer
id = id or be:getPlayerVehicleID(0)
local obj = getObjectByID(id)
if obj then
self.mgr:logEvent("Removing stashed player vehicle", "I", "The stashed player vehicle will no longer be reactivated at the end of the project.")
local pv = getObjectByID(playerId)
if pv then
@/lua/ge/extensions/statistics/statistics.lua
else
vehicle = getObjectByID(vehicleID)
end
else
vehicle = getObjectByID(vehicleID)
end
else
vehicle = getObjectByID(vehicleID)
end
else
vehicle = getObjectByID(vehicleID)
end
else
vehicle = getObjectByID(vehicleID)
end
@/lua/ge/extensions/flowgraph/nodes/events/customizedTriggerBox.lua
local noData = false
if vehId and getObjectByID(vehId) then
local veh = getObjectByID(vehId)
if vehId and getObjectByID(vehId) then
local veh = getObjectByID(vehId)
@/gameplay/missions/west_coast_usa/chase/001-Goliath/script.lua
local suspectId = self.mission.mgr.variables:get("suspectId")
local suspect = getObjectByID(suspectId)
if suspect and trailer then
@/lua/ge/extensions/core/quickAccess.lua
local function switchToVehicle(objid)
local veh = getObjectByID(objid)
if veh then
if item.objID then
local veh = getObjectByID(item.objID)
if not veh then
@/lua/vehicle/extensions/tech/techCore.lua
local cmd = 'Point4F(' .. request['r'] .. ', ' .. request['g'] .. ', ' .. request['b'] .. ', ' .. request['a'] .. ')'
cmd = 'getObjectByID(' .. obj:getID() .. '):setColor(' .. cmd .. ')'
obj:queueGameEngineLua(cmd)
@/lua/ge/extensions/gameplay/sites/parkingSpot.lua
local veh = getObjectByID(vehId)
if not veh then
function C:vehicleFits(vehId)
local veh = getObjectByID(vehId)
if not veh then return false end
function C:moveResetVehicleTo(vehId, lowPrecision, backwards, addedOffsetPos, addedOffsetRot, useSafeTeleport, removeTraffic, resetVehicleInSafeTeleport, options)
local veh = getObjectByID(vehId)
if not veh then return end
@/lua/ge/extensions/gameplay/util/crashDetection.lua
for vehId, _ in pairs(frameDamage.touchedVehIds) do
tempVeh = be:getObjectByID(vehId)
tempVehName = "Despawned"
if crashData.debug then
local veh = getObjectByID(vehId)
if veh then
@/lua/ge/extensions/scenario/raceGoals.lua
goal.status = {}
local fobj = getObjectByID(vObjId)
if fobj then
@/lua/ge/extensions/flowgraph/nodes/mission/knockAwayCheck.lua
for id, val in pairs(prefabData.originalVehicleTransforms) do
if getObjectByID(id) and not string.find(getObjectByID(id):getInternalName() or "",'ignore') then
self.vehicleHit[id] = false
for id, val in pairs(prefabData.originalVehicleTransforms) do
if getObjectByID(id) and not string.find(getObjectByID(id):getInternalName() or "",'ignore') then
self.vehicleHit[id] = false
for id, val in pairs(self.originalVehicleTransforms) do
if getObjectByID(id) and not string.find(getObjectByID(id):getInternalName() or "",'ignore') then
table.insert(wps, {name = id, pos = val.pos + vec3(0,0,self.data.zOffset), radius = 1})
for id, val in pairs(self.originalVehicleTransforms) do
if getObjectByID(id) and not string.find(getObjectByID(id):getInternalName() or "",'ignore') then
table.insert(wps, {name = id, pos = val.pos + vec3(0,0,self.data.zOffset), radius = 1})
change[id] = 'hidden'
if not self.vehicleHit[id] and getObjectByID(id) and not string.find(getObjectByID(id):getInternalName() or "",'ignore') then
local mapData = map.objects[id]
change[id] = 'hidden'
if not self.vehicleHit[id] and getObjectByID(id) and not string.find(getObjectByID(id):getInternalName() or "",'ignore') then
local mapData = map.objects[id]
if not mapData then
getObjectByID(id):queueLuaCommand('mapmgr.enableTracking()')
end
@/lua/ge/extensions/career/modules/partShopping.lua
if not currentVehicle then return end
return getObjectByID(getCurrentVehicleVehId())
end
sendShoppingDataToUI()
core_vehicleBridge.executeAction(getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(previewVehicle.id)),'setFreeze', true)
end
core_vehicleBridge.executeAction(getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(previewVehicle.id)),'setFreeze', true)
extensions.hook("onPartShoppingStarted")
local vehId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
local vehicleObj = getObjectByID(vehId)
local currentVehicleData = extensions.core_vehicle_manager.getVehicleData(getCurrentVehicleVehId())
Engine.Audio.playOnce('AudioGui','event:>UI>Career>Buy_01')
core_vehicleBridge.executeAction(getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(previewVehicle.id)),'setFreeze', false)
extensions.hook("onPartShoppingTransactionComplete")
@/lua/ge/extensions/gameplay/race/race.lua
local veh = getObjectByID(id)
if veh then
local vehicle = getObjectByID(newId)
self.states[newId].wheelOffsets = {}
else
finalDir = getObjectByID(id):getDirectionVector() -- last resort, this shouldn't happen
end
getObjectByID(id):queueLuaCommand('controller.setFreeze(false)')
getObjectByID(id):queueLuaCommand('ai.driveUsingPath('..str..')') -- this should ignore one-way roads
getObjectByID(id):queueLuaCommand('controller.setFreeze(false)')
getObjectByID(id):queueLuaCommand('ai.driveUsingPath('..str..')') -- this should ignore one-way roads
end
getObjectByID(id):queueLuaCommand('ai.setMode("stop")')
end
for _, id in ipairs(self.vehIds) do
local veh = getObjectByID(id)
if veh then
local veh = getObjectByID(id)
if veh and self.states[id].isAiVeh then -- lower aggression past the finish line
if state.complete then return end
local vehicle = getObjectByID(id)
if not vehicle then return end
@/lua/ge/extensions/tech/utils.lua
if M.vehicleSystemsCoupling then
local veh = getObjectByID(M.vehicleSystemsCoupling)
updateUI('Vehicle coupling: OFF
')
@/lua/ge/extensions/campaign/exploration.lua
if data.rampTriggerA and data.event == "enter" then
local vehicle = getObjectByID(vid)
local vehiclePosition = vehicle:getPosition()
and data.event == "enter" then
local vehicle = getObjectByID(vid)
core_checkpoints.saveCheckpoint(vid, vehicle:getField('name', ''), lastRampTriggerPos)
if M.recentlySpawnedVehicle == playerId then
local veh = getObjectByID(playerId)
veh:setTransform(transform)
veh:queueLuaCommand('obj:queueGameEngineLua("if getObjectByID('..playerId..') then getObjectByID('..playerId..'):autoplace(false) end")')
simTimeAuthority.set(1)
veh:setTransform(transform)
veh:queueLuaCommand('obj:queueGameEngineLua("if getObjectByID('..playerId..') then getObjectByID('..playerId..'):autoplace(false) end")')
simTimeAuthority.set(1)
@/gameplay/missionTypes/evade/customNodes/multiVehicleLuaNode.lua
for _, id in ipairs(vehIds) do
getObjectByID(id):queueLuaCommand(self.pinIn.func.value or '')
end
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/fileRace.lua
for i = 1, self.count do
if getObjectByID(self.pinIn['vehId_'..i].value) then
table.insert(vids, self.pinIn['vehId_'..i].value)
@/gameplay/missionTypes/chase/customNodes/suspectDistanceNode.lua
if not getObjectByID(self.pinIn.vehId1.value or 0) or not getObjectByID(self.pinIn.vehId2.value or 0) then return end
if not getObjectByID(self.pinIn.vehId1.value or 0) or not getObjectByID(self.pinIn.vehId2.value or 0) then return end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/follow.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/main.lua
profilerPushEvent('vehicleSpawned')
local v = getObjectByID(vid)
if not v then return end
function onInstabilityDetected(vid)
local v = getObjectByID(vid)
local jbeamFilename = v:getJBeamFilename()
@/lua/ge/extensions/core/multiseat.lua
if leastUsedId then
local vehicle = getObjectByID(leastUsedId)
be:enterVehicle(player, vehicle)
@/lua/ge/extensions/career/modules/fuel.lua
if vehId then
local veh = getObjectByID(vehId)
if veh then
@/lua/ge/extensions/flowgraph/nodes/vehicle/gForce.lua
local vehId = self.pinIn.vehId.value or be:getPlayerVehicleID(0)
local veh = getObjectByID(vehId)
if not veh then return end
@/lua/ge/extensions/core/vehicle/partmgmt.lua
local function getVehData(inVehID)
local vehObj = inVehID and getObjectByID(inVehID) or getPlayerVehicle(0)
if not vehObj then return end
local vehId = vehEntry.vehId
local vehicle = getObjectByID(vehId)
local vehicleData = vehManager.getVehicleData(vehId)
local offsetData = entry.offsetData
local veh, parentVeh = getObjectByID(entry.vehId), getObjectByID(parentEntry.vehId)
if not veh then
local offsetData = entry.offsetData
local veh, parentVeh = getObjectByID(entry.vehId), getObjectByID(parentEntry.vehId)
if not veh then
if onlyIfVehChanged then
local name = getObjectByID(vehID):getJBeamFilename()
local oldName = partsData.vehName
@/lua/ge/extensions/flowgraph/nodes/vehicle/generateLicensePlate.lua
local vehId = self.pinIn.vehId.value or be:getPlayerVehicleID(0)
local veh = getObjectByID(vehId) or getPlayerVehicle(0)
if not veh then return end
@/lua/ge/spawn.lua
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
gameplay_traffic.forceTeleport(otherId, bbCenter)
local veh = getObjectByID(vehId)
if not veh then return end
local veh2 = getObjectByID(trailerId)
if not veh2 then return end
@/lua/ge/extensions/freeroam/specialTriggers.lua
if valid and (trigger.vehIds[data.vehId] == nil or trigger.vehIds[data.vehId] ~= active) then -- checks if a state change occurred for this vehicle
local obj = getObjectByID(data.vehId)
if obj then
if active and trigger.enterVehCommand then
getObjectByID(data.vehId):queueLuaCommand(trigger.enterVehCommand)
elseif not active and trigger.exitVehCommand then
elseif not active and trigger.exitVehCommand then
getObjectByID(data.vehId):queueLuaCommand(trigger.exitVehCommand)
end
@/lua/ge/extensions/core/recoveryPrompt.lua
if vehObjId then
local vehObj = getObjectByID(vehObjId)
local pos = vehObj:getPosition()
if vehObjId then
local vehObj = getObjectByID(vehObjId)
local pos = vehObj:getPosition()
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/getAIMode.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/arrive.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/util/trackBuilder/splineTrack.lua
--dump(scenetree.findObject("thePlayer"):getID())
--dump(getObjectByID(scenetree.findObject("thePlayer"):getID()))
local id = scenetree.findObject("thePlayer"):getID()
@/lua/ge/ge_utils.lua
if veh == nil then -- nil means the cache hasn't been computed
veh = be:getObjectByID(id) or false -- false means the cache has been computed but there's no vehicle
vehicleObjectsCache[id] = veh
function vehicleSetPositionRotation(id, px, py, pz, rx, ry, rz, rw)
local bo = getObjectByID(id)
if bo then
function getClosestVehicle(requesterID, callbackfct)
local vehr = getObjectByID(requesterID)
if not vehr then return end
function getRandomPaint(vehId, commonPaintProb)
local obj = getObjectByID(vehId or 0)
local model = obj and obj.jbeam or 'pessima' -- if vehId or vehicle is nil, uses this vehicle paint data as a fallback
for vid,v in pairs(data) do
local vehicle = getObjectByID(vid)
if vehicle then
@/lua/ge/extensions/gameplay/missions/missionManager.lua
for id, v in pairs(setupData.stashedVehicles) do
if v == false and getObjectByID(id) then
log("D", logTag, "Stashing vehicle for mission setup: "..id)
log("D", logTag, "Stashing vehicle for mission setup: "..id)
getObjectByID(id):setActive(0)
setupData.stashedVehicles[id] = true
for id, v in pairs(setupData.stashedVehicles) do
if v == true and getObjectByID(id) then
log("D", logTag, "Unstashing vehicle for mission setup: "..id)
log("D", logTag, "Unstashing vehicle for mission setup: "..id)
getObjectByID(id):setActive(1)
core_vehicleBridge.executeAction(getObjectByID(id), "setFreeze", false)
getObjectByID(id):setActive(1)
core_vehicleBridge.executeAction(getObjectByID(id), "setFreeze", false)
end
local vehId = taskData.data.mission._startingInfo.vehId
local veh = getObjectByID(vehId)
if veh then
local prevId = mission._startingInfo and mission._startingInfo.vehId
local prevVeh = prevId and getObjectByID(prevId) -- checks if it exists; the vehicle can get removed before this step
if mission.setupModules.vehicles._processed and prevVeh and mission.setupModules.vehicles.vehId and prevId ~= mission.setupModules.vehicles.vehId then
if mission.setupModules.vehicles._processed and prevVeh and mission.setupModules.vehicles.vehId and prevId ~= mission.setupModules.vehicles.vehId then
local vehObj = getObjectByID(mission.setupModules.vehicles.vehId)
if vehObj then vehObj:delete() end
if mission._startingInfo.startedFromVehicle then
local veh = getObjectByID(mission._startingInfo.vehId)
if veh then
@/lua/ge/extensions/editor/vehicleDetailViewer.lua
local vehId = be:getPlayerVehicleID(0)
local veh = getObjectByID(vehId)
if not veh then return end
@/lua/ge/extensions/career/modules/playerDriving.lua
local playerVehObj = getPlayerVehicle(0)
spawn.safeTeleport(getObjectByID(vehId), playerVehObj:getPosition(), quatFromDir(playerVehObj:getDirectionVector()), nil, nil, nil, nil, false)
core_vehicleBridge.executeAction(getObjectByID(vehId),'setIgnitionLevel', 0)
spawn.safeTeleport(getObjectByID(vehId), playerVehObj:getPosition(), quatFromDir(playerVehObj:getDirectionVector()), nil, nil, nil, nil, false)
core_vehicleBridge.executeAction(getObjectByID(vehId),'setIgnitionLevel', 0)
elseif not vehInfo.timeToAccess and not career_modules_insurance_insurance.inventoryVehNeedsRepair(favoriteVehicleInventoryId) then
local vehId = inventory.getVehicleIdFromInventoryId(favoriteVehicleInventoryId)
spawn.safeTeleport(getObjectByID(vehId), playerVehObj:getPosition(), quatFromDir(playerVehObj:getDirectionVector()), nil, nil, nil, nil, false)
end)
if trailerDataThisVeh then
local trailer = getObjectByID(trailerDataThisVeh.trailerId)
deleteTrailers(trailer)
local args = job.args[1]
local vehicle = getObjectByID(args.vehicleId)
local trailer = getObjectByID(args.trailerId)
local vehicle = getObjectByID(args.vehicleId)
local trailer = getObjectByID(args.trailerId)
local vehRot = quat(0,0,1,0) * quat(vehicle:getRefNodeRotation())
function()
local trailer = getObjectByID(primaryTrailerData.trailerId)
deleteTrailers(trailer)
@/lua/ge/extensions/career/modules/partInventory.lua
local vehObjId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
local vehicleObj = getObjectByID(vehObjId)
queueCallbackInVehicle(vehicleObj, "career_modules_partInventory.changedPartsCallback", "partCondition.getConditions()", inventoryId)
if vehObjId then
local vehicleObj = getObjectByID(vehObjId)
core_vehicle_manager.queueAdditionalVehicleData({spawnWithEngineRunning = false}, vehObjId)
local vehObjId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
local vehObj = getObjectByID(vehObjId)
local vehicleData = extensions.core_vehicle_manager.getVehicleData(vehObjId)
@/lua/vehicle/partCondition.lua
--TODO improve interface to GE for setting mesh colors
local colorCmd = string.format("getObjectByID(%d):setMeshColor(%q, ColorI(%d,%d,%d,%d), ColorI(%d,%d,%d,%d), ColorI(%d,%d,%d,%d))", objectId, split[3], baseColor1[1] * 255, baseColor1[2] * 255, baseColor1[3] * 255, 255, baseColor2[1] * 255, baseColor2[2] * 255, baseColor2[3] * 255, 255, baseColor3[1] * 255, baseColor3[2] * 255, baseColor3[3] * 255, 255)
--ColorI(roughness0, metallic0, clearCoatFactor0, clearCoatRoughness0)
--ColorI(roughness0, metallic0, clearCoatFactor0, clearCoatRoughness0)
local paintDataCmd = string.format("getObjectByID(%d):setMeshPaintData(%q, ColorI(%d,%d,%d,%d), ColorI(%d,%d,%d,%d), ColorI(%d,%d,%d,%d))", objectId, split[3], paintData1Roughness * 255, paintData1Metallic * 255, paintData1Clearcoat * 255, paintData1ClearcoatRoughness * 255, paintData2Roughness * 255, paintData2Metallic * 255, paintData2Clearcoat * 255, paintData2ClearcoatRoughness * 255, paintData3Roughness * 255, paintData3Metallic * 255, paintData3Clearcoat * 255, paintData3ClearcoatRoughness * 255)
obj:queueGameEngineLua(colorCmd)
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
lo('??++++++++++++++++++++++ veh:'..id..':'..veh:getNodeCount()..':'..tostring(veh:getNodePosition(1))..':'..veh:getJBeamFilename()) --.':'..tostring(veh:getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId()))) --..':'..tableSize(veh.vdata.beams))
lo('?? forPos:'..tostring(veh:getPosition())..':'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(veh:getNodePosition(veh:getRefNodeId())))
end
local box = vo:getWorldBox()
lo('?? for_BOX:'..tostring(be:getObjectByID(pvd.id):getPosition())..':'..tostring(box.minExtents)..':'..tostring(box.maxExtents)..':'..tostring(pvd.pos))
-- local pos = (box.minExtents+box.maxExtents)/2
local pos = -pvd.vdata.nodes[pvd.vdata.refNodes[0].ref].pos + vo:getPosition()
-- be:getObjectByID(pvd.id):getPosition()
--[[
lo('?? mm_BOX:'..tostring(mi)..':'..tostring(ma))
beamdata.pos = (mi+ma)/2 --+ be:getObjectByID(pvd.id):getPosition()
]]
]]
-- beamdata.pos = (mi+ma)/2 --+ be:getObjectByID(pvd.id):getPosition()
-- dump(dgeo,'?? for_DGEO:',nil,2)
@/lua/ge/extensions/scenario/quickRace.lua
print("Vehcle by ID")
print(getObjectByID(veh:getId()))
print("Vehcle rotation through ID")
print("Vehcle rotation through ID")
print(getObjectByID(veh:getId()) and getObjectByID(veh:getId()):getRotation())
print("Vehicle Rotation:")
print("Vehcle rotation through ID")
print(getObjectByID(veh:getId()) and getObjectByID(veh:getId()):getRotation())
print("Vehicle Rotation:")
@/lua/ge/map.lua
v.name = v.name or ''
local vehicle = getObjectByID(k)
v.licensePlate = vehicle and vehicle:getDynDataFieldbyName("licenseText", 0) or dumps(k)
local object = getObjectByID(objId)
if object and M.objects[objId] == nil then
local obj = getObjectByID(objectID)
if not obj then return true end
local veh = scenetree.findObject(vehId)
--local veh = getObjectByID(id)
local pos = vec3(posX, posY, posZ)
@/lua/ge/extensions/gameplay/traffic.lua
if id and getObjectByID(id) then
if not spawnData then
local function respawnVehicle(id, pos, rot, strict) -- moves the vehicle to a new position and rotation
local obj = id and getObjectByID(id)
if not obj or not pos or not rot then return end
local vehObj = getObjectByID(id)
if vehObj and vehObj:getActive() then
-- ignoreVehPool prevents the vehicle from becoming deactivated due to the vehicle pooling system (maybe needs another way to handle this)
local obj = getObjectByID(id)
if traffic[id] then
local obj = getObjectByID(id)
local idx = arrayFindValueIndex(trafficAiVehsList, id)
if state == 'on' then
local obj = getObjectByID(id)
traffic[vehId].alpha = 0
getObjectByID(vehId):setMeshAlpha(0, '')
else
map.request(id, -1) -- force mapmgr to read map (performance optimization)
insertTraffic(id, getObjectByID(id):isPlayerControlled())
end
@/lua/ge/extensions/freeroam/crashCamMode.lua
-- TODO i think we can refactor this to not need the vehicle BB reference anymore
local obj = getObjectByID(otherId)
if not obj then return false end
crashCamSimTimer = crashCamSimTimer + dtSim
local playerVeh = getObjectByID(playerVehId)
@/gameplay/missionTypes/chase/customNodes/suspectAiNode.lua
function C:work()
local veh = getObjectByID(self.pinIn.suspectId.value or 0)
if not veh then return end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/followWaypoints.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/gameplay/missionTypes/delivery/customNodes/VehicleInTargetAreaNode.lua
for _, id in ipairs(ids) do
local veh = getObjectByID(id)
if veh and string.find(veh:getInternalName() or '', 'cargo') then
@/lua/ge/extensions/core/vehicle/colors.lua
local veh = getObjectByID(objID)
local paint, allPaints = updateVehicleDataPaint(index, colorString, objID)
local veh = getObjectByID(objID)
local vd = extensions.core_vehicle_manager.getVehicleData(objID)
local veh = getObjectByID(vehId)
local metallicPaintData = veh:getMetallicPaintData()
@/lua/ge/extensions/core/vehicle/mirror.lua
mouseData.vid = vid
local mdata = getAnglesOffset(vid, getObjectByID(vid))
if mdata[mirror_name] then
@/lua/ge/extensions/career/modules/linearTutorial.lua
if v.role.name == "police" then
local veh = getObjectByID(k)
if veh then
@/lua/ge/extensions/core/vehicles.lua
local res = {}
local vehicle = getObjectByID(id)
if vehicle then
-- Vehicle is part of a vehicle collection
local veh = getObjectByID(currVid)
if not veh then return false end
for childVehId, childVehData in pairs(vehData.children or {}) do
local childVeh = getObjectByID(childVehId)
if not childVeh then
local veh = getObjectByID(vehId)
if not veh then
if parentCouplerData then
local parentVehicle = getObjectByID(parentCouplerData.parentVehId)
if parentVehicle then
local childVeh = getObjectByID(childVehId)
if not childVeh then
local function getCouplerOffset(vehId, couplerTag)
local veh = getObjectByID(vehId)
if not veh then return end
local function positionChildVehicle(vehId, vehTransform, childVehId, childVehOffset)
local veh = getObjectByID(vehId)
if not veh then return end
if not veh then return end
local veh2 = getObjectByID(childVehId)
if not veh2 then return end
local veh = getObjectByID(vehId)
if not veh then return end
if not veh then return end
local veh2 = getObjectByID(childVehId)
if not veh2 then return end
local vehId = table.remove(state.vehsToReuse)
local veh = getObjectByID(vehId or -1)
M.vehIdToVehCollection[vehId] = nil
local veh = getObjectByID(vehId)
if veh then
-- buildVehCollectionCache(collection)
-- local veh = getObjectByID(vid)
-- if veh then
-- buildVehCollectionCache(vehCollection)
-- local mainVeh = getObjectByID(mainVehId)
-- if mainVeh then
if type(veh) == 'number' then
veh = getObjectByID(veh)
end
if vehId then
veh = getObjectByID(vehId)
else
local function onPreVehicleSpawned(vehId)
local veh = getObjectByID(vehId)
if not veh then return end
-- Vehicle is part of a vehicle collection
local veh = getObjectByID(currVid)
if not veh then return end
for childVehId, childVehData in pairs(vehData.children or {}) do
local childVeh = getObjectByID(childVehId)
if childVeh then
-- other vehicles in collection
-- local mainVeh = getObjectByID(collection.mainVehData.vehId)
-- if mainVeh then
@/lua/ge/extensions/gameplay/parking.lua
local function moveToParkingSpot(vehId, parkingSpot, lowPrecision) -- assigns a parked vehicle to a parking spot
local obj = getObjectByID(vehId)
local width, length = obj.initialNodePosBB:getExtents().x - 0.1, obj.initialNodePosBB:getExtents().y
getObjectByID(vehId):queueLuaCommand("electrics.setIgnitionLevel(0)")
if parkingSpot.customFields.tags.street then -- enables tracking, so that AI can try to avoid this vehicle
if not map.objects[vehId] then getObjectByID(vehId):queueLuaCommand("mapmgr.enableTracking()") end
else -- disables tracking, to optimize performance
else -- disables tracking, to optimize performance
getObjectByID(vehId):queueLuaCommand("mapmgr.disableTracking()")
end
local function checkDimensions(vehId) -- checks if the vehicle would fit in a standard sized parking spot
local obj = getObjectByID(vehId)
if not obj then return false end
local function checkParkingSpot(vehId, parkingSpot) -- checks if a parking spot is ready to use for a parked vehicle
local obj = getObjectByID(vehId or 0)
moveToParkingSpot(vehId, ps, not getObjectByID(vehId):isReady())
break
vehId = vehId or be:getPlayerVehicleID(0)
if not getObjectByID(vehId) then return end
vehId = vehId or be:getPlayerVehicleID(0)
if not getObjectByID(vehId) then return end
else
local obj = getObjectByID(vehId)
if not obj then return end
result.cornerCount = 0
local obj = getObjectByID(vehId or 0)
if not obj then return valid, result end
local function insertVehicle(id) -- inserts a new vehicle into the parked cars table
local obj = getObjectByID(id)
if obj then
local id = parkedVehIds[i] or 0
local obj = getObjectByID(id)
if obj then
local radius = otherVeh:isPlayerControlled() and 100 or 20
if otherVeh:getPosition():squaredDistance(getObjectByID(vehId):getPosition()) < square(radius) then
forceTeleport(vehId, nil, 100)
@/lua/ge/extensions/tech/partAnnotations.lua
log('I', 'partAnnotations', 'Annotating vehicle: ' .. vID)
local veh = getObjectByID(vID)
local parts = veh:getMeshNames()
M.revertAnnotations = function(vID)
local veh = getObjectByID(vID)
local parts = veh:getMeshNames()
local colors = {}
local veh = getObjectByID(vID)
local parts = veh:getMeshNames()
@/lua/ge/extensions/core/multiSpawn.lua
for i, v in ipairs(vehIds) do
local obj = getObjectByID(v)
if obj then
@/lua/ge/extensions/core/input/bindings.lua
local oldVehicle = getObjectByID(oldId)
local newVehicle = getObjectByID(newId)
local oldVehicle = getObjectByID(oldId)
local newVehicle = getObjectByID(newId)
local oldName = oldVehicle and oldVehicle:getJBeamFilename() or ""
@/lua/ge/extensions/career/modules/tuning.lua
local vehId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
local veh = getObjectByID(vehId)
createShoppingCart()
local veh = getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(inventoryId))
core_vehicleBridge.executeAction(veh, 'setFreeze', true)
local vehId = career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)
local oldVeh = getObjectByID(vehId)
local vehicleTransform = {pos = oldVeh:getPosition(), rot = quat(0,0,1,0) * quat(oldVeh:getRefNodeRotation())}
local veh = getObjectByID(vehId)
spawn.safeTeleport(veh, vehicleTransform.pos, vehicleTransform.rot, nil, nil, nil, nil, false)
end
core_vehicleBridge.executeAction(getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(inventoryId)), 'setFreeze', false)
if tether then
@/lua/ge/extensions/gameplay/crashTest/scenarioManager.lua
for objId, _ in pairs(map.objects) do
local object = getObjectByID(objId)
for _, name in ipairs(object:getDynamicFields()) do
local veh = getObjectByID(vehId)
veh:queueLuaCommand('ai.startFollowing(' .. serialize(scriptAiFile.recording) .. ')')
elseif currentStepParameters.aiType == "Stuck Throttle" then
local veh = getObjectByID(currentStepParameters.jbeamTargets[1])
veh:queueLuaCommand('electrics.values.throttleOverride = ' .. currentStepParameters.throttleValue/100)
for _, vehId in ipairs(stepData.jbeamTargets) do
getObjectByID(vehId):setActive(1)
end
end
getObjectByID(stepData.plVehId):setActive(1)
else
for _, vehId in ipairs(stepData.jbeamTargets) do
getObjectByID(vehId):setActive(0)
end
end
getObjectByID(stepData.plVehId):setActive(0)
end
if stepData.aiType == "ScriptAi" then
local veh = getObjectByID(stepData.jbeamTargets[1])
if veh then
elseif stepData.aiType == "Stuck Throttle" then
local veh = getObjectByID(stepData.jbeamTargets[1])
if veh then
if shouldDrawMarker(vehId) then
local veh = getObjectByID(vehId)
if veh and not hasVehStartedCrash(vehId) then
for _, vehId in ipairs(stepData.jbeamTargets) do
local veh = getObjectByID(vehId)
if veh then
if shouldDrawMarker(vehId) then
local veh = getObjectByID(vehId)
local plVeh = getObjectByID(currentStepParameters.plVehId)
local veh = getObjectByID(vehId)
local plVeh = getObjectByID(currentStepParameters.plVehId)
if veh and isVehCurrentlyCrashing(vehId) then
if #currentStepParameters.jbeamTargets > 0 then
local veh = getObjectByID(currentStepParameters.jbeamTargets[1])
if veh then
local veh = getObjectByID(crashStartData.vehId)
@/lua/ge/extensions/core/vehiclePaints.lua
local function getRandomPaintsByVehicle(vehId)
local obj = getObjectByID(vehId or 0)
local model = obj and obj.jbeam
@/lua/vehicle/scriptai.lua
obj:requestReset(RESET_PHYSICS)
obj:queueGameEngineLua("getObjectByID(" .. tostring(obj:getId()) .. "):resetBrokenFlexMesh()")
local rot = quatFromDir(dir:cross(up):cross(up), up)
local rot = quatFromDir(dir:cross(up):cross(up), up)
obj:queueGameEngineLua("getObjectByID(" .. obj:getId() .. "):autoplace(false);vehicleSetPositionRotation(" .. obj:getId() .. "," .. pos.x .. "," .. pos.y .. "," .. pos.z .. "," .. rot.x .. "," .. rot.y .. "," .. rot.z .. "," .. rot.w .. ")")
end
@/lua/ge/extensions/gameplay/rally/vehicleTracker.lua
-- local vehObjId = getPlayerVehicleID(0) -> 50001
-- print( getObjectByID(getPlayerVehicleID(0)):getId() ) -> 50001
-- return getObjectByID(self:getVehicleId())
-- print( getObjectByID(getPlayerVehicleID(0)):getId() ) -> 50001
-- return getObjectByID(self:getVehicleId())
return getPlayerVehicle(0)
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/traffic.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else
@/lua/ge/extensions/tech/pythonExport.lua
end
getScenarioConfig(bufferScenario, getObjectByID(vid), unpacked)
getFullConfigFinish()
@/lua/ge/extensions/career/modules/insurance/insurance.lua
if gameplay_walk.isWalking() then
local veh = getObjectByID(vehId)
gameplay_walk.setRot(veh:getPosition() - getPlayerVehicle(0):getPosition())
function(vehInfo)
local vehObj = getObjectByID(vehId)
if not vehObj then return end
local function genericVehNeedsRepair(vehId, callback)
local veh = getObjectByID(vehId)
if not veh then return end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/simpleFollowDecalroad.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/career/modules/delivery/vehicleOfferManager.lua
-- setup mileage
local veh = getObjectByID(vehId)
local mileage = offer.vehicle.mileage or 0
step.sentCommand = true
local veh = getObjectByID(vehId)
core_vehicleBridge.requestValue(veh, function(res)
local vehData = core_vehicle_manager.getVehicleData(vehId)
local veh = getObjectByID(vehId)
core_vehicleBridge.requestValue(veh, function(res)
if gameplay_walk.isWalking() then
local veh = getObjectByID(vehId)
gameplay_walk.setRot(veh:getPosition() - getPlayerVehicle(0):getPosition())
step.makeStepReturnTrueFunction(function()
local veh = getObjectByID(vehId)
local camDir = veh:getPosition() - getPlayerVehicle(0):getPosition()
@/lua/ge/extensions/flowgraph/nodes/util/getMapObjectsDynField.lua
for objId, _ in pairs(map.objects) do
local object = getObjectByID(objId)
for _, name in ipairs(object:getDynamicFields()) do
@/lua/common/extensions/networking/editorToolchain.lua
local vData = core_vehicle_manager.getVehicleData(vId)
local veh = getObjectByID(vId)
@/lua/ge/extensions/gameplay/skidpadTest.lua
function()
local vehicle = getObjectByID(vehId)
local spawnPoint = scenetree.findObject("skidpadSpawn")
function()
local vehicle = getObjectByID(vehId)
@/lua/ge/extensions/editor/veMain.lua
vEditor.vehicle = getObjectByID(id)
if vEditor.vehicle then
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/playRecording.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/gameplay/missionTypes/aiRace/customNodes/autoStartPositionsNode.lua
sp:moveResetVehicleTo(vehId, false, true)
getObjectByID(vehId):queueLuaCommand("recovery.saveHome()") -- for easier resetting of vehicles
log("D", "", "Moved vehicle "..vehId.." to start position "..sp.name)
@/lua/ge/extensions/career/modules/inventory.lua
if not vehId then return end
local vehObj = getObjectByID(vehId)
local bb = vehObj:getSpawnWorldOOBB()
for inventoryId, vehId in pairs(inventoryIdToVehId) do
local veh = getObjectByID(vehId)
if veh then
if vehId then
local obj = getObjectByID(vehId)
if obj then
if vehId then
veh = getObjectByID(vehId)
else
else
veh = getObjectByID(inventoryIdToVehId[inventoryId])
end
if oldVehId then
oldVehObj = getObjectByID(oldVehId)
end
gameplay_walk.setWalkingMode(false, nil, nil, true)
be:enterVehicle(0, getObjectByID(inventoryIdToVehId[id]))
currentVehicle = id
for inventoryId, location in pairs(vehiclesToTeleportToGarage) do
local veh = getObjectByID(location.vehId)
local garage = getClosestGarage(location.pos)
for inventoryId, vehId in pairs(inventoryIdToVehId) do
spawnedVehicles[inventoryId] = getObjectByID(vehId)
end
if inventoryIdToVehId[inventoryId] then
local vehObj = getObjectByID(inventoryIdToVehId[inventoryId])
if vehObj then
table.sort(inventoryIdsList, function(id1, id2)
local veh1 = getObjectByID(inventoryIdToVehId[id1])
local veh2 = getObjectByID(inventoryIdToVehId[id2])
local veh1 = getObjectByID(inventoryIdToVehId[id1])
local veh2 = getObjectByID(inventoryIdToVehId[id2])
return veh1:getPosition():distance(playerPos) < veh2:getPosition():distance(playerPos)
end
local vehObj = getObjectByID(inventoryIdToVehId[inventoryId])
setPartConditionResetSnapshot(vehObj,
@/lua/ge/extensions/career/modules/delivery/vehicleTasks.lua
elseif activeTaskStep.type == "enterVehicle" or activeTaskStep.type == "coupleTrailer" then
local veh = getObjectByID(task.vehId)
if veh then
table.insert(vehicleRewardData, formatted)
local veh = getObjectByID(taskData.vehId)
if veh then
if activeTask.type == "confirmDropOff" then
local veh = getObjectByID(taskData.vehId)
if veh then
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/aiParams.lua
if self.pinIn.vehId.value then
veh = getObjectByID(self.pinIn.vehId.value)
else
@/lua/ge/extensions/core/devices.lua
local veh = getObjectByID(newId)
if veh then
@/lua/ge/extensions/flowgraph/nodes/util/distanceBetween.lua
if type(pinInput) == 'number' then
local veh = getObjectByID(pinInput)
@/lua/ge/extensions/editor/trafficManager.lua
local sessionData = session.vehicles[name] or {id = 0}
local veh = getObjectByID(sessionData.id)
if not sessionData or not veh then return end
local sessionData = session.vehicles[name] or {id = 0}
local veh = getObjectByID(sessionData.id)
if not sessionData or not veh then return end
if scenetree.objectExists(id) and not data.locked then
getObjectByID(data.id):delete()
end
local function createVehicleData(vehId, vehData) -- creates or updates vehicle data
local veh = getObjectByID(vehId)
if not veh then return end
if scenetree.objectExists(session.playerId or 0) then
be:enterVehicle(0, getObjectByID(session.playerId))
end
if playerId and playerId > 0 then
local playerVeh = getObjectByID(playerId)
if playerVeh then
local vehId = sessionData and sessionData.id or 0
local currVeh = getObjectByID(vehId)
if not currVeh then
if scenetree.objectExists(id) and not data.locked then
getObjectByID(data.id):queueLuaCommand('recovery.loadHome()')
createVehicleData(data.id)
if deleteId then
getObjectByID(deleteId):delete()
end
if getObjectByID(session.playerId) then
be:enterVehicle(0, getObjectByID(session.playerId))
if getObjectByID(session.playerId) then
be:enterVehicle(0, getObjectByID(session.playerId))
end
local prefix = "obj"
local obj = getObjectByID(id)
local modelData = core_vehicles.getModel(obj.jbeam)
@/lua/ge/extensions/flowgraph/nodes/scene/camera/cameraCircle.lua
if self.pinIn.vehId.value then -- if vehicle id is given, the start angle is relative to the vehicle orientation
local veh = getObjectByID(self.pinIn.vehId.value)
if veh then
else
local veh = getObjectByID(self.pinIn.vehId.value or be:getPlayerVehicleID(0))
if veh then
@/lua/ge/extensions/core/input/actions.lua
if playerVehicleId then
local playerVehicle = getObjectByID(playerVehicleId)
if playerVehicle then
@/lua/ge/extensions/scenario/scenarios.lua
for k, vid in pairs(scenario.vehicleNameToId) do
local bo = getObjectByID(vid)
if bo then
for vecName, vid in pairs(scenario.vehicleNameToId) do
local vehicle = getObjectByID(vid)
scenario.startingTransforms[vecName] = {pos = vehicle:getPosition(), rot = vehicle:getRotation()}
for vehicleID,_ in pairs(scenario.aiControlledVehiclesById) do
local vehicle = getObjectByID(vehicleID)
if vehicle then
@/lua/ge/extensions/core/busRouteManager.lua
if id then
local veh = getObjectByID(id)
if veh then
@/lua/ge/extensions/core/dynamicProps.lua
getObjectByID(vehId):setActive(0)
self.props[vehId] = false
forest:getData():updateItem(forestItem:getKey(), underTheMap, forestItem:getData(), forestItem:getTransform(), forestItem:getScale(), forestItem:getUid())
getObjectByID(propId):setActive(1)
--spawn.safeTeleport(scenetree.findObjectById(propId), (locationInfo.originPos + self.spawnOffset), quat(0, 0, 0, 0))
--check fov, actual distance etc
--local actualPosToCheck = locationInfo.switched and getObjectByID(locationInfo.linkedPropId):getPosition() or locationInfo.originPos
--if checkVisibility(actualPosToCheck) then
@/lua/ge/extensions/editor/aiTests.lua
local function insertVehicle(id) -- adds an AI vehicle to use for the tests
local obj = getObjectByID(id or 0)
if not obj then return end
for _, id in ipairs(vehicleIds) do -- vehicle validator loop
local obj = getObjectByID(id)
if not obj then
if im.Button("Merge Positions##aiParams") then
local firstVeh = getObjectByID(vehicleIds[1])
if firstVeh then
for k, v in pairs(vehicles) do
getObjectByID(k):setPosRot(pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, rot.w)
end
else
local obj = getObjectByID(currId)
local pos = obj:getPosition()
for k, v in pairs(vehicles) do
local obj = getObjectByID(k)
v.pos:set(obj:getPosition())
for k, v in pairs(vehicles) do
getObjectByID(k):queueLuaCommand("ai.setMode('stop')")
end
for k, v in pairs(vehicles) do
getObjectByID(k):setPosRot(v.pos.x, v.pos.y, v.pos.z, v.rot.x, v.rot.y, v.rot.z, v.rot.w)
end
for k, v in pairs(vehicles) do
getObjectByID(k):reload()
end
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veAeroDebug.lua
local function onVehicleSwitched(oldVehicle, newVehicle, player)
local oldVeh = getObjectByID(oldVehicle)
if oldVeh then
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/disable.lua
if self.pinIn.aiVehId.value then
veh = getObjectByID(self.pinIn.aiVehId.value)
else