GE Lua Documentation

Press F to search!

evadeVehicle

Definition


-- @/lua/ge/extensions/gameplay/police.lua:360

local function evadeVehicle(id, showMessages) -- instantly sets a vehicle as evaded
  local veh = gameplay_traffic.getTrafficData()[id]
  if not veh then return end

  if showMessages then
    if be:getPlayerVehicleID(0) == id then
      ui_message('ui.traffic.policeEvade', 5, 'traffic', 'traffic')
    elseif be:getPlayerVehicleID(0) == veh.role.targetId or policeVehs[be:getPlayerVehicleID(0)] then
      ui_message('ui.traffic.suspectEvade', 5, 'traffic', 'traffic')
    end
  end

  suspectActive = false
  if veh.isAi then
    suspectTimerDelay = suspectTimerDelay + 60 -- extends the timed delay for the next suspect; perhaps this should be reconsidered
  end

  extensions.hook('onPursuitAction', id, 'evade', veh.pursuit)

  local tempIds = {}
  for pid, p in pairs(policeVehs) do
    if p.role.targetId == id then
      table.insert(tempIds, pid)
    end
  end
  setPursuitMode(0, id, tempIds)
end

Callers

@/lua/ge/extensions/career/modules/playerDriving.lua
      log("I", "career", "Ending pursuit early due to conflict")
      gameplay_police.evadeVehicle(be:getPlayerVehicleID(0), true)
      playerData.pursuitStuckTimer = 0
@/lua/ge/extensions/gameplay/police.lua
          if pursuit.timers.evade >= vars.evadeTime then
            evadeVehicle(id, gameplay_traffic.showMessages)
          end
@/lua/ge/extensions/gameplay/traffic/roles/suspect.lua
  if gameplay_traffic.showMessages and be:getPlayerVehicleID(0) == self.targetId then
    gameplay_police.evadeVehicle(self.veh.id, true)
  end