makeVehicleLicenseText
Definition
-- @/lua/ge/extensions/core/vehicles.lua:2028
local function makeVehicleLicenseText(veh, designPath)
if forceLicenceStr then
return forceLicenceStr
end
if FS:fileExists("settings/cloud/forceLicencePlate.txt") then
local content = readFile("settings/cloud/forceLicencePlate.txt")
if content ~= nil then
log("D","makeVehicleLicenseText","forced to used LicencePlate.txt = '"..tostring(content).."'")
return content
end
end
veh = veh or getPlayerVehicle(0)
if type(veh) == 'number' then
veh = getObjectByID(veh)
end
if not veh then return '' end
local txt = veh:getDynDataFieldbyName("licenseText", 0)
if txt and txt:len() > 0 then
return txt
end
local design = nil
if designPath then
design = jsonReadFile(designPath)
end
if settings.getValue("useSteamName") and core_gamestate.state.state == "freeroam" and veh.autoEnterVehicle and SteamLicensePlateVehicleId == nil and OnlineServiceProvider and OnlineServiceProvider.isWorking and OnlineServiceProvider.accountLoggedIn then
SteamLicensePlateVehicleId = veh:getId()
txt = OnlineServiceProvider.playerName
txt = txt:gsub('"', "'") -- replace " with '
-- more cleaning up required?
elseif not design or not design.data or not design.version or (design.version and design.version == 1) then
txt = generateLicenceText()
elseif design.version and design.version > 1 then
txt = generateLicenceText(design.data or nil, veh)
end
return txt
end
Callers
@/lua/ge/extensions/core/vehicles.lua
local designPath = veh:getDynDataFieldbyName("licenseDesign", 0) or ''
generated_txt = makeVehicleLicenseText(veh, designPath)
veh:setDynDataFieldbyName("licenseText", 0, current_txt)
if not txt then
txt = makeVehicleLicenseText(veh, designPath)
end
@/lua/ge/extensions/core/vehicle/partmgmt.lua
end
data.licenseName = extensions.core_vehicles.makeVehicleLicenseText()
end
data.licenseName = extensions.core_vehicles.makeVehicleLicenseText()