getTrafficData
Definition
-- @/lua/ge/extensions/gameplay/traffic.lua:101
local function getTrafficData() -- returns the full traffic table
return traffic
end
Callers
@/gameplay/missionTypes/chase/constructor.lua
unlockedStars.completeTraffic = false
for id, v in pairs(gameplay_traffic.getTrafficData()) do
if be:getObjectActive(id) and v.roleName == 'standard' then
@/lua/ge/extensions/gameplay/taxi.lua
local trafficVeh = gameplay_traffic.getTrafficData()[currentTaxiId]
if trafficVeh and trafficVeh.role then
if not veh then return end
local trafficVeh = gameplay_traffic.getTrafficData()[currentTaxiId]
if trafficVeh and trafficVeh.role then
@/lua/ge/extensions/flowgraph/modules/trafficModule.lua
function C:updateTrafficState()
self.trafficActive = next(gameplay_traffic.getTrafficData()) and true or false
end
@/lua/ge/extensions/gameplay/traffic/trafficUtils.lua
local traffic = gameplay_traffic.getTrafficData()
for _, veh in ipairs(getAllVehicles()) do
@/lua/ge/extensions/career/modules/linearTutorial.lua
for k, v in pairs(gameplay_traffic.getTrafficData()) do
if v.role.name == "police" then
for k, v in pairs(gameplay_traffic.getTrafficData()) do
if v.role.name == "police" then
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
local targetId = id or self.targetId
local targetVeh = targetId and gameplay_traffic.getTrafficData()[targetId]
if targetVeh then
function C:onDeserialized(data)
self.veh = gameplay_traffic.getTrafficData()[data.id]
self.name = data.name
@/lua/ge/extensions/editor/trafficManager.lua
local aiData = sessionData.aiData or {}
local trafficData = gameplay_traffic.getTrafficData()
if not trafficData[sessionData.id] and aiData.enableTraffic then
gameplay_traffic.insertTraffic(sessionData.id, false, true)
local traffic = gameplay_traffic.getTrafficData()
if traffic[sessionData.id] then
@/gameplay/missionTypes/evade/customNodes/getClosestTrafficNode.lua
self.pos:setFromTable(self.pinIn.position.value)
for k, v in pairs(gameplay_traffic.getTrafficData()) do
if not role or role == v.role.name then
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
for otherId, otherVeh in pairs(gameplay_traffic.getTrafficData()) do -- notify other traffic vehicles of collision
if not otherVeh.otherCollisionFlag and otherId ~= self.id and otherId ~= id then
if self.isAi then
veh = gameplay_traffic.getTrafficData()[id]
if veh and veh.isPerson then -- specific logic that handles collision with unicycle (walking mode)
for id, coll in pairs(self.collisions) do
local veh = gameplay_traffic.getTrafficData()[id]
if veh then
for id, veh in pairs(gameplay_traffic.getTrafficData()) do
if id ~= self.id then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/getVehicleData.lua
function C:work()
local veh = gameplay_traffic.getTrafficData()[self.pinIn.vehId.value or 0]
if veh then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/setupPursuitGameplay.lua
if self.pinOut.success.value then -- prevents the scatter traffic function from teleporting these vehicles
local traffic = gameplay_traffic.getTrafficData()
traffic[suspectId].ignoreForceTeleport = true
@/gameplay/missionTypes/aiRace/constructor.lua
unlockedStars.trafficRace = false
for id, v in pairs(gameplay_traffic.getTrafficData()) do
if be:getObjectActive(id) and v.roleName == 'standard' then
@/lua/ge/extensions/ui/apps/minimap/vehicles.lua
local playerVehId = be:getPlayerVehicleID(0)
local traffic = gameplay_traffic.getTrafficData()
local parking = gameplay_parking.getParkedCarsData()
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/pursuitMode.lua
local vehId = self.pinIn.targetId.value or be:getPlayerVehicleID(0)
if not gameplay_traffic.getTrafficData()[vehId] then
gameplay_traffic.insertTraffic(vehId, vehId == be:getPlayerVehicleID(0)) -- assumes that player vehicle is not AI
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/drivingStats.lua
local vehId = self.pinIn.vehId.value or be:getPlayerVehicleID(0)
local vehData = gameplay_traffic.getTrafficData()[vehId]
if not vehData then return end
@/lua/ge/extensions/career/modules/playerDriving.lua
playerData.traffic = gameplay_traffic.getTrafficData()[newId]
playerData.parking = gameplay_parking.getTrackingData()[newId]
for k, v in pairs(gameplay_traffic.getTrafficData()) do
if v.role.name == "police" then
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/setVehicleFlowgraph.lua
if self.vehId then
local veh = gameplay_traffic.getTrafficData()[self.vehId]
if veh then
local veh = gameplay_traffic.getTrafficData()[self.vehId or 0]
if veh then
@/lua/ge/extensions/gameplay/traffic/roles/standard.lua
if self.driver.eventType ~= 'selfCollision' then
local targetVeh, secondVeh = gameplay_traffic.getTrafficData()[id1], gameplay_traffic.getTrafficData()[id2]
if not targetVeh or not secondVeh then return end
if self.driver.eventType ~= 'selfCollision' then
local targetVeh, secondVeh = gameplay_traffic.getTrafficData()[id1], gameplay_traffic.getTrafficData()[id2]
if not targetVeh or not secondVeh then return end
local targetId = targetVeh.speed < secondVeh.speed and id1 or id2 -- target the slower vehicle in collision
if targetId == id2 then targetVeh = gameplay_traffic.getTrafficData()[targetId] end
local targetVeh = self.targetId and gameplay_traffic.getTrafficData()[self.targetId]
self.targetVisible = self:checkTargetVisible()
local targetVeh = self.targetId and gameplay_traffic.getTrafficData()[self.targetId]
if targetVeh then
@/lua/ge/extensions/gameplay/traffic/roles/police.lua
if args.targetId then
local targetVeh = gameplay_traffic.getTrafficData()[args.targetId]
if targetVeh then
function C:checkTarget() -- returns the ideal target id, comparing the pursuit scores of all vehicles
local traffic = gameplay_traffic.getTrafficData()
local targetId
self.flags.targetVisible = nil
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
function C:onTrafficTick(dt)
for id, veh in pairs(gameplay_traffic.getTrafficData()) do -- update data of potential targets
if id ~= self.veh.id and veh.role.name ~= 'police' and not veh.ignorePolice and not self.flags.cooldown then
if self.flags.pursuit and self.validTargets[id].visible and not self.flags.targetVisible then
local targetVeh = self.targetId and gameplay_traffic.getTrafficData()[self.targetId]
if targetVeh then
local targetVeh = self.targetId and gameplay_traffic.getTrafficData()[self.targetId]
if self.veh.isAi and targetVeh and self.state ~= 'disabled' and self.veh.state == 'active' then
function C:onUpdate(dt, dtSim)
local targetVeh = self.targetId and gameplay_traffic.getTrafficData()[self.targetId]
@/gameplay/missionTypes/evade/customNodes/scatterTrafficAwayNode.lua
function C:workOnce()
for id, v in pairs(gameplay_traffic.getTrafficData()) do
if v.isAi then
@/lua/ge/extensions/gameplay/police.lua
local veh = getObjectByID(propId or 0)
if veh and not gameplay_traffic.getTrafficData()[propId] and not arrayFindValueIndex(policePropIds, propId) then
table.insert(policePropIds, propId)
local state, isPolice = false, false
local traffic = gameplay_traffic.getTrafficData()
local currVeh = traffic[id]
local traffic = gameplay_traffic.getTrafficData()
local targetVeh = traffic[targetId]
local function setSuspect(id) -- changes a traffic vehicle's role to 'suspect'
local veh = gameplay_traffic.getTrafficData()[id or 0]
if veh then
local function arrestVehicle(id, showMessages) -- instantly sets a vehicle as arrested
local veh = gameplay_traffic.getTrafficData()[id]
if not veh then return end
local function evadeVehicle(id, showMessages) -- instantly sets a vehicle as evaded
local veh = gameplay_traffic.getTrafficData()[id]
if not veh then return end
local veh = gameplay_traffic.getTrafficData()[id]
if not veh then
gameplay_traffic.insertTraffic(suspectId, suspectId == options.playerId, true) -- the third argument prevents the vehicle from becoming deactivated due to the vehicle pooling system
local veh = gameplay_traffic.getTrafficData()[suspectId]
if veh then
gameplay_traffic.insertTraffic(id, id == options.playerId, true)
veh = gameplay_traffic.getTrafficData()[id]
if veh then
id = id or be:getPlayerVehicleID(0)
local veh = id and gameplay_traffic.getTrafficData()[id]
if veh then
local function onTrafficAction(id, action, data)
if gameplay_traffic.getTrafficData()[id] then
if action == 'changeRole' then
if not policeVehs[id] then
policeVehs[id] = gameplay_traffic.getTrafficData()[id]
end
local function onTrafficVehicleAdded(id)
if gameplay_traffic.getTrafficData()[id].role.name == 'police' then
policeVehs[id] = gameplay_traffic.getTrafficData()[id]
if gameplay_traffic.getTrafficData()[id].role.name == 'police' then
policeVehs[id] = gameplay_traffic.getTrafficData()[id]
end
if obj and obj:isPlayerControlled() then
local traffic = gameplay_traffic.getTrafficData()
if not traffic[newId] then
local traffic = gameplay_traffic.getTrafficData()
if traffic[id] and traffic[id].isAi then
for id, veh in pairs(gameplay_traffic.getTrafficData()) do
local pursuit = veh.pursuit
@/gameplay/missionTypes/evade/constructor.lua
unlockedStars.completeTraffic = false
for id, v in pairs(gameplay_traffic.getTrafficData()) do
if be:getObjectActive(id) and v.roleName == 'standard' then
@/lua/ge/extensions/editor/trafficDebug.lua
end
traffic = gameplay_traffic.getTrafficData()
@/gameplay/missionTypes/evade/customNodes/pursuitReadyPoliceNode.lua
local traffic = gameplay_traffic.getTrafficData()
for _, vehId in ipairs(self.pinIn.vehicleIds.value) do
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/setVehicleData.lua
function C:workOnce()
local veh = gameplay_traffic.getTrafficData()[self.pinIn.vehId.value or 0]
if veh then