Fix main menu freezing
This commit is contained in:
parent
bb018bc76b
commit
30a8ee8d9f
@ -48,11 +48,16 @@ LUI.addmenubutton("main_campaign", {
|
|||||||
|
|
||||||
function getmodname(path)
|
function getmodname(path)
|
||||||
local name = path
|
local name = path
|
||||||
local desc = Engine.Localize("@LUA_MENU_MOD_DESC_DEFAULT", name)
|
game:addlocalizedstring(name, name)
|
||||||
|
game:addlocalizedstring("LUA_MENU_MOD_DESC_DEFAULT", "Load &&1.")
|
||||||
|
local desc = Engine.Localize("LUA_MENU_MOD_DESC_DEFAULT", name)
|
||||||
local infofile = path .. "/info.json"
|
local infofile = path .. "/info.json"
|
||||||
|
|
||||||
if (io.fileexists(infofile)) then
|
if (io.fileexists(infofile)) then
|
||||||
pcall(function()
|
pcall(function()
|
||||||
|
game:addlocalizedstring(data.description)
|
||||||
|
game:addlocalizedstring(data.author)
|
||||||
|
game:addlocalizedstring(data.version)
|
||||||
local data = json.decode(io.readfile(infofile))
|
local data = json.decode(io.readfile(infofile))
|
||||||
desc = Engine.Localize("@LUA_MENU_MOD_DESC",
|
desc = Engine.Localize("@LUA_MENU_MOD_DESC",
|
||||||
data.description, data.author, data.version)
|
data.description, data.author, data.version)
|
||||||
@ -82,7 +87,8 @@ LUI.MenuBuilder.m_types_build["mods_menu"] = function(a1)
|
|||||||
|
|
||||||
local modfolder = game:getloadedmod()
|
local modfolder = game:getloadedmod()
|
||||||
if (modfolder ~= "") then
|
if (modfolder ~= "") then
|
||||||
createdivider(menu, Engine.Localize("@LUA_MENU_LOADED_MOD", getmodname(modfolder):truncate(24)))
|
local name = getmodname(modfolder)
|
||||||
|
createdivider(menu, Engine.Localize("@LUA_MENU_LOADED_MOD", name:truncate(24)))
|
||||||
|
|
||||||
menu:AddButton("@LUA_MENU_UNLOAD", function()
|
menu:AddButton("@LUA_MENU_UNLOAD", function()
|
||||||
game:executecommand("unloadmod")
|
game:executecommand("unloadmod")
|
||||||
|
27
data/ui_scripts/patches/__init__.lua
Normal file
27
data/ui_scripts/patches/__init__.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
local maps = {
|
||||||
|
"af_caves",
|
||||||
|
"af_chase",
|
||||||
|
"airport",
|
||||||
|
"arcadia",
|
||||||
|
"boneyard",
|
||||||
|
"cliffhanger",
|
||||||
|
"contingency",
|
||||||
|
"dc_whitehouse",
|
||||||
|
"dcburning",
|
||||||
|
"dcemp",
|
||||||
|
"ending",
|
||||||
|
"estate",
|
||||||
|
"favela",
|
||||||
|
"favela_escape",
|
||||||
|
"gulag",
|
||||||
|
"invasion",
|
||||||
|
"oilrig",
|
||||||
|
"roadkill",
|
||||||
|
"trainer",
|
||||||
|
"museum",
|
||||||
|
}
|
||||||
|
|
||||||
|
for i = 1, #maps do
|
||||||
|
local string = "LUA_MENU_SP_LOCATION_" .. maps[i]:upper()
|
||||||
|
game:addlocalizedstring(string, string)
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user