Electus Computers Available Files
Browse the Electus Computers source files and configuration by folder.
config/config.lua
Config = Config or {}
Config.Framework = "esx"
Config.Inventory = "ox_inventory"
Config.NotificationSystem = "ox_lib"
Config.MenuSystem = "ox_lib_context"
Config.HelpTextStyle = "native" -- "native": built-in action strip, "auto": Loaf Wrapper's detected text UI
Config.CompanyMoneySystem = "auto"
Config.DispatchSystem = "auto"
Config.PhoneSystem = "lb-phone" -- "lb-phone", "roadphone", "yseries", or "none"
Config.PhoneSystemResource = "lb-phone"
-- Sends connection codes and photo texts on phones without server passcode or gallery exports (RoadPhone, YSeries).
-- Keep it shorter than player numbers so it can never be a real player's phone.
Config.PhoneServiceNumber = "5550"
Config.Target = "auto"
Config.Debug = false
Config.DebugPoly = false
Config.Locale = "en"
Config.Security = {
-- Calls per minute each player may make to a single server callback. Callbacks with their own limit keep it.
defaultCallbackRateLimit = 120,
}
Config.Images = {
-- Player-linked images (wallpapers, listings, gallery, documents) load on other players' screens,
-- so an unknown host could log their IP addresses. Only https URLs on these hosts are accepted.
-- "*.example.com" also matches subdomains. Set to false to allow any http(s) host.
allowedHosts = {
"*.fivemanage.com",
"fivemanage.com",
"i.imgur.com",
"i.ibb.co",
"cdn.discordapp.com",
"media.discordapp.net",
"*.lbphone.com",
},
-- Item pictures in the shop screen; %s is the item name. A path in this resource, or another resource's images
-- such as "nui://ox_inventory/web/images/%s.png". Set to false to list items without pictures.
items = "integrations/images/%s.png",
}
---@param language string
---@return table<string, string|string[]>
local function LoadConfiguredLocale(language)
local rawLocales = LoadResourceFile(GetCurrentResourceName(), "config/locales/" .. language .. ".lua")
if not rawLocales then
print(("Locale file '%s.lua' not found"):format(language))
return {}
end
local fn, err = load(rawLocales)
if not fn then
print(("Failed to load locale file '%s.lua': %s"):format(language, err or ""))
return {}
end
local formattedLocales = {}
---@param localeTable table
---@param prefix? string
local function FormatLocales(localeTable, prefix)
prefix = prefix or ""
for key, value in pairs(localeTable) do
if type(value) == "table" and #value == 0 then
FormatLocales(value, prefix .. key .. ".")
else
formattedLocales[prefix .. key] = value
end
end
end
FormatLocales(fn())
return formattedLocales
end
local configuredLocales = LoadConfiguredLocale(Config.Locale)
if Config.Locale ~= "en" then
for path, value in pairs(LoadConfiguredLocale("en")) do
if not configuredLocales[path] then
configuredLocales[path] = value
end
end
end
---@param path string
---@param args? table<string, any>
---@return string
function L(path, args)
local translation = configuredLocales[path] or path
if args then
for key, value in pairs(args) do
-- Parenthesised so gsub's match count isn't passed on as the replacement limit.
translation = translation:gsub("{" .. key .. "}", (tostring(value):gsub("%%", "%%%%")))
end
end
return translation
end
---@return table<string, string|string[]>
function GetAllLocales()
return configuredLocales
end