mirror of
https://github.com/MCLx86/xtreemtest.git
synced 2025-06-10 01:28:51 +02:00
Compare commits
No commits in common. "78fb1bc302aebfd59750a959fc924c0b579c7596" and "a820a06bfa6711e4c9370173169826d929e490d3" have entirely different histories.
78fb1bc302
...
a820a06bfa
23
README.MD
23
README.MD
@ -7,7 +7,7 @@
|
|||||||
Fork of Minetest, a free-as-in-freedom voxel game engine with easy modding and game creation.
|
Fork of Minetest, a free-as-in-freedom voxel game engine with easy modding and game creation.
|
||||||
|
|
||||||
Copyright (C) 2010-2022 Perttu Ahola <celeron55@gmail.com>
|
Copyright (C) 2010-2022 Perttu Ahola <celeron55@gmail.com>
|
||||||
Copyright (C) 2021-2022 Migdyn <temp1@cubesoftware.xyz>
|
Copyright (C) 2021-2022 Migdyn <xtreemsex@testing.cubesoftware.xyz>
|
||||||
and contributors (see source file comments and the version control log of the original Minetest repository, which can be found [here](https://github.com/minetest/minetest).
|
and contributors (see source file comments and the version control log of the original Minetest repository, which can be found [here](https://github.com/minetest/minetest).
|
||||||
|
|
||||||
|
|
||||||
@ -30,14 +30,16 @@ Table of Contents
|
|||||||
Our goal
|
Our goal
|
||||||
---------
|
---------
|
||||||
Our goal is to create a positive and censorship-free community around MineTest,
|
Our goal is to create a positive and censorship-free community around MineTest,
|
||||||
improve upon the MineTest engine by adding new features to it, as well as integrated
|
improve upon the MineTest engine by adding new features to it, as well as provide
|
||||||
Google AdMob into the engine.
|
a base for future Google Play games.
|
||||||
|
|
||||||
Further documentation
|
Further documentation
|
||||||
----------------------
|
----------------------
|
||||||
- Website: https://mcl.sovnat.info
|
- Website: https://mcl.sovnat.info
|
||||||
|
- Wiki: https://wiki.minetest.net/
|
||||||
|
- Developer wiki: https://dev.minetest.net/
|
||||||
- phpBB forums: https://bb.cubesoftware.xyz
|
- phpBB forums: https://bb.cubesoftware.xyz
|
||||||
- GitHub: https://github.com/MCLx86/xtreemtest/
|
- GitHub: https://github.com/minetest/minetest/
|
||||||
- [doc/](doc/) directory of source distribution
|
- [doc/](doc/) directory of source distribution
|
||||||
|
|
||||||
Default controls
|
Default controls
|
||||||
@ -393,4 +395,15 @@ open ./build/macos/minetest.app
|
|||||||
|
|
||||||
Version scheme
|
Version scheme
|
||||||
--------------
|
--------------
|
||||||
We use the MAJOR.MINOR.PATCH-INFO versioning scheme since version 8.0.0-test
|
We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`.
|
||||||
|
|
||||||
|
- Major is incremented when the release contains breaking changes, all other
|
||||||
|
numbers are set to 0.
|
||||||
|
- Minor is incremented when the release contains new non-breaking features,
|
||||||
|
patch is set to 0.
|
||||||
|
- Patch is incremented when the release only contains bugfixes and very
|
||||||
|
minor/trivial features considered necessary.
|
||||||
|
|
||||||
|
Since 5.0.0-dev and 0.4.17-dev, the dev notation refers to the next release,
|
||||||
|
i.e.: 5.0.0-dev is the development version leading to 5.0.0.
|
||||||
|
Prior to that we used `previous_version-dev`.
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
core.async_jobs = {}
|
|
||||||
|
|
||||||
local function handle_job(jobid, serialized_retval)
|
|
||||||
local retval = core.deserialize(serialized_retval)
|
|
||||||
assert(type(core.async_jobs[jobid]) == "function")
|
|
||||||
core.async_jobs[jobid](retval)
|
|
||||||
core.async_jobs[jobid] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if core.register_globalstep then
|
|
||||||
core.register_globalstep(function(dtime)
|
|
||||||
for i, job in ipairs(core.get_finished_jobs()) do
|
|
||||||
handle_job(job.jobid, job.retval)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
core.async_event_handler = handle_job
|
|
||||||
end
|
|
||||||
|
|
||||||
function core.handle_async(func, parameter, callback)
|
|
||||||
-- Serialize function
|
|
||||||
local serialized_func = string.dump(func)
|
|
||||||
|
|
||||||
assert(serialized_func ~= nil)
|
|
||||||
|
|
||||||
-- Serialize parameters
|
|
||||||
local serialized_param = core.serialize(parameter)
|
|
||||||
|
|
||||||
if serialized_param == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local jobid = core.do_async_callback(serialized_func, serialized_param)
|
|
||||||
|
|
||||||
core.async_jobs[jobid] = callback
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
@ -1,237 +0,0 @@
|
|||||||
--Minetest
|
|
||||||
--Copyright (C) 2014 sapier
|
|
||||||
--
|
|
||||||
--This program is free software; you can redistribute it and/or modify
|
|
||||||
--it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
--the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
--(at your option) any later version.
|
|
||||||
--
|
|
||||||
--This program is distributed in the hope that it will be useful,
|
|
||||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
--GNU Lesser General Public License for more details.
|
|
||||||
--
|
|
||||||
--You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
|
|
||||||
tabview_layouts = {}
|
|
||||||
|
|
||||||
tabview_layouts.tabs = {
|
|
||||||
get = function(self, view)
|
|
||||||
local formspec = ""
|
|
||||||
if view.parent == nil then
|
|
||||||
local tsize = view.tablist[view.last_tab_index].tabsize or
|
|
||||||
{width=view.width, height=view.height}
|
|
||||||
formspec = formspec ..
|
|
||||||
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
|
|
||||||
dump(view.fixed_size))
|
|
||||||
end
|
|
||||||
formspec = formspec .. self:get_header(view)
|
|
||||||
formspec = formspec ..
|
|
||||||
view.tablist[view.last_tab_index].get_formspec(
|
|
||||||
view,
|
|
||||||
view.tablist[view.last_tab_index].name,
|
|
||||||
view.tablist[view.last_tab_index].tabdata,
|
|
||||||
view.tablist[view.last_tab_index].tabsize
|
|
||||||
)
|
|
||||||
|
|
||||||
return formspec
|
|
||||||
end,
|
|
||||||
|
|
||||||
get_header = function(self, view)
|
|
||||||
local toadd = ""
|
|
||||||
for i=1,#view.tablist do
|
|
||||||
if toadd ~= "" then
|
|
||||||
toadd = toadd .. ","
|
|
||||||
end
|
|
||||||
toadd = toadd .. view.tablist[i].caption
|
|
||||||
end
|
|
||||||
|
|
||||||
return string.format("tabheader[%f,%f;%s;%s;%i;true;false]",
|
|
||||||
view.header_x, view.header_y, view.name, toadd, view.last_tab_index);
|
|
||||||
end,
|
|
||||||
|
|
||||||
handle_buttons = function(self, view, fields)
|
|
||||||
--save tab selection to config file
|
|
||||||
if fields[view.name] then
|
|
||||||
local index = tonumber(fields[view.name])
|
|
||||||
view:switch_to_tab(index)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tabview_layouts.vertical = {
|
|
||||||
get = function(self, view)
|
|
||||||
local formspec = ""
|
|
||||||
if view.parent == nil then
|
|
||||||
local tsize = view.tablist[view.last_tab_index].tabsize or
|
|
||||||
{width=view.width, height=view.height}
|
|
||||||
formspec = formspec ..
|
|
||||||
string.format("size[%f,%f,%s]real_coordinates[true]",tsize.width+3,tsize.height,
|
|
||||||
dump(view.fixed_size))
|
|
||||||
end
|
|
||||||
formspec = formspec .. self:get_header(view)
|
|
||||||
formspec = formspec .. "container[3,0]"
|
|
||||||
formspec = formspec ..
|
|
||||||
view.tablist[view.last_tab_index].get_formspec(
|
|
||||||
view,
|
|
||||||
view.tablist[view.last_tab_index].name,
|
|
||||||
view.tablist[view.last_tab_index].tabdata,
|
|
||||||
view.tablist[view.last_tab_index].tabsize
|
|
||||||
)
|
|
||||||
formspec = formspec .. "container_end[]"
|
|
||||||
|
|
||||||
return formspec
|
|
||||||
end,
|
|
||||||
|
|
||||||
get_header = function(self, view)
|
|
||||||
local icon = view.icon
|
|
||||||
local bgcolor = view.bgcolor or "#ACACAC33"
|
|
||||||
local selcolor = view.selcolor or "#ACACAC66"
|
|
||||||
|
|
||||||
local tsize = view.tablist[view.last_tab_index].tabsize or
|
|
||||||
{width=view.width, height=view.height}
|
|
||||||
|
|
||||||
local fs = {
|
|
||||||
("box[%f,%f;%f,%f;%s]"):format(0, 0, 3, tsize.height, bgcolor)
|
|
||||||
}
|
|
||||||
|
|
||||||
if icon then
|
|
||||||
fs[#fs + 1] = "image[1,0.375;1,1;"
|
|
||||||
fs[#fs + 1] = icon
|
|
||||||
fs[#fs + 1] = "]"
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = 1, #view.tablist do
|
|
||||||
local tab = view.tablist[i]
|
|
||||||
local name = "tab_" .. tab.name
|
|
||||||
local y = (i - 1) * 0.8 + 2.25
|
|
||||||
|
|
||||||
fs[#fs + 1] = "label[0.375,"
|
|
||||||
fs[#fs + 1] = tonumber(y)
|
|
||||||
fs[#fs + 1] = ";"
|
|
||||||
fs[#fs + 1] = tab.caption
|
|
||||||
fs[#fs + 1] = "]"
|
|
||||||
|
|
||||||
fs[#fs + 1] = "style["
|
|
||||||
fs[#fs + 1] = name
|
|
||||||
fs[#fs + 1] = ";border=false]"
|
|
||||||
|
|
||||||
fs[#fs + 1] = "button[0,"
|
|
||||||
fs[#fs + 1] = tonumber(y - 0.4 )
|
|
||||||
fs[#fs + 1] = ";3,0.8;"
|
|
||||||
fs[#fs + 1] = name
|
|
||||||
fs[#fs + 1] = ";]"
|
|
||||||
|
|
||||||
if i == view.last_tab_index then
|
|
||||||
fs[#fs + 1] = ("box[%f,%f;%f,%f;%s]"):format(0, y - 0.4, 3, 0.8, selcolor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
print(defaulttexturedir .. "blank.png")
|
|
||||||
|
|
||||||
return table.concat(fs, "")
|
|
||||||
end,
|
|
||||||
|
|
||||||
handle_buttons = function(self, view, fields)
|
|
||||||
for i = 1, #view.tablist do
|
|
||||||
local tab = view.tablist[i]
|
|
||||||
if fields["tab_" .. tab.name] then
|
|
||||||
view:switch_to_tab(i)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tabview_layouts.mainmenu = {
|
|
||||||
backtxt = (defaulttexturedir or "") .. "back.png",
|
|
||||||
|
|
||||||
get = function(self, view)
|
|
||||||
local tab = view.tablist[view.last_tab_index]
|
|
||||||
if tab then
|
|
||||||
return self:get_with_back(view, tab)
|
|
||||||
else
|
|
||||||
return self:get_main_buttons(view)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
get_with_back = function(self, view, tab)
|
|
||||||
local backtxt = view.backtxt or self.backtxt
|
|
||||||
|
|
||||||
local formspec = ""
|
|
||||||
if view.parent == nil then
|
|
||||||
local tsize = tab.tabsize or
|
|
||||||
{width=view.width, height=view.height}
|
|
||||||
formspec = formspec ..
|
|
||||||
string.format("size[%f,%f,%s]real_coordinates[true]",tsize.width,tsize.height,
|
|
||||||
dump(view.fixed_size))
|
|
||||||
end
|
|
||||||
formspec = formspec ..
|
|
||||||
"style[main_back;noclip=true;border=false]image_button[-1.25,0;1,1;" .. backtxt .. ";main_back;]" ..
|
|
||||||
tab.get_formspec(
|
|
||||||
view,
|
|
||||||
view.tablist[view.last_tab_index].name,
|
|
||||||
view.tablist[view.last_tab_index].tabdata,
|
|
||||||
view.tablist[view.last_tab_index].tabsize
|
|
||||||
)
|
|
||||||
|
|
||||||
return formspec
|
|
||||||
end,
|
|
||||||
|
|
||||||
get_main_buttons = function(self, view)
|
|
||||||
local icon = view.icon
|
|
||||||
local bgcolor = view.bgcolor or "#ACACAC33"
|
|
||||||
local selcolor = view.selcolor or "#ACACAC66"
|
|
||||||
|
|
||||||
local tsize = { width = 3, height = #view.tablist - 0.2}
|
|
||||||
|
|
||||||
local fs = {
|
|
||||||
("size[%f,%f]"):format(tsize.width, tsize.height),
|
|
||||||
"real_coordinates[true]",
|
|
||||||
"bgcolor[#00000000]",
|
|
||||||
("box[%f,%f;%f,%f;%s]"):format(0, 0, 3, tsize.height, bgcolor)
|
|
||||||
}
|
|
||||||
|
|
||||||
for i = 1, #view.tablist do
|
|
||||||
local tab = view.tablist[i]
|
|
||||||
local name = "tab_" .. tab.name
|
|
||||||
local y = i - 1
|
|
||||||
|
|
||||||
fs[#fs + 1] = "button[0,"
|
|
||||||
fs[#fs + 1] = tonumber(y)
|
|
||||||
fs[#fs + 1] = ";3,0.8;"
|
|
||||||
fs[#fs + 1] = name
|
|
||||||
fs[#fs + 1] = ";"
|
|
||||||
fs[#fs + 1] = minetest.formspec_escape(tab.caption)
|
|
||||||
fs[#fs + 1] ="]"
|
|
||||||
end
|
|
||||||
|
|
||||||
return table.concat(fs, "")
|
|
||||||
end,
|
|
||||||
|
|
||||||
handle_buttons = function(self, view, fields)
|
|
||||||
if fields.main_back then
|
|
||||||
view:switch_to_tab(nil)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
for i = 1, #view.tablist do
|
|
||||||
local tab = view.tablist[i]
|
|
||||||
if fields["tab_" .. tab.name] then
|
|
||||||
view:switch_to_tab(i)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end,
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
--Minetest
|
|
||||||
--Copyright (C) 2014 sapier
|
|
||||||
--
|
|
||||||
--This program is free software; you can redistribute it and/or modify
|
|
||||||
--it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
--the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
--(at your option) any later version.
|
|
||||||
--
|
|
||||||
--This program is distributed in the hope that it will be useful,
|
|
||||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
--GNU Lesser General Public License for more details.
|
|
||||||
--
|
|
||||||
--You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
|
|
||||||
local function beta_menu_formspec()
|
|
||||||
return "size[8,2.5,true]" ..
|
|
||||||
"style[label_button;border=false]" ..
|
|
||||||
"button[0.5,0.5;7,0.5;label_button;" ..
|
|
||||||
fgettext("You have no games installed.") .. "]" ..
|
|
||||||
"button[0.5,1.5;2.5,0.5;world_create_open_cdb;" .. fgettext("Install a game") .. "]" ..
|
|
||||||
"button[5.0,1.5;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
|
|
||||||
end
|
|
@ -15,62 +15,48 @@
|
|||||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
mt_color_grey = "#AAAAAA"
|
mt_color_grey = "#AAAAFF"
|
||||||
mt_color_blue = "#6389FF"
|
mt_color_blue = "#6389FF"
|
||||||
mt_color_green = "#72FF63"
|
mt_color_lightblue = "#99CCFF"
|
||||||
mt_color_dark_green = "#25C191"
|
mt_color_green = "#7264F3"
|
||||||
|
mt_color_dark_green = "#25C1F1"
|
||||||
--for all other colors ask sfan5 to complete his work!
|
mt_color_orange = "#FF6600"
|
||||||
|
mt_color_red = "#FF0000"
|
||||||
|
|
||||||
local menupath = core.get_mainmenu_path()
|
local menupath = core.get_mainmenu_path()
|
||||||
local basepath = core.get_builtin_path()
|
local basepath = core.get_builtin_path()
|
||||||
local menustyle = core.settings:get("main_menu_style")
|
|
||||||
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
|
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
|
||||||
DIR_DELIM .. "pack" .. DIR_DELIM
|
DIR_DELIM .. "pack" .. DIR_DELIM
|
||||||
|
|
||||||
dofile(basepath .. "common" .. DIR_DELIM .. "async_event.lua")
|
|
||||||
dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua")
|
dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua")
|
||||||
|
dofile(basepath .. "fstk" .. DIR_DELIM .. "buttonbar.lua")
|
||||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "dialog.lua")
|
dofile(basepath .. "fstk" .. DIR_DELIM .. "dialog.lua")
|
||||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview.lua")
|
dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview.lua")
|
||||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview_layouts.lua")
|
|
||||||
dofile(basepath .. "fstk" .. DIR_DELIM .. "ui.lua")
|
dofile(basepath .. "fstk" .. DIR_DELIM .. "ui.lua")
|
||||||
|
dofile(menupath .. DIR_DELIM .. "async_event.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "common.lua")
|
dofile(menupath .. DIR_DELIM .. "common.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "pkgmgr.lua")
|
dofile(menupath .. DIR_DELIM .. "pkgmgr.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "textures.lua")
|
dofile(menupath .. DIR_DELIM .. "serverlistmgr.lua")
|
||||||
|
dofile(menupath .. DIR_DELIM .. "game_theme.lua")
|
||||||
|
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_contentstore.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_contentstore.lua")
|
||||||
if menustyle ~= "simple" then
|
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_delete_content.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_delete_content.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
|
||||||
|
dofile(menupath .. DIR_DELIM .. "dlg_register.lua")
|
||||||
dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
|
dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
|
||||||
end
|
dofile(menupath .. DIR_DELIM .. "dlg_version_info.lua")
|
||||||
|
|
||||||
local tabs = {}
|
local tabs = {}
|
||||||
|
|
||||||
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
|
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
|
||||||
tabs.content = dofile(menupath .. DIR_DELIM .. "tab_content.lua")
|
tabs.content = dofile(menupath .. DIR_DELIM .. "tab_content.lua")
|
||||||
tabs.about = dofile(menupath .. DIR_DELIM .. "tab_about.lua")
|
tabs.about = dofile(menupath .. DIR_DELIM .. "tab_about.lua")
|
||||||
if menustyle == "simple" then
|
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
|
||||||
tabs.simple_main = dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua")
|
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
|
||||||
else
|
tabs.beta = dofile(menupath .. DIR_DELIM .. "tab_beta.lua")
|
||||||
tabs.world = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
|
|
||||||
tabs.online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
|
|
||||||
|
|
||||||
tabs.new_game = {
|
|
||||||
name = "new",
|
|
||||||
caption = fgettext("New Game"),
|
|
||||||
show = function(_, _, this)
|
|
||||||
local create_world_dlg = create_create_world_dlg(true)
|
|
||||||
create_world_dlg:set_parent(this)
|
|
||||||
this:hide()
|
|
||||||
create_world_dlg:show()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function main_event_handler(tabview, event)
|
local function main_event_handler(tabview, event)
|
||||||
@ -85,34 +71,6 @@ local function init_globals()
|
|||||||
-- Init gamedata
|
-- Init gamedata
|
||||||
gamedata.worldindex = 0
|
gamedata.worldindex = 0
|
||||||
|
|
||||||
if menustyle == "simple" then
|
|
||||||
local world_list = core.get_worlds()
|
|
||||||
local world_index
|
|
||||||
|
|
||||||
local found_singleplayerworld = false
|
|
||||||
for i, world in ipairs(world_list) do
|
|
||||||
if world.name == "singleplayerworld" then
|
|
||||||
found_singleplayerworld = true
|
|
||||||
world_index = i
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not found_singleplayerworld then
|
|
||||||
core.create_world("singleplayerworld", 1)
|
|
||||||
|
|
||||||
world_list = core.get_worlds()
|
|
||||||
|
|
||||||
for i, world in ipairs(world_list) do
|
|
||||||
if world.name == "singleplayerworld" then
|
|
||||||
world_index = i
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
gamedata.worldindex = world_index
|
|
||||||
else
|
|
||||||
menudata.worldlist = filterlist.create(
|
menudata.worldlist = filterlist.create(
|
||||||
core.get_worlds,
|
core.get_worlds,
|
||||||
compare_worlds,
|
compare_worlds,
|
||||||
@ -134,20 +92,19 @@ local function init_globals()
|
|||||||
core.settings:set("menu_last_game", default_game)
|
core.settings:set("menu_last_game", default_game)
|
||||||
end
|
end
|
||||||
|
|
||||||
mm_texture.init()
|
mm_game_theme.init()
|
||||||
end
|
|
||||||
|
|
||||||
-- Create main tabview
|
-- Create main tabview
|
||||||
local tv_main = tabview_create("maintab", {x = 15.5, y = 9}, {x = 0, y = 0}, tabview_layouts.mainmenu)
|
--[[local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
|
||||||
tv_main.icon = "/home/ruben/dev/minetest/games/minetest_game/menu/icon.png"
|
-- note: size would be 15.5,7.1 in real coordinates mode
|
||||||
|
|
||||||
if menustyle == "simple" then
|
|
||||||
tv_main:add(tabs.simple_main)
|
|
||||||
else
|
|
||||||
tv_main:set_autosave_tab(true)
|
tv_main:set_autosave_tab(true)
|
||||||
tv_main:add(tabs.online)
|
|
||||||
tv_main:add(tabs.world)
|
tv_main:add(tabs.beta)
|
||||||
end
|
|
||||||
|
tv_main:add(tabs.local_game)
|
||||||
|
tv_main:add(tabs.play_online)
|
||||||
|
|
||||||
tv_main:add(tabs.content)
|
tv_main:add(tabs.content)
|
||||||
tv_main:add(tabs.settings)
|
tv_main:add(tabs.settings)
|
||||||
tv_main:add(tabs.about)
|
tv_main:add(tabs.about)
|
||||||
@ -155,19 +112,25 @@ local function init_globals()
|
|||||||
tv_main:set_global_event_handler(main_event_handler)
|
tv_main:set_global_event_handler(main_event_handler)
|
||||||
tv_main:set_fixed_size(false)
|
tv_main:set_fixed_size(false)
|
||||||
|
|
||||||
local last_tab = core.settings:get("maintab_LAST")
|
|
||||||
if menustyle ~= "simple" and last_tab and tv_main.current_tab ~= last_tab then
|
tv_main:set_tab(tabs.about)
|
||||||
tv_main:set_tab(last_tab)
|
|
||||||
else
|
|
||||||
tv_main:set_tab("local")
|
-- In case the folder of the last selected game has been deleted,
|
||||||
|
-- display "Minetest" as a header
|
||||||
|
if tv_main.current_tab == "local" then
|
||||||
|
local game = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
|
||||||
|
if game == nil then
|
||||||
|
mm_game_theme.reset()
|
||||||
end
|
end
|
||||||
|
end]]
|
||||||
|
|
||||||
ui.set_default("maintab")
|
--ui.set_default("maintab")
|
||||||
tv_main:show()
|
--check_new_version()
|
||||||
|
--tv_main:show()
|
||||||
ui.update()
|
--ui.update()
|
||||||
|
|
||||||
core.sound_play("main_menu", true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
init_globals()
|
init_globals()
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,116 +16,199 @@
|
|||||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
|
||||||
local function current_game()
|
local current_game, singleplayer_refresh_gamebar
|
||||||
|
local valid_disabled_settings = {
|
||||||
|
["enable_damage"]=true,
|
||||||
|
["creative_mode"]=true,
|
||||||
|
["enable_server"]=true,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Currently chosen game in gamebar for theming and filtering
|
||||||
|
function current_game()
|
||||||
local last_game_id = core.settings:get("menu_last_game")
|
local last_game_id = core.settings:get("menu_last_game")
|
||||||
local game, index = pkgmgr.find_by_gameid(last_game_id)
|
local game = pkgmgr.find_by_gameid(last_game_id)
|
||||||
|
|
||||||
return game
|
return game
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Apply menu changes from given game
|
||||||
|
function apply_game(game)
|
||||||
|
core.set_topleft_text(game.name)
|
||||||
|
core.settings:set("menu_last_game", game.id)
|
||||||
|
menudata.worldlist:set_filtercriteria(game.id)
|
||||||
|
|
||||||
|
mm_game_theme.update("singleplayer", game) -- this refreshes the formspec
|
||||||
|
|
||||||
|
local index = filterlist.get_current_index(menudata.worldlist,
|
||||||
|
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
||||||
|
if not index or index < 1 then
|
||||||
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
|
if selected ~= nil and selected < #menudata.worldlist:get_list() then
|
||||||
|
index = selected
|
||||||
|
else
|
||||||
|
index = #menudata.worldlist:get_list()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
menu_worldmt_legacy(index)
|
||||||
|
end
|
||||||
|
|
||||||
|
function singleplayer_refresh_gamebar()
|
||||||
|
|
||||||
|
local old_bar = ui.find_by_name("game_button_bar")
|
||||||
|
if old_bar ~= nil then
|
||||||
|
old_bar:delete()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function game_buttonbar_button_handler(fields)
|
||||||
|
if fields.game_open_cdb then
|
||||||
|
local maintab = ui.find_by_name("maintab")
|
||||||
|
local dlg = create_store_dlg("game")
|
||||||
|
dlg:set_parent(maintab)
|
||||||
|
maintab:hide()
|
||||||
|
dlg:show()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, game in ipairs(pkgmgr.games) do
|
||||||
|
if fields["game_btnbar_" .. game.id] then
|
||||||
|
apply_game(game)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local btnbar = buttonbar_create("game_button_bar",
|
||||||
|
game_buttonbar_button_handler,
|
||||||
|
{x=-0.3,y=5.9}, "horizontal", {x=12.4,y=1.15})
|
||||||
|
|
||||||
|
for _, game in ipairs(pkgmgr.games) do
|
||||||
|
local btn_name = "game_btnbar_" .. game.id
|
||||||
|
|
||||||
|
local image = nil
|
||||||
|
local text = nil
|
||||||
|
local tooltip = core.formspec_escape(game.title)
|
||||||
|
|
||||||
|
if (game.menuicon_path or "") ~= "" then
|
||||||
|
image = core.formspec_escape(game.menuicon_path)
|
||||||
|
else
|
||||||
|
local part1 = game.id:sub(1,5)
|
||||||
|
local part2 = game.id:sub(6,10)
|
||||||
|
local part3 = game.id:sub(11)
|
||||||
|
|
||||||
|
text = part1 .. "\n" .. part2
|
||||||
|
if part3 ~= "" then
|
||||||
|
text = text .. "\n" .. part3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
btnbar:add_button(btn_name, text, image, tooltip)
|
||||||
|
end
|
||||||
|
|
||||||
|
local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png")
|
||||||
|
btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB"))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_disabled_settings(game)
|
||||||
|
if not game then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local gameconfig = Settings(game.path .. "/game.conf")
|
||||||
|
local disabled_settings = {}
|
||||||
|
if gameconfig then
|
||||||
|
local disabled_settings_str = (gameconfig:get("disabled_settings") or ""):split()
|
||||||
|
for _, value in pairs(disabled_settings_str) do
|
||||||
|
local state = false
|
||||||
|
value = value:trim()
|
||||||
|
if string.sub(value, 1, 1) == "!" then
|
||||||
|
state = true
|
||||||
|
value = string.sub(value, 2)
|
||||||
|
end
|
||||||
|
if valid_disabled_settings[value] then
|
||||||
|
disabled_settings[value] = state
|
||||||
|
else
|
||||||
|
core.log("error", "Invalid disabled setting in game.conf: "..tostring(value))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return disabled_settings
|
||||||
|
end
|
||||||
|
|
||||||
local function get_formspec(tabview, name, tabdata)
|
local function get_formspec(tabview, name, tabdata)
|
||||||
local retval = ""
|
local retval = ""
|
||||||
|
|
||||||
local index = filterlist.get_current_index(menudata.worldlist,
|
local index = filterlist.get_current_index(menudata.worldlist,
|
||||||
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
||||||
|
local list = menudata.worldlist:get_list()
|
||||||
|
local world = list and index and list[index]
|
||||||
|
local game
|
||||||
|
if world then
|
||||||
|
game = pkgmgr.find_by_gameid(world.gameid)
|
||||||
|
else
|
||||||
|
game = current_game()
|
||||||
|
end
|
||||||
|
local disabled_settings = get_disabled_settings(game)
|
||||||
|
|
||||||
retval = {
|
local creative, damage, host = "", "", ""
|
||||||
"container[0.375,0.375]",
|
|
||||||
"box[11,-0.375;4.125,9;#ACACAC33]",
|
|
||||||
--"field[1.75,0;5.125,0.8;query;;", query, "]",
|
|
||||||
--"button[6.875,0;1.5,0.8;search;", fgettext("Search"), "]",
|
|
||||||
"textlist[0,0;10.625,8.25;sp_worlds;", menu_render_worldlist(), ";", index, "]",
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
-- Y offsets for game settings checkboxes
|
||||||
retval[#retval + 1] = "container[11.375,0.2]"
|
local y = -0.2
|
||||||
local enable_server = core.settings:get_bool("enable_server")
|
local yo = 0.45
|
||||||
local options = {
|
|
||||||
{ name = "creative_mode", text = fgettext("Creative Mode") },
|
|
||||||
{ name = "enable_damage", text = fgettext("Enable Damage") },
|
|
||||||
{ name = "enable_server", text = fgettext("Host Server") },
|
|
||||||
}
|
|
||||||
|
|
||||||
if enable_server then
|
if disabled_settings["creative_mode"] == nil then
|
||||||
options[#options + 1] = { name = "server_announce", text = fgettext("Announce Server") }
|
creative = "checkbox[0,"..y..";cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
||||||
|
dump(core.settings:get_bool("creative_mode")) .. "]"
|
||||||
|
y = y + yo
|
||||||
|
end
|
||||||
|
if disabled_settings["enable_damage"] == nil then
|
||||||
|
damage = "checkbox[0,"..y..";cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
|
||||||
|
dump(core.settings:get_bool("enable_damage")) .. "]"
|
||||||
|
y = y + yo
|
||||||
|
end
|
||||||
|
if disabled_settings["enable_server"] == nil then
|
||||||
|
host = "checkbox[0,"..y..";cb_server;".. fgettext("Host Server") ..";" ..
|
||||||
|
dump(core.settings:get_bool("enable_server")) .. "]"
|
||||||
|
y = y + yo
|
||||||
end
|
end
|
||||||
|
|
||||||
local y = 0
|
retval = retval ..
|
||||||
for _, opt in pairs(options) do
|
"button[3.9,3.8;2.8,1;world_delete;".. fgettext("Delete") .. "]" ..
|
||||||
retval[#retval + 1] = "checkbox[0,"
|
"button[6.55,3.8;2.8,1;world_configure;".. fgettext("Select Mods") .. "]" ..
|
||||||
retval[#retval + 1] = y
|
"button[9.2,3.8;2.8,1;world_create;".. fgettext("New") .. "]" ..
|
||||||
retval[#retval + 1] =";cb_"
|
"label[3.9,-0.05;".. fgettext("Select World:") .. "]"..
|
||||||
retval[#retval + 1] = opt.name
|
creative ..
|
||||||
retval[#retval + 1] = ";"
|
damage ..
|
||||||
retval[#retval + 1] = opt.text
|
host ..
|
||||||
retval[#retval + 1] = ";"
|
"textlist[3.9,0.4;7.9,3.45;sp_worlds;" ..
|
||||||
retval[#retval + 1] = dump(core.settings:get_bool(opt.name))
|
menu_render_worldlist() ..
|
||||||
retval[#retval + 1] = "]"
|
";" .. index .. "]"
|
||||||
|
|
||||||
y = y + 0.5
|
if core.settings:get_bool("enable_server") and disabled_settings["enable_server"] == nil then
|
||||||
end
|
retval = retval ..
|
||||||
|
"button[7.9,4.75;4.1,1;play;".. fgettext("Host Game") .. "]" ..
|
||||||
y = y + 0.25
|
"checkbox[0,"..y..";cb_server_announce;" .. fgettext("Announce Server") .. ";" ..
|
||||||
|
dump(core.settings:get_bool("server_announce")) .. "]" ..
|
||||||
if enable_server then
|
"field[0.3,2.85;3.8,0.5;te_playername;" .. fgettext("Name") .. ";" ..
|
||||||
retval[#retval + 1] = "container[0,"
|
core.formspec_escape(core.settings:get("name")) .. "]" ..
|
||||||
retval[#retval + 1] = y
|
"pwdfield[0.3,4.05;3.8,0.5;te_passwd;" .. fgettext("Password") .. "]"
|
||||||
retval[#retval + 1] = "]label[0,0;"
|
|
||||||
retval[#retval + 1] = fgettext("Name/Password")
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
retval[#retval + 1] = "field[0,0.3;3.375,0.5;te_playername;;"
|
|
||||||
retval[#retval + 1] = core.formspec_escape(core.settings:get("name"))
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
retval[#retval + 1] = "pwdfield[0,1;3.375,0.5;te_passwd;]"
|
|
||||||
|
|
||||||
local bind_addr = core.settings:get("bind_address")
|
local bind_addr = core.settings:get("bind_address")
|
||||||
if bind_addr ~= nil and bind_addr ~= "" then
|
if bind_addr ~= nil and bind_addr ~= "" then
|
||||||
retval[#retval + 1] = "field[0,2.2;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address")
|
retval = retval ..
|
||||||
retval[#retval + 1] = ";"
|
"field[0.3,5.25;2.5,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" ..
|
||||||
retval[#retval + 1] = core.formspec_escape(core.settings:get("bind_address"))
|
core.formspec_escape(core.settings:get("bind_address")) .. "]" ..
|
||||||
retval[#retval + 1] = "]"
|
"field[2.85,5.25;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" ..
|
||||||
retval[#retval + 1] = "field[2.3,2.2;1.25,0.5;te_serverport;"
|
core.formspec_escape(core.settings:get("port")) .. "]"
|
||||||
retval[#retval + 1] = fgettext("Port")
|
|
||||||
retval[#retval + 1] = ";"
|
|
||||||
retval[#retval + 1] = core.formspec_escape(core.settings:get("port"))
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
else
|
else
|
||||||
retval[#retval + 1] = "field[0,2.2;3.375,0.5;te_serverport;"
|
retval = retval ..
|
||||||
retval[#retval + 1] = fgettext("Server Port")
|
"field[0.3,5.25;3.8,0.5;te_serverport;" .. fgettext("Server Port") .. ";" ..
|
||||||
retval[#retval + 1] = ";"
|
core.formspec_escape(core.settings:get("port")) .. "]"
|
||||||
retval[#retval + 1] = core.formspec_escape(core.settings:get("port"))
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
end
|
end
|
||||||
retval[#retval + 1] = "container_end[]"
|
|
||||||
end
|
|
||||||
|
|
||||||
if index > 0 then
|
|
||||||
retval[#retval + 1] = "container[0,5.15]"
|
|
||||||
retval[#retval + 1] = "button[0,0;3.375,0.8;world_delete;"
|
|
||||||
retval[#retval + 1] = fgettext("Delete")
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
retval[#retval + 1] = "button[0,1.05;3.375,0.8;world_configure;"
|
|
||||||
retval[#retval + 1] = fgettext("Configure")
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
retval[#retval + 1] = "button[0,2.1;3.375,0.8;play;"
|
|
||||||
retval[#retval + 1] = fgettext("Play Game")
|
|
||||||
retval[#retval + 1] = "]"
|
|
||||||
-- "button[4,3.95;2.6,1;world_delete;", fgettext("Delete"), "]",
|
|
||||||
--"button[6.5,3.95;2.8,1;world_configure;", fgettext("Configure"), "]",
|
|
||||||
retval[#retval + 1] = "container_end[]"
|
|
||||||
else
|
else
|
||||||
retval[#retval + 1] = "container[0,5.15]"
|
retval = retval ..
|
||||||
retval[#retval + 1] = "box[0,0;2.625,0.8;#333]"
|
"button[7.9,4.75;4.1,1;play;" .. fgettext("Play Game") .. "]"
|
||||||
retval[#retval + 1] = "box[0,1.05;2.625,0.8;#333]"
|
|
||||||
retval[#retval + 1] = "box[0,2.1;2.625,0.8;#333]"
|
|
||||||
retval[#retval + 1] = "container_end[]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return retval
|
||||||
retval[#retval + 1] = "container_end[]"
|
|
||||||
end
|
|
||||||
|
|
||||||
return table.concat(retval, "") .. "container_end[]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function main_button_handler(this, fields, name, tabdata)
|
local function main_button_handler(this, fields, name, tabdata)
|
||||||
@ -171,8 +254,8 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["cb_enable_server"] then
|
if fields["cb_server"] then
|
||||||
core.settings:set("enable_server", fields["cb_enable_server"])
|
core.settings:set("enable_server", fields["cb_server"])
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -185,12 +268,36 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["play"] ~= nil or world_doubleclick then
|
if fields["play"] ~= nil or world_doubleclick or fields["key_enter"] then
|
||||||
local selected = core.get_textlist_index("sp_worlds")
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||||
|
|
||||||
|
if selected == nil or gamedata.selected_world == 0 then
|
||||||
|
gamedata.errormessage =
|
||||||
|
fgettext("No world created or selected!")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update last game
|
||||||
|
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
||||||
|
local game_obj
|
||||||
|
if world then
|
||||||
|
game_obj = pkgmgr.find_by_gameid(world.gameid)
|
||||||
|
core.settings:set("menu_last_game", game_obj.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
local disabled_settings = get_disabled_settings(game_obj)
|
||||||
|
for k, _ in pairs(valid_disabled_settings) do
|
||||||
|
local v = disabled_settings[k]
|
||||||
|
if v ~= nil then
|
||||||
|
if k == "enable_server" and v == true then
|
||||||
|
error("Setting 'enable_server' cannot be force-enabled! The game.conf needs to be fixed.")
|
||||||
|
end
|
||||||
|
core.settings:set_bool(k, disabled_settings[k])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if core.settings:get_bool("enable_server") then
|
if core.settings:get_bool("enable_server") then
|
||||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
|
||||||
gamedata.playername = fields["te_playername"]
|
gamedata.playername = fields["te_playername"]
|
||||||
gamedata.password = fields["te_passwd"]
|
gamedata.password = fields["te_passwd"]
|
||||||
gamedata.port = fields["te_serverport"]
|
gamedata.port = fields["te_serverport"]
|
||||||
@ -200,31 +307,22 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
if fields["te_serveraddr"] ~= nil then
|
if fields["te_serveraddr"] ~= nil then
|
||||||
core.settings:set("bind_address",fields["te_serveraddr"])
|
core.settings:set("bind_address",fields["te_serveraddr"])
|
||||||
end
|
end
|
||||||
|
|
||||||
--update last game
|
|
||||||
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
|
|
||||||
if world then
|
|
||||||
local game, index = pkgmgr.find_by_gameid(world.gameid)
|
|
||||||
core.settings:set("menu_last_game", game.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
core.start()
|
|
||||||
else
|
else
|
||||||
gamedata.errormessage =
|
|
||||||
fgettext("No world created or selected!")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if selected ~= nil and gamedata.selected_world ~= 0 then
|
|
||||||
gamedata.singleplayer = true
|
gamedata.singleplayer = true
|
||||||
core.start()
|
|
||||||
else
|
|
||||||
gamedata.errormessage =
|
|
||||||
fgettext("No world created or selected!")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
core.start()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
if fields["world_create"] ~= nil then
|
||||||
|
local create_world_dlg = create_create_world_dlg()
|
||||||
|
create_world_dlg:set_parent(this)
|
||||||
|
this:hide()
|
||||||
|
create_world_dlg:show()
|
||||||
|
mm_game_theme.update("singleplayer", current_game())
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
if fields["world_delete"] ~= nil then
|
if fields["world_delete"] ~= nil then
|
||||||
local selected = core.get_textlist_index("sp_worlds")
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
@ -239,7 +337,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
delete_world_dlg:set_parent(this)
|
delete_world_dlg:set_parent(this)
|
||||||
this:hide()
|
this:hide()
|
||||||
delete_world_dlg:show()
|
delete_world_dlg:show()
|
||||||
mm_texture.update("singleplayer",current_game())
|
mm_game_theme.update("singleplayer",current_game())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -257,7 +355,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
configdialog:set_parent(this)
|
configdialog:set_parent(this)
|
||||||
this:hide()
|
this:hide()
|
||||||
configdialog:show()
|
configdialog:show()
|
||||||
mm_texture.update("singleplayer",current_game())
|
mm_game_theme.update("singleplayer",current_game())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -266,25 +364,29 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function on_change(type, old_tab, new_tab)
|
local function on_change(type, old_tab, new_tab)
|
||||||
if type == "ENTER" then
|
if (type == "ENTER") then
|
||||||
local game = current_game()
|
local game = current_game()
|
||||||
|
|
||||||
if game then
|
if game then
|
||||||
menudata.worldlist:set_filtercriteria(game.id)
|
apply_game(game)
|
||||||
core.set_topleft_text(game.name)
|
|
||||||
mm_texture.update("singleplayer",game)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
singleplayer_refresh_gamebar()
|
||||||
|
ui.find_by_name("game_button_bar"):show()
|
||||||
else
|
else
|
||||||
menudata.worldlist:set_filtercriteria(nil)
|
menudata.worldlist:set_filtercriteria(nil)
|
||||||
|
local gamebar = ui.find_by_name("game_button_bar")
|
||||||
|
if gamebar then
|
||||||
|
gamebar:hide()
|
||||||
|
end
|
||||||
core.set_topleft_text("")
|
core.set_topleft_text("")
|
||||||
mm_texture.update(new_tab,nil)
|
mm_game_theme.update(new_tab,nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
return {
|
return {
|
||||||
name = "local",
|
name = "local",
|
||||||
caption = fgettext("Load Game"),
|
caption = fgettext("Start Game"),
|
||||||
cbf_formspec = get_formspec,
|
cbf_formspec = get_formspec,
|
||||||
cbf_button_handler = main_button_handler,
|
cbf_button_handler = main_button_handler,
|
||||||
on_change = on_change
|
on_change = on_change
|
||||||
|
@ -1,185 +0,0 @@
|
|||||||
--Minetest
|
|
||||||
--Copyright (C) 2013 sapier
|
|
||||||
--
|
|
||||||
--This program is free software; you can redistribute it and/or modify
|
|
||||||
--it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
--the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
--(at your option) any later version.
|
|
||||||
--
|
|
||||||
--This program is distributed in the hope that it will be useful,
|
|
||||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
--GNU Lesser General Public License for more details.
|
|
||||||
--
|
|
||||||
--You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
|
|
||||||
mm_texture = {}
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.init()
|
|
||||||
mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
|
|
||||||
DIR_DELIM .. "pack" .. DIR_DELIM
|
|
||||||
mm_texture.basetexturedir = mm_texture.defaulttexturedir
|
|
||||||
|
|
||||||
mm_texture.texturepack = core.settings:get("texture_path")
|
|
||||||
|
|
||||||
mm_texture.gameid = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.update(tab,gamedetails)
|
|
||||||
if tab ~= "singleplayer" then
|
|
||||||
mm_texture.reset()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if gamedetails == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
mm_texture.update_game(gamedetails)
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.reset()
|
|
||||||
mm_texture.gameid = nil
|
|
||||||
local have_bg = false
|
|
||||||
local have_overlay = mm_texture.set_generic("overlay")
|
|
||||||
|
|
||||||
if not have_overlay then
|
|
||||||
have_bg = mm_texture.set_generic("background")
|
|
||||||
end
|
|
||||||
|
|
||||||
mm_texture.clear("header")
|
|
||||||
mm_texture.clear("footer")
|
|
||||||
core.set_clouds(false)
|
|
||||||
|
|
||||||
mm_texture.set_generic("footer")
|
|
||||||
mm_texture.set_generic("header")
|
|
||||||
|
|
||||||
if not have_bg then
|
|
||||||
if core.settings:get_bool("menu_clouds") then
|
|
||||||
core.set_clouds(true)
|
|
||||||
else
|
|
||||||
mm_texture.set_dirt_bg()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.update_game(gamedetails)
|
|
||||||
if mm_texture.gameid == gamedetails.id then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local have_bg = false
|
|
||||||
local have_overlay = mm_texture.set_game("overlay",gamedetails)
|
|
||||||
|
|
||||||
if not have_overlay then
|
|
||||||
have_bg = mm_texture.set_game("background",gamedetails)
|
|
||||||
end
|
|
||||||
|
|
||||||
mm_texture.clear("header")
|
|
||||||
mm_texture.clear("footer")
|
|
||||||
core.set_clouds(false)
|
|
||||||
|
|
||||||
if not have_bg then
|
|
||||||
|
|
||||||
if core.settings:get_bool("menu_clouds") then
|
|
||||||
core.set_clouds(true)
|
|
||||||
else
|
|
||||||
mm_texture.set_dirt_bg()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mm_texture.set_game("footer",gamedetails)
|
|
||||||
mm_texture.set_game("header",gamedetails)
|
|
||||||
|
|
||||||
mm_texture.gameid = gamedetails.id
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.clear(identifier)
|
|
||||||
core.set_background(identifier,"")
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.set_generic(identifier)
|
|
||||||
--try texture pack first
|
|
||||||
if mm_texture.texturepack ~= nil then
|
|
||||||
local path = mm_texture.texturepack .. DIR_DELIM .."menu_" ..
|
|
||||||
identifier .. ".png"
|
|
||||||
if core.set_background(identifier,path) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if mm_texture.defaulttexturedir ~= nil then
|
|
||||||
local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
|
|
||||||
identifier .. ".png"
|
|
||||||
if core.set_background(identifier,path) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function mm_texture.set_game(identifier, gamedetails)
|
|
||||||
|
|
||||||
if gamedetails == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
if mm_texture.texturepack ~= nil then
|
|
||||||
local path = mm_texture.texturepack .. DIR_DELIM ..
|
|
||||||
gamedetails.id .. "_menu_" .. identifier .. ".png"
|
|
||||||
if core.set_background(identifier, path) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Find out how many randomized textures the game provides
|
|
||||||
local n = 0
|
|
||||||
local filename
|
|
||||||
local menu_files = core.get_dir_list(gamedetails.path .. DIR_DELIM .. "menu", false)
|
|
||||||
for i = 1, #menu_files do
|
|
||||||
filename = identifier .. "." .. i .. ".png"
|
|
||||||
if table.indexof(menu_files, filename) == -1 then
|
|
||||||
n = i - 1
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- Select random texture, 0 means standard texture
|
|
||||||
n = math.random(0, n)
|
|
||||||
if n == 0 then
|
|
||||||
filename = identifier .. ".png"
|
|
||||||
else
|
|
||||||
filename = identifier .. "." .. n .. ".png"
|
|
||||||
end
|
|
||||||
|
|
||||||
local path = gamedetails.path .. DIR_DELIM .. "menu" ..
|
|
||||||
DIR_DELIM .. filename
|
|
||||||
if core.set_background(identifier, path) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function mm_texture.set_dirt_bg()
|
|
||||||
if mm_texture.texturepack ~= nil then
|
|
||||||
local path = mm_texture.texturepack .. DIR_DELIM .."default_dirt.png"
|
|
||||||
if core.set_background("background", path, true, 128) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Use universal fallback texture in textures/base/pack
|
|
||||||
local minimalpath = defaulttexturedir .. "menu_bg.png"
|
|
||||||
core.set_background("background", minimalpath, true, 128)
|
|
||||||
end
|
|
@ -180,10 +180,10 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
|||||||
g_menucloudsmgr = m_rendering_engine->get_scene_manager()->createNewSceneManager();
|
g_menucloudsmgr = m_rendering_engine->get_scene_manager()->createNewSceneManager();
|
||||||
if (!g_menuclouds)
|
if (!g_menuclouds)
|
||||||
g_menuclouds = new Clouds(g_menucloudsmgr, -1, rand());
|
g_menuclouds = new Clouds(g_menucloudsmgr, -1, rand());
|
||||||
g_menuclouds->setHeight(30.0f);
|
g_menuclouds->setHeight(100.0f);
|
||||||
g_menuclouds->update(v3f(0, 0, 0), video::SColor(255, 240, 240, 255));
|
g_menuclouds->update(v3f(0, 0, 0), video::SColor(255, 240, 240, 255));
|
||||||
scene::ICameraSceneNode* camera;
|
scene::ICameraSceneNode* camera;
|
||||||
camera = g_menucloudsmgr->addCameraSceneNode(NULL, v3f(0, 0, 0), v3f(0, 10, 0));
|
camera = g_menucloudsmgr->addCameraSceneNode(NULL, v3f(0, 0, 0), v3f(0, 60, 100));
|
||||||
camera->setFarValue(10000);
|
camera->setFarValue(10000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB |
Loading…
x
Reference in New Issue
Block a user