GE Lua Documentation

Press F to search!

onVehicleActiveChanged

Definition


-- @/lua/ge/extensions/gameplay/parking.lua:710

local function onVehicleActiveChanged(vehId, active)
  if vehPool and parkedVehData[vehId] then
    if not active then
      parkedVehData[vehId]._teleport = true
    else
      if parkedVehData[vehId]._teleport then -- force teleport if flag exists
        for _, otherVeh in ipairs(getAllVehicles()) do
          local otherId = otherVeh:getId()
          if otherVeh:getActive() and not parkedVehData[otherId] then
            local radius = otherVeh:isPlayerControlled() and 100 or 20
            if otherVeh:getPosition():squaredDistance(getObjectByID(vehId):getPosition()) < square(radius) then
              forceTeleport(vehId, nil, 100)
              break
            end
          end
        end
      end
    end
  end
end

Callers

@/lua/ge/extensions/gameplay/traffic.lua

local function onVehicleActiveChanged(vehId, active)
  if traffic[vehId] and traffic[vehId].isAi then
@/lua/ge/extensions/core/vehicleActivePooling.lua

local function onVehicleActiveChanged(vehId, active)
  for _, pool in pairs(pools) do
@/lua/ge/extensions/freeroam/specialTriggers.lua

local function onVehicleActiveChanged(vehId, active)
  if not M.active then return end
@/lua/ge/extensions/gameplay/rally.lua

local function onVehicleActiveChanged(vehicleID, active)
  -- log('D', logTag, 'onVehicleActiveChanged')
@/lua/ge/extensions/gameplay/rallyLoop.lua

-- local function onVehicleActiveChanged(vehicleID, active)
  -- log('D', logTag, 'onVehicleActiveChanged')
@/lua/ge/extensions/core/trailerRespawn.lua

local function onVehicleActiveChanged(vehId, active)
  -- sets the vehicle's trailer visibility state to match the owner