GE Lua Documentation

Press F to search!

getCurrentParkingSpot

Definition


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

local function getCurrentParkingSpot(vehId) -- returns the parking spot id of a properly parked vehicle (no tracked data needed)
  vehId = vehId or be:getPlayerVehicleID(0)
  if not getObjectByID(vehId) then return end

  if trackedVehData[vehId] then
    if trackedVehData[vehId].preParked then
      return trackedVehData[vehId].parkingSpotId -- existing tracked data
    end
  else
    local obj = getObjectByID(vehId)
    if not obj then return end

    local psList = findParkingSpots(obj:getPosition(), 0, 15)
    if psList[1] and psList[1].ps:vehicleFits(vehId) and psList[1].ps:checkParking(vehId, vars.precision) then
      return psList[1].ps.id
    end
  end
end

Callers

@/lua/ge/extensions/career/modules/playerDriving.lua
  -- oldId is optional and is used if the vehicle was switched
  playerData.isParked = gameplay_parking.getCurrentParkingSpot(newId) and true or false
@/lua/ge/extensions/gameplay/parking.lua

    local psId = getCurrentParkingSpot(id)
    if psId then
@/lua/ge/extensions/flowgraph/nodes/gameplay/sites/parkingspotByName.lua
  if editor_sitesEditor then
    local ps = editor_sitesEditor.getCurrentParkingSpot()
    if ps then