diff --git a/builtin/fstk/tabview.lua b/builtin/fstk/tabview.lua index 45d37b1f..eda52976 100644 --- a/builtin/fstk/tabview.lua +++ b/builtin/fstk/tabview.lua @@ -78,7 +78,7 @@ local function get_formspec(self) if not self.hidden and (self.parent == nil or not self.parent.hidden) then local name = self.tablist[self.last_tab_index].name - local tabname = (name == "local" or name == "online") and name + local tabname = (name == "local" or name == "online" or name == "hosting") and name if self.parent == nil then local tsize = self.tablist[self.last_tab_index].tabsize or diff --git a/builtin/mainmenu/dlg_delete_world.lua b/builtin/mainmenu/dlg_delete_world.lua index 6f6167c6..407a7503 100644 --- a/builtin/mainmenu/dlg_delete_world.lua +++ b/builtin/mainmenu/dlg_delete_world.lua @@ -31,6 +31,12 @@ end local function delete_world_buttonhandler(this, fields) if fields["world_delete_confirm"] then + if this.data.callback then + this:delete() + this.data.callback() + return true + end + if this.data.delete_index > 0 and this.data.delete_index <= #menudata.worldlist:get_raw_list() then core.delete_world(this.data.delete_index) @@ -62,3 +68,13 @@ function create_delete_world_dlg(name_to_del, index_to_del) return retval end + +function create_custom_delete_dlg(name_to_del, callback) + assert(name_to_del ~= nil and type(name_to_del) == "string" and name_to_del ~= "") + assert(type(callback) == "function") + + local retval = create_delete_world_dlg(name_to_del, -1, nil) + retval.data.callback = callback + + return retval +end diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index e6b6e273..3e65cc59 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -58,6 +58,12 @@ if not mobile then end tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua") +local hpath = menupath .. DIR_DELIM .. "tab_hosting.lua" +local hosting = io.open(hpath, "r") +if hosting then + tabs.hosting = dofile(hpath) + io.close(hosting) +end tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua") tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua") @@ -97,6 +103,9 @@ local function init_globals() tv_main:add(tabs.local_game) tv_main:add(tabs.play_online) + if tabs.hosting then + tv_main:add(tabs.hosting) + end if not mobile then tv_main:add(tabs.settings) @@ -121,7 +130,7 @@ end core.set_clouds(false) -- mm_texture.set_dirt_bg() - core.set_background("background", defaulttexturedir .. "bg.png", true, 256) + core.set_background("background", defaulttexturedir .. "bg.png", true, 256) -- core.sound_play("main_menu", true) end diff --git a/textures/base/bg_hosting.png b/textures/base/bg_hosting.png new file mode 100644 index 00000000..2f9c3b4b Binary files /dev/null and b/textures/base/bg_hosting.png differ diff --git a/textures/base/btn_play.png b/textures/base/btn_play.png new file mode 100644 index 00000000..aa8f8282 Binary files /dev/null and b/textures/base/btn_play.png differ diff --git a/textures/base/server_off.png b/textures/base/server_off.png new file mode 100644 index 00000000..217755f7 Binary files /dev/null and b/textures/base/server_off.png differ diff --git a/textures/base/server_on.png b/textures/base/server_on.png new file mode 100644 index 00000000..62b72c30 Binary files /dev/null and b/textures/base/server_on.png differ