This commit is contained in:
Maksim Gamarnik 2015-11-10 21:14:01 +02:00
parent 988b2bf6bd
commit 18204b95ed
24 changed files with 109 additions and 430 deletions

View File

@ -752,15 +752,14 @@ assets : $(ASSETS_TIMESTAMP)
ls -R | grep ":$$" | sed -e 's/:$$//' -e 's/\.//' -e 's/^\///' > "index.txt"; \ ls -R | grep ":$$" | sed -e 's/:$$//' -e 's/\.//' -e 's/^\///' > "index.txt"; \
find Minetest >"filelist.txt"; \ find Minetest >"filelist.txt"; \
cp ${ROOT}/${ASSETS_TIMESTAMP} ${ROOT}/${ASSETS_TIMESTAMP}.old; \ cp ${ROOT}/${ASSETS_TIMESTAMP} ${ROOT}/${ASSETS_TIMESTAMP}.old; \
cd ${ROOT}/assets/MultiCraft; \ cd ${ROOT}/assets/Minetest; \
echo "Creating Files.zip"; \ echo "Creating Files.zip"; \
zip -r -X -q ../Files.zip *; \ zip -r -X -q ../Files.zip *; \
cd ${ROOT}/assets; \ cd ${ROOT}/assets; \
rm -r ${ROOT}/assets/MultiCraft_game; \ rm ${ROOT}/assets/index.txt; \
rm ${ROOT}/assets/index.txt; \ rm ${ROOT}/assets/filelist.txt; \
rm ${ROOT}/assets/filelist.txt; \ else \
else \ echo "nothing to be done for assets"; \
echo "nothing to be done for assets"; \
fi fi
clean_assets : clean_assets :

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -16,6 +16,14 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
local function create_world_formspec(dialogdata) local function create_world_formspec(dialogdata)
mm_texture.clear("header")
mm_texture.clear("footer")
minetest.set_clouds(false)
minetest.set_background("background",minetest.formspec_escape(mm_texture.basetexturedir)..'background.png')
--minetest.set_background("header",minetest.formspec_escape(mm_texture.basetexturedir)..'header.png')
local mapgens = core.get_mapgen_names() local mapgens = core.get_mapgen_names()
local current_seed = core.setting_get("fixed_map_seed") or "" local current_seed = core.setting_get("fixed_map_seed") or ""
@ -46,22 +54,22 @@ local function create_world_formspec(dialogdata)
current_seed = core.formspec_escape(current_seed) current_seed = core.formspec_escape(current_seed)
local retval = local retval =
"size[12,6,true]" .. "size[12,3]" ..
"label[2,0;" .. fgettext("World name") .. "]".. "label[2,0;" .. fgettext("World name") .. "]"..
"field[4.5,0.4;6,0.5;te_world_name;;]" .. "field[4.5,0.4;6,0.5;te_world_name;;]" ..
"label[2,1;" .. fgettext("Seed") .. "]".. "label[2,1;" .. fgettext("Seed") .. "]"..
"field[4.5,1.4;6,0.5;te_seed;;".. current_seed .. "]" .. "field[4.5,1.4;6,0.5;te_seed;;".. current_seed .. "]" ..
"label[2,2;" .. fgettext("Mapgen") .. "]".. --"label[2,2;" .. fgettext("Mapgen") .. "]"..
"dropdown[4.2,2;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" .. --"dropdown[4.2,2;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
"label[2,3;" .. fgettext("Game") .. "]".. --"label[2,3;" .. fgettext("Game") .. "]"..
"textlist[4.2,3;5.8,2.3;games;" .. gamemgr.gamelist() .. "dropdown[6000.2,6;6.3;games;" .. gamemgr.gamelist() ..
";" .. gameidx .. ";true]" .. ";1]" ..
"button[5,5.5;2.6,0.5;world_create_confirm;" .. fgettext("Create") .. "]" .. "button[5,2.6;2.6,0.5;world_create_confirm;" .. fgettext("Create") .. "]" ..
"button[7.5,5.5;2.8,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]" "button[7.5,2.6;2.8,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
if #gamemgr.games == 0 then if #gamemgr.games == 0 then
retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" .. retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" ..
@ -79,11 +87,21 @@ end
local function create_world_buttonhandler(this, fields) local function create_world_buttonhandler(this, fields)
if fields["world_create_cancel"] then
this:delete()
return true
end
if fields["world_create_confirm"] or if fields["world_create_confirm"] or
fields["key_enter"] then fields["key_enter"] then
local worldname = fields["te_world_name"] local worldname = fields["te_world_name"]
local gameindex = core.get_textlist_index("games") local gameindex
for i,item in ipairs(gamemgr.games) do
if item.name == fields["games"] then
gameindex = i
end
end
if gameindex ~= nil and if gameindex ~= nil and
worldname ~= "" then worldname ~= "" then
@ -93,7 +111,7 @@ local function create_world_buttonhandler(this, fields)
core.setting_set("fixed_map_seed", fields["te_seed"]) core.setting_set("fixed_map_seed", fields["te_seed"])
if not menudata.worldlist:uid_exists_raw(worldname) then if not menudata.worldlist:uid_exists_raw(worldname) then
core.setting_set("mg_name",fields["dd_mapgen"]) core.setting_set("mg_name","v6")
message = core.create_world(worldname,gameindex) message = core.create_world(worldname,gameindex)
else else
message = fgettext("A world named \"$1\" already exists", worldname) message = fgettext("A world named \"$1\" already exists", worldname)
@ -105,7 +123,7 @@ local function create_world_buttonhandler(this, fields)
core.setting_set("menu_last_game",gamemgr.games[gameindex].id) core.setting_set("menu_last_game",gamemgr.games[gameindex].id)
if this.data.update_worldlist_filter then if this.data.update_worldlist_filter then
menudata.worldlist:set_filtercriteria(gamemgr.games[gameindex].id) menudata.worldlist:set_filtercriteria(gamemgr.games[gameindex].id)
mm_texture.update("singleplayer", gamemgr.games[gameindex].id) --mm_texture.update("singleplayer", gamemgr.games[gameindex].id)
end end
menudata.worldlist:refresh() menudata.worldlist:refresh()
core.setting_set("mainmenu_last_selected_world", core.setting_set("mainmenu_last_selected_world",
@ -122,11 +140,7 @@ local function create_world_buttonhandler(this, fields)
if fields["games"] then if fields["games"] then
return true return true
end end
if fields["world_create_cancel"] then
this:delete()
return true
end
return false return false
end end

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -18,8 +18,14 @@
local function delete_world_formspec(dialogdata) local function delete_world_formspec(dialogdata)
mm_texture.clear("header")
mm_texture.clear("footer")
minetest.set_clouds(false)
minetest.set_background("background",minetest.formspec_escape(mm_texture.basetexturedir)..'background.png')
--minetest.set_background("header",minetest.formspec_escape(mm_texture.basetexturedir)..'header.png')
local retval = local retval =
"size[12,6,true]" .. "size[12,6]" ..
"label[2,2;" .. "label[2,2;" ..
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]".. fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]"..
"button[3.5,4.2;2.6,0.5;world_delete_confirm;" .. fgettext("Yes").. "]" .. "button[3.5,4.2;2.6,0.5;world_delete_confirm;" .. fgettext("Yes").. "]" ..

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -41,19 +41,15 @@ dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
dofile(menupath .. DIR_DELIM .. "tab_credits.lua") dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
dofile(menupath .. DIR_DELIM .. "tab_mods.lua") dofile(menupath .. DIR_DELIM .. "tab_mods.lua")
dofile(menupath .. DIR_DELIM .. "tab_settings.lua") dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
if PLATFORM ~= "Android" then dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua") dofile(menupath .. DIR_DELIM .. "dlg_delete_mod.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_mod.lua") dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua") dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua") dofile(menupath .. DIR_DELIM .. "tab_multiplayer.lua")
dofile(menupath .. DIR_DELIM .. "tab_multiplayer.lua") dofile(menupath .. DIR_DELIM .. "tab_server.lua")
dofile(menupath .. DIR_DELIM .. "tab_server.lua") dofile(menupath .. DIR_DELIM .. "tab_singleplayer.lua")
dofile(menupath .. DIR_DELIM .. "tab_singleplayer.lua") dofile(menupath .. DIR_DELIM .. "tab_texturepacks.lua")
dofile(menupath .. DIR_DELIM .. "tab_texturepacks.lua") dofile(menupath .. DIR_DELIM .. "textures.lua")
dofile(menupath .. DIR_DELIM .. "textures.lua")
else
dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua")
end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local function main_event_handler(tabview, event) local function main_event_handler(tabview, event)
@ -68,8 +64,6 @@ local function init_globals()
-- Init gamedata -- Init gamedata
gamedata.worldindex = 0 gamedata.worldindex = 0
if PLATFORM ~= "Android" then
menudata.worldlist = filterlist.create( menudata.worldlist = filterlist.create(
core.get_worlds, core.get_worlds,
compare_worlds, compare_worlds,
@ -87,64 +81,29 @@ local function init_globals()
menudata.worldlist:set_sortmode("alphabetic") menudata.worldlist:set_sortmode("alphabetic")
if not core.setting_get("menu_last_game") then if not core.setting_get("menu_last_game") then
local default_game = core.setting_get("default_game") or "minetest" local default_game = core.setting_get("default_game") or "PixelCraft"
core.setting_set("menu_last_game", default_game ) core.setting_set("menu_last_game", default_game )
end end
mm_texture.init() mm_texture.init()
else
local world_list = core.get_worlds()
local found_singleplayerworld = false
for i,world in pairs(world_list) do
if world.name == "singleplayerworld" then
found_singleplayerworld = true
gamedata.worldindex = i
break
end
end
if not found_singleplayerworld then
core.create_world("singleplayerworld", 1)
local world_list = core.get_worlds()
for i,world in pairs(world_list) do
if world.name == "singleplayerworld" then
gamedata.worldindex = i
break
end
end
end
end
-- Create main tabview -- Create main tabview
local tv_main = tabview_create("maintab",{x=12,y=5.2},{x=0,y=0}) local tv_main = tabview_create("maintab",{x=12,y=5.2},{x=0,y=0})
if PLATFORM ~= "Android" then -- tv_main:set_autosave_tab(true)
tv_main:set_autosave_tab(true)
end tv_main:add(tab_singleplayer)
if PLATFORM ~= "Android" then tv_main:add(tab_multiplayer)
tv_main:add(tab_singleplayer) tv_main:add(tab_server)
tv_main:add(tab_multiplayer) -- tv_main:add(tab_settings)
tv_main:add(tab_server) -- tv_main:add(tab_texturepacks)
else -- tv_main:add(tab_mods)
tv_main:add(tab_simple_main)
end
tv_main:add(tab_settings)
if PLATFORM ~= "Android" then
tv_main:add(tab_texturepacks)
end
tv_main:add(tab_mods)
tv_main:add(tab_credits) tv_main:add(tab_credits)
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)
if not (PLATFORM == "Android") then -- tv_main:set_tab(core.setting_get("maintab_LAST"))
tv_main:set_tab(core.setting_get("maintab_LAST"))
end
ui.set_default("maintab") ui.set_default("maintab")
tv_main:show() tv_main:show()
@ -158,6 +117,12 @@ local function init_globals()
ui.update() ui.update()
core.sound_play("main_menu", true) core.sound_play("main_menu", true)
mm_texture.clear("header")
mm_texture.clear("footer")
minetest.set_clouds(false)
minetest.set_background("background",minetest.formspec_escape(mm_texture.basetexturedir)..'background.png')
--minetest.set_background("header",minetest.formspec_escape(mm_texture.basetexturedir)..'header.png')
end end
init_globals() init_globals()

View File

@ -1,4 +0,0 @@
-- helper file to be able to debug the simple menu on PC
-- without messing around with actual menu code!
PLATFORM="Android"
dofile("builtin/mainmenu/init.lua")

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -17,6 +17,13 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local function get_formspec(tabview, name, tabdata) local function get_formspec(tabview, name, tabdata)
mm_texture.clear("header")
mm_texture.clear("footer")
minetest.set_clouds(false)
minetest.set_background("background",minetest.formspec_escape(mm_texture.basetexturedir)..'background.png')
--minetest.set_background("header",minetest.formspec_escape(mm_texture.basetexturedir)..'header.png')
local render_details = core.is_yes(core.setting_getbool("public_serverlist")) local render_details = core.is_yes(core.setting_getbool("public_serverlist"))
local retval = local retval =

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -17,6 +17,12 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local function get_formspec(tabview, name, tabdata) local function get_formspec(tabview, name, tabdata)
mm_texture.clear("header")
mm_texture.clear("footer")
minetest.set_clouds(false)
minetest.set_background("background",minetest.formspec_escape(mm_texture.basetexturedir)..'background.png')
--minetest.set_background("header",minetest.formspec_escape(mm_texture.basetexturedir)..'header.png')
local index = menudata.worldlist:get_current_index( local index = menudata.worldlist:get_current_index(
tonumber(core.setting_get("mainmenu_last_selected_world")) tonumber(core.setting_get("mainmenu_last_selected_world"))

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -738,4 +738,4 @@ if false then
file:write(create_translation_file()) file:write(create_translation_file())
file:close() file:close()
end end
end end

View File

@ -1,205 +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 3.0 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 get_formspec(tabview, name, tabdata)
local retval = ""
local render_details = dump(core.setting_getbool("public_serverlist"))
retval = retval ..
"label[8,0.5;".. fgettext("Name/Password") .. "]" ..
"field[0.25,3.25;5.5,0.5;te_address;;" ..
core.formspec_escape(core.setting_get("address")) .."]" ..
"field[5.75,3.25;2.25,0.5;te_port;;" ..
core.formspec_escape(core.setting_get("remote_port")) .."]" ..
"checkbox[8,-0.25;cb_public_serverlist;".. fgettext("Public Serverlist") .. ";" ..
render_details .. "]"
retval = retval ..
"button[8,2.5;4,1.5;btn_mp_connect;".. fgettext("Connect") .. "]" ..
"field[8.75,1.5;3.5,0.5;te_name;;" ..
core.formspec_escape(core.setting_get("name")) .."]" ..
"pwdfield[8.75,2.3;3.5,0.5;te_pwd;]"
if render_details then
retval = retval .. "tablecolumns[" ..
"color,span=3;" ..
"text,align=right;" .. -- clients
"text,align=center,padding=0.25;" .. -- "/"
"text,align=right,padding=0.25;" .. -- clients_max
image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" ..
image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" ..
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
"color,span=1;" ..
"text,padding=1]" -- name
else
retval = retval .. "tablecolumns[text]"
end
retval = retval ..
"table[-0.05,0;7.55,2.75;favourites;"
if #menudata.favorites > 0 then
retval = retval .. render_favorite(menudata.favorites[1],render_details)
for i=2,#menudata.favorites,1 do
retval = retval .. "," .. render_favorite(menudata.favorites[i],render_details)
end
end
if tabdata.fav_selected ~= nil then
retval = retval .. ";" .. tabdata.fav_selected .. "]"
else
retval = retval .. ";0]"
end
-- separator
retval = retval ..
"box[-0.28,3.75;12.4,0.1;#FFFFFF]"
-- checkboxes
retval = retval ..
"checkbox[8.0,3.9;cb_creative;".. fgettext("Creative Mode") .. ";" ..
dump(core.setting_getbool("creative_mode")) .. "]"..
"checkbox[8.0,4.4;cb_damage;".. fgettext("Enable Damage") .. ";" ..
dump(core.setting_getbool("enable_damage")) .. "]"
-- buttons
retval = retval ..
"button[0,3.7;8,1.5;btn_start_singleplayer;" .. fgettext("Start Singleplayer") .. "]" ..
"button[0,4.5;8,1.5;btn_config_sp_world;" .. fgettext("Config mods") .. "]"
return retval
end
--------------------------------------------------------------------------------
local function main_button_handler(tabview, fields, name, tabdata)
if fields["btn_start_singleplayer"] then
gamedata.selected_world = gamedata.worldindex
gamedata.singleplayer = true
core.start()
return true
end
if fields["favourites"] ~= nil then
local event = core.explode_table_event(fields["favourites"])
if event.type == "CHG" then
if event.row <= #menudata.favorites then
local address = menudata.favorites[event.row].address
local port = menudata.favorites[event.row].port
if address ~= nil and
port ~= nil then
core.setting_set("address",address)
core.setting_set("remote_port",port)
end
tabdata.fav_selected = event.row
end
end
return true
end
if fields["cb_public_serverlist"] ~= nil then
core.setting_set("public_serverlist", fields["cb_public_serverlist"])
if core.setting_getbool("public_serverlist") then
asyncOnlineFavourites()
else
menudata.favorites = core.get_favorites("local")
end
return true
end
if fields["cb_creative"] then
core.setting_set("creative_mode", fields["cb_creative"])
return true
end
if fields["cb_damage"] then
core.setting_set("enable_damage", fields["cb_damage"])
return true
end
if fields["btn_mp_connect"] ~= nil or
fields["key_enter"] ~= nil then
gamedata.playername = fields["te_name"]
gamedata.password = fields["te_pwd"]
gamedata.address = fields["te_address"]
gamedata.port = fields["te_port"]
local fav_idx = core.get_textlist_index("favourites")
if fav_idx ~= nil and fav_idx <= #menudata.favorites and
menudata.favorites[fav_idx].address == fields["te_address"] and
menudata.favorites[fav_idx].port == fields["te_port"] then
gamedata.servername = menudata.favorites[fav_idx].name
gamedata.serverdescription = menudata.favorites[fav_idx].description
if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min,
menudata.favorites[fav_idx].proto_max) then
return true
end
else
gamedata.servername = ""
gamedata.serverdescription = ""
end
gamedata.selected_world = 0
core.setting_set("address",fields["te_address"])
core.setting_set("remote_port",fields["te_port"])
core.start()
return true
end
if fields["btn_config_sp_world"] ~= nil then
local configdialog = create_configure_world_dlg(1)
if (configdialog ~= nil) then
configdialog:set_parent(tabview)
tabview:hide()
configdialog:show()
end
return true
end
end
--------------------------------------------------------------------------------
local function on_activate(type,old_tab,new_tab)
if type == "LEAVE" then
return
end
if core.setting_getbool("public_serverlist") then
asyncOnlineFavourites()
else
menudata.favorites = core.get_favorites("local")
end
end
--------------------------------------------------------------------------------
tab_simple_main = {
name = "main",
caption = fgettext("Main"),
cbf_formspec = get_formspec,
cbf_button_handler = main_button_handler,
on_change = on_activate
}

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,
@ -22,68 +22,6 @@ local function current_game()
return game return game
end end
local 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)
for key,value in pairs(fields) do
for j=1,#gamemgr.games,1 do
if ("game_btnbar_" .. gamemgr.games[j].id == key) then
mm_texture.update("singleplayer", gamemgr.games[j])
core.set_topleft_text(gamemgr.games[j].name)
core.setting_set("menu_last_game",gamemgr.games[j].id)
menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
local index = filterlist.get_current_index(menudata.worldlist,
tonumber(core.setting_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)
return true
end
end
end
end
local btnbar = buttonbar_create("game_button_bar",
game_buttonbar_button_handler,
{x=-0.3,y=5.65}, "horizontal", {x=12.4,y=1.15})
for i=1,#gamemgr.games,1 do
local btn_name = "game_btnbar_" .. gamemgr.games[i].id
local image = nil
local text = nil
local tooltip = core.formspec_escape(gamemgr.games[i].name)
if gamemgr.games[i].menuicon_path ~= nil and
gamemgr.games[i].menuicon_path ~= "" then
image = core.formspec_escape(gamemgr.games[i].menuicon_path)
else
local part1 = gamemgr.games[i].id:sub(1,5)
local part2 = gamemgr.games[i].id:sub(6,10)
local part3 = gamemgr.games[i].id:sub(11)
text = part1 .. "\n" .. part2
if part3 ~= nil and
part3 ~= "" then
text = text .. "\n" .. part3
end
end
btnbar:add_button(btn_name, text, image, tooltip)
end
end
local function get_formspec(tabview, name, tabdata) local function get_formspec(tabview, name, tabdata)
local retval = "" local retval = ""
@ -93,16 +31,14 @@ local function get_formspec(tabview, name, tabdata)
) )
retval = retval .. retval = retval ..
"button[4,4.15;2.6,0.5;world_delete;".. fgettext("Delete") .. "]" .. "button[3.5,4.5;2.6,0.5;world_delete;".. fgettext("Delete") .. "]" ..
"button[6.5,4.15;2.8,0.5;world_create;".. fgettext("New") .. "]" .. "button[6,4.5;2.8,0.5;world_create;".. fgettext("New") .. "]" ..
"button[9.2,4.15;2.55,0.5;world_configure;".. fgettext("Configure") .. "]" .. "button[8.7,4.5;3.30,0.5;play;".. fgettext("Play") .. "]" ..
"button[8.5,4.95;3.25,0.5;play;".. fgettext("Play") .. "]" .. "checkbox[0.25,4;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
"label[4,-0.25;".. fgettext("Select World:") .. "]"..
"checkbox[0.25,0.25;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
dump(core.setting_getbool("creative_mode")) .. "]".. dump(core.setting_getbool("creative_mode")) .. "]"..
"checkbox[0.25,0.7;cb_enable_damage;".. fgettext("Enable Damage") .. ";" .. "checkbox[0.25,4.5;cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
dump(core.setting_getbool("enable_damage")) .. "]".. dump(core.setting_getbool("enable_damage")) .. "]"..
"textlist[4,0.25;7.5,3.7;sp_worlds;" .. "textlist[0,0;11.75,3.7;sp_worlds;" ..
menu_render_worldlist() .. menu_render_worldlist() ..
";" .. index .. "]" ";" .. index .. "]"
return retval return retval
@ -215,35 +151,11 @@ local function main_button_handler(this, fields, name, tabdata)
end end
end end
local function on_change(type, old_tab, new_tab)
local buttonbar = ui.find_by_name("game_button_bar")
if ( buttonbar == nil ) then
singleplayer_refresh_gamebar()
buttonbar = ui.find_by_name("game_button_bar")
end
if (type == "ENTER") then
local game = current_game()
if game then
menudata.worldlist:set_filtercriteria(game.id)
core.set_topleft_text(game.name)
mm_texture.update("singleplayer",game)
end
buttonbar:show()
else
menudata.worldlist:set_filtercriteria(nil)
buttonbar:hide()
core.set_topleft_text("")
mm_texture.update(new_tab,nil)
end
end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
tab_singleplayer = { tab_singleplayer = {
name = "singleplayer", name = "singleplayer",
caption = fgettext("Singleplayer"), caption = fgettext("Single Player"),
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

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -3,7 +3,7 @@
-- --
--This program is free software; you can redistribute it and/or modify --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 --it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or --the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version. --(at your option) any later version.
-- --
--This program is distributed in the hope that it will be useful, --This program is distributed in the hope that it will be useful,

View File

@ -634,11 +634,7 @@ void MapgenFractal::generateCaves(s16 max_stone_y)
PseudoRandom ps(blockseed + 21343); PseudoRandom ps(blockseed + 21343);
u32 bruises_count = (ps.range(1, 4) == 1) ? ps.range(1, 2) : 0; u32 bruises_count = (ps.range(1, 4) == 1) ? ps.range(1, 2) : 0;
for (u32 i = 0; i < bruises_count; i++) { for (u32 i = 0; i < bruises_count; i++) {
<<<<<<< HEAD
CaveFractal cave(this, &ps);
=======
CaveV5 cave(this, &ps); CaveV5 cave(this, &ps);
>>>>>>> f3ac2517ea585d31d176070be25adf8a68624c87
cave.makeCave(node_min, node_max, max_stone_y); cave.makeCave(node_min, node_max, max_stone_y);
} }
} }

View File

@ -193,8 +193,3 @@ void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player,
ScriptApiPlayer::~ScriptApiPlayer() ScriptApiPlayer::~ScriptApiPlayer()
{ {
} }
ScriptApiPlayer::~ScriptApiPlayer()
{
}

View File

@ -568,8 +568,6 @@ void Server::AsyncRunStep(bool initial_step)
m_env->getMap().timerUpdate(map_timer_and_unload_dtime, m_env->getMap().timerUpdate(map_timer_and_unload_dtime,
g_settings->getFloat("server_unload_unused_data_timeout"), g_settings->getFloat("server_unload_unused_data_timeout"),
U32_MAX); U32_MAX);
<<<<<<< HEAD
=======
} }
/* /*
@ -586,7 +584,6 @@ void Server::AsyncRunStep(bool initial_step)
} }
m_admin_chat->outgoing_queue.push_back( m_admin_chat->outgoing_queue.push_back(
new ChatEventTimeInfo(m_env->getGameTime(), m_env->getTimeOfDay())); new ChatEventTimeInfo(m_env->getGameTime(), m_env->getTimeOfDay()));
>>>>>>> f3ac2517ea585d31d176070be25adf8a68624c87
} }
/* /*
@ -2957,17 +2954,12 @@ void Server::notifyPlayer(const char *name, const std::wstring &msg)
if (!m_env) if (!m_env)
return; return;
<<<<<<< HEAD
Player *player = m_env->getPlayer(name);
if (!player)
=======
if (m_admin_nick == name && !m_admin_nick.empty()) { if (m_admin_nick == name && !m_admin_nick.empty()) {
m_admin_chat->outgoing_queue.push_back(new ChatEventChat("", msg)); m_admin_chat->outgoing_queue.push_back(new ChatEventChat("", msg));
} }
Player *player = m_env->getPlayer(name); Player *player = m_env->getPlayer(name);
if (!player) { if (!player) {
>>>>>>> f3ac2517ea585d31d176070be25adf8a68624c87
return; return;
} }
@ -3549,8 +3541,4 @@ void dedicated_server_loop(Server &server, bool &kill)
} }
} }
} }
<<<<<<< HEAD
} }
=======
}
>>>>>>> f3ac2517ea585d31d176070be25adf8a68624c87