Empty Traffic Role
Reference for the `empty` traffic role, a minimal role that prevents extra actions or AI logic from being applied to a vehicle. Used when a vehicle needs to be in the traffic system but should not hav
Reference for the empty traffic role, a minimal role that prevents extra actions or AI logic from being applied to a vehicle. Used when a vehicle needs to be in the traffic system but should not have standard/police behavior (e.g., during non-traffic AI modes like flee or chase).
Role Definition
local C = {}
function C:init()
self.actions = {}
for k, v in pairs(self.baseActions) do
self.actions[k] = v
end
self.baseActions = nil
end
return function(...) return require('/lua/ge/extensions/gameplay/traffic/baseRole')(C, ...) endBehavior
- No custom actions - Only inherits base actions (
pullOver,disabled) - No personality modifiers - Uses default neutral personality
- No custom tick/update logic - All lifecycle callbacks are inherited no-ops
- Purpose: Acts as a "null" role - the vehicle exists in traffic but doesn't exhibit any role-specific behavior
How It's Used
The traffic system temporarily assigns the empty role when:
- A vehicle's AI mode is changed to something other than
"traffic"(e.g.,"flee","chase") - The previous role is stored in
veh._tempRole - When the AI mode returns to
"traffic", the original role is restored
-- From gameplay_traffic.setTrafficVars():
if data.aiMode ~= 'traffic' and veh.roleName ~= 'empty' then
veh._tempRole = veh.roleName
veh:setRole('empty')
endUsage Example
-- Manually assign empty role
local veh = gameplay_traffic.getTrafficData()[vehId]
veh:setRole('empty')See Also
- gameplay/traffic/roles/police - Police Traffic Role - Related reference
- gameplay/traffic/roles/standard - Standard Civilian Traffic Role - Related reference
- gameplay/traffic/roles/suspect - Suspect Traffic Role - Related reference
- Gameplay Systems Guide - Guide
Traffic Vehicle
Reference for the traffic vehicle class (`gameplay/traffic/vehicle`), instantiated for each vehicle in the traffic system. Manages per-vehicle state including position tracking, damage detection, coll
Police Traffic Role
Reference for the `police` traffic role, which implements pursuit behavior including chasing suspects, managing sirens, avoiding head-on collisions, setting up roadblocks, and coordinating with the po