-
Notifications
You must be signed in to change notification settings - Fork 12
/
modfrontendmain.lua
33 lines (25 loc) · 1023 Bytes
/
modfrontendmain.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local _modname = modname
GLOBAL.setfenv(1, GLOBAL)
local function OnUnloadlevel()
local servercreationscreen = TheFrontEnd:GetOpenScreenOfType("ServerCreationScreen")
if not (servercreationscreen and servercreationscreen.world_tabs) then
return
end
SERVER_LEVEL_LOCATIONS = {"forest", "cave"}
servercreationscreen:SetLevelLocations()
for i, world_tab in ipairs(servercreationscreen.world_tabs) do
local text = world_tab:GetLocationTabName()
servercreationscreen.world_config_tabs.menu.items[i + 1]:SetText(text)
if world_tab.choose_world_button then
world_tab.choose_world_button:Hide()
end
end
end
local _FrontendUnloadMod = ModManager.FrontendUnloadMod
function ModManager:FrontendUnloadMod(modname, ...)
if not modname or modname == _modname then -- modname is nil unload all level
OnUnloadlevel()
ModManager.FrontendUnloadMod = _FrontendUnloadMod
end
return _FrontendUnloadMod(self, modname, ...)
end