GE Lua Documentation

Press F to search!

getFacility

Definition


-- @/lua/ge/extensions/freeroam/facilities.lua:102

-- returns a single facility element.
local function getFacility(type, id)
  local levelName = getCurrentLevelIdentifier()
  if not levelName or levelName == '' then log("E","","Tried to get facility without level!") return end

  local facilities = getFacilities(levelName)
  local listName = facilityTypeToListName[type] or "none"
  if listName == "none" then log("E","","Tried to get facility of type " .. dumps(type)..", which is not a valid type! ("..dumps(tableKeysSorted(facilityTypeToListName))) end

  for _, f in ipairs(facilities[listName]) do
    if f.id == id then
      return f
    end
  end
  log("E","","Could not find facility with id " .. dumps(id))
end

Callers

@/lua/ge/extensions/career/modules/insurance/repairScreen.lua
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)
@/lua/ge/extensions/gameplay/rawPois.lua
      local elements = {}
      local garage = freeroam_facilities.getFacility("computer", "servicestationGarageComputer")
      freeroam_facilities.formatFacilityToRawPoi(garage, elements)
@/lua/ge/extensions/career/modules/partInventory.lua
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)
@/lua/ge/extensions/career/modules/vehicleShopping.lua
  if currentSeller then
    local tetherPos = freeroam_facilities.getAverageDoorPositionForFacility(freeroam_facilities.getFacility("dealership",currentSeller))
    tether = career_modules_tether.startSphereTether(tetherPos, tetherRange, M.endShopping)
  elseif originComputerId then
    computer = freeroam_facilities.getFacility("computer", originComputerId)
    tether = career_modules_tether.startDoorTether(computer.doors[1], nil, M.endShopping)
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)
@/lua/ge/extensions/career/modules/tuning.lua
  -- calculate computer position
  local computerPos = freeroam_facilities.getAverageDoorPositionForFacility(freeroam_facilities.getFacility("computer", originComputerId))
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)
@/lua/ge/extensions/career/modules/painting.lua
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)
@/lua/ge/extensions/freeroam/facilities.lua

local function getGarage(id) return getFacility("garage", id) end
local function getGasStation(id) return getFacility("gasStation", id) end
local function getGarage(id) return getFacility("garage", id) end
local function getGasStation(id) return getFacility("gasStation", id) end
local function getDealership(id) return getFacility("dealership", id) end
local function getGasStation(id) return getFacility("gasStation", id) end
local function getDealership(id) return getFacility("dealership", id) end
@/lua/ge/extensions/career/modules/computer.lua
local function openComputerMenuById(computerId)
  local computer = freeroam_facilities.getFacility("computer", computerId)
  career_modules_computer.openMenu(computer)
@/lua/ge/extensions/career/modules/loanerVehicles.lua
    local options = {model = offer.model, config = offer.config, autoEnterVehicle = false}
    local fac = freeroam_facilities.getFacility(offer.sourceFacility.type, offer.sourceFacility.id)
    table.insert(sequence, util_stepHandler.makeStepSpawnVehicle(options,
@/lua/ge/extensions/career/modules/playerAbstract.lua
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)
@/lua/ge/extensions/career/modules/insurance/insurance.lua
    if originComputerId then
      local computer = freeroam_facilities.getFacility("computer", originComputerId)
      career_modules_computer.openMenu(computer)
@/lua/ge/extensions/career/modules/partShopping.lua
  -- calculate computer position
  local computerPos = freeroam_facilities.getAverageDoorPositionForFacility(freeroam_facilities.getFacility("computer",originComputerId))
  if originComputerId then
    local computer = freeroam_facilities.getFacility("computer", originComputerId)
    career_modules_computer.openMenu(computer)