14/15
parent
c7b69b0483
commit
bf42107a0f
|
@ -309,7 +309,7 @@ core.register_chatcommand("teleport", {
|
||||||
teleportee:setpos(p)
|
teleportee:setpos(p)
|
||||||
return true, "Teleporting to "..core.pos_to_string(p)
|
return true, "Teleporting to "..core.pos_to_string(p)
|
||||||
end
|
end
|
||||||
|
|
||||||
local teleportee = nil
|
local teleportee = nil
|
||||||
local p = nil
|
local p = nil
|
||||||
local target_name = nil
|
local target_name = nil
|
||||||
|
@ -346,7 +346,7 @@ core.register_chatcommand("teleport", {
|
||||||
return true, "Teleporting " .. teleportee_name
|
return true, "Teleporting " .. teleportee_name
|
||||||
.. " to " .. core.pos_to_string(p)
|
.. " to " .. core.pos_to_string(p)
|
||||||
end
|
end
|
||||||
|
|
||||||
local teleportee = nil
|
local teleportee = nil
|
||||||
local p = nil
|
local p = nil
|
||||||
local teleportee_name = nil
|
local teleportee_name = nil
|
||||||
|
@ -368,7 +368,7 @@ core.register_chatcommand("teleport", {
|
||||||
.. " to " .. target_name
|
.. " to " .. target_name
|
||||||
.. " at " .. core.pos_to_string(p)
|
.. " at " .. core.pos_to_string(p)
|
||||||
end
|
end
|
||||||
|
|
||||||
return false, 'Invalid parameters ("' .. param
|
return false, 'Invalid parameters ("' .. param
|
||||||
.. '") or player not found (see /help teleport)'
|
.. '") or player not found (see /help teleport)'
|
||||||
end,
|
end,
|
||||||
|
@ -509,7 +509,6 @@ core.register_chatcommand("giveme", {
|
||||||
if not itemstring then
|
if not itemstring then
|
||||||
return false, "ItemString required"
|
return false, "ItemString required"
|
||||||
end
|
end
|
||||||
core.stat_add("giveme", name)
|
|
||||||
return handle_give_command("/giveme", name, name, itemstring)
|
return handle_give_command("/giveme", name, name, itemstring)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -783,7 +782,6 @@ core.register_chatcommand("die", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
player:set_hp(0)
|
player:set_hp(0)
|
||||||
core.stat_add("suicide", name)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ elseif INIT == "mainmenu" then
|
||||||
if mainmenuscript ~= nil and mainmenuscript ~= "" then
|
if mainmenuscript ~= nil and mainmenuscript ~= "" then
|
||||||
dofile(mainmenuscript)
|
dofile(mainmenuscript)
|
||||||
else
|
else
|
||||||
dofile(core.get_mainmenu_path()..DIR_DELIM.."fm_init.lua")
|
dofile(core.get_mainmenu_path()..DIR_DELIM.."init.lua")
|
||||||
end
|
end
|
||||||
elseif INIT == "async" then
|
elseif INIT == "async" then
|
||||||
dofile(asyncpath.."init.lua")
|
dofile(asyncpath.."init.lua")
|
||||||
|
|
|
@ -35,8 +35,8 @@ local function add_server_formspec(dialogdata)
|
||||||
"field[6.5,6.4;6,0.5;desc;;Added on ".. os.date() .."]" ..
|
"field[6.5,6.4;6,0.5;desc;;Added on ".. os.date() .."]" ..
|
||||||
|
|
||||||
|
|
||||||
"image_button[8,9.54;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;server_add_confirm;".. fgettext("Add") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[8,9.54;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;server_add_confirm;".. fgettext("Add") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;server_add_cancel;".. fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;server_add_cancel;".. fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
@ -64,7 +64,7 @@ local function add_server_buttonhandler(this, fields)
|
||||||
--gamedata.errormessage = fgettext("Can't find serverlist_file! ("..path..')')
|
--gamedata.errormessage = fgettext("Can't find serverlist_file! ("..path..')')
|
||||||
end
|
end
|
||||||
if favourites then
|
if favourites then
|
||||||
favourites = minetest.parse_json(favourites)
|
favourites = core.parse_json(favourites)
|
||||||
else
|
else
|
||||||
favourites = {["list"]={},}
|
favourites = {["list"]={},}
|
||||||
end
|
end
|
||||||
|
@ -79,7 +79,7 @@ local function add_server_buttonhandler(this, fields)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
favourites = minetest.write_json(favourites)
|
favourites = core.write_json(favourites)
|
||||||
|
|
||||||
--print(path)
|
--print(path)
|
||||||
local output = io.open(path, "w")
|
local output = io.open(path, "w")
|
||||||
|
|
|
@ -52,8 +52,8 @@ local function get_formspec(data)
|
||||||
"label[8,3;" .. fgettext("Depends:") .. "]" ..
|
"label[8,3;" .. fgettext("Depends:") .. "]" ..
|
||||||
"textlist[8,3.5;7,4.0;world_config_depends;" ..
|
"textlist[8,3.5;7,4.0;world_config_depends;" ..
|
||||||
modmgr.get_dependencies(mod.path) .. ";0]" ..
|
modmgr.get_dependencies(mod.path) .. ";0]" ..
|
||||||
"image_button[8,9.55;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_config_world_save;" .. fgettext("Save") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[8,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_config_world_save;" .. fgettext("Save") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_config_world_cancel;".. fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_config_world_cancel;".. fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
if mod ~= nil and mod.name ~= "" and mod.typ ~= "game_mod" then
|
if mod ~= nil and mod.name ~= "" and mod.typ ~= "game_mod" then
|
||||||
if mod.is_modpack then
|
if mod.is_modpack then
|
||||||
|
@ -69,9 +69,9 @@ local function get_formspec(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
if all_enabled == false then
|
if all_enabled == false then
|
||||||
retval = retval .. "image_button[8,7.55;3.5,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mp_enable;" .. fgettext("Enable MP") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[8,7.55;3.5,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mp_enable;" .. fgettext("Enable MP") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
else
|
else
|
||||||
retval = retval .. "image_button[8,7.85;3.5,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mp_disable;" .. fgettext("Disable MP") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[8,7.85;3.5,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mp_disable;" .. fgettext("Disable MP") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if mod.enabled then
|
if mod.enabled then
|
||||||
|
@ -83,7 +83,7 @@ local function get_formspec(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"image_button[11.75,7.55;3.5,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_all_mods;" .. fgettext("Enable all") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[11.75,7.55;3.5,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_all_mods;" .. fgettext("Enable all") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"textlist[1,3.5;6,4.0;world_config_modlist;"
|
"textlist[1,3.5;6,4.0;world_config_modlist;"
|
||||||
--"textlist[5.5,0.5;5.5,5.75;world_config_modlist;"
|
--"textlist[5.5,0.5;5.5,5.75;world_config_modlist;"
|
||||||
|
|
||||||
|
|
|
@ -51,22 +51,22 @@ local function create_world_formspec(dialogdata)
|
||||||
"box[-100,8.5;200,10;#999999]" ..
|
"box[-100,8.5;200,10;#999999]" ..
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
|
|
||||||
"label[4,3;" .. fgettext("World name") .. "]"..
|
"label[4,4;" .. fgettext("World name") .. "]"..
|
||||||
"field[6.5,3.4;6,0.5;te_world_name;;]" ..
|
"field[6.5,4.4;6,0.5;te_world_name;;]" ..
|
||||||
|
|
||||||
"label[4,4;" .. fgettext("Seed") .. "]"..
|
"label[4,5;" .. fgettext("Seed") .. "]"..
|
||||||
"field[6.5,4.4;6,0.5;te_seed;;".. current_seed .. "]" ..
|
"field[6.5,5.4;6,0.5;te_seed;;".. current_seed .. "]" ..
|
||||||
|
|
||||||
"label[4,5;" .. fgettext("Mapgen") .. "]"..
|
-- "label[4,5;" .. fgettext("Mapgen") .. "]"..
|
||||||
"dropdown[6.2,5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
|
-- "dropdown[6.2,5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
|
||||||
|
|
||||||
"label[4,6;" .. fgettext("Game") .. "]"..
|
-- "label[4,6;" .. fgettext("Game") .. "]"..
|
||||||
"dropdown[6.2,6;6.3;games;" .. gamemgr.gamelist() ..
|
"dropdown[6000.2,6;6.3;games;" .. gamemgr.gamelist() ..
|
||||||
";" .. gameidx .. "]" ..
|
";1]" ..
|
||||||
|
|
||||||
|
|
||||||
"image_button[8,9.55;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create_confirm;".. fgettext("Create") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[8,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create_confirm;".. fgettext("Create") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create_cancel;".. fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create_cancel;".. fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
if #gamemgr.games == 0 then
|
if #gamemgr.games == 0 then
|
||||||
retval = retval .. "box[4,7;8,1;#ff8800]label[4.25,7;" ..
|
retval = retval .. "box[4,7;8,1;#ff8800]label[4.25,7;" ..
|
||||||
|
@ -105,7 +105,7 @@ local function create_world_buttonhandler(this, fields)
|
||||||
local message = nil
|
local message = nil
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -28,8 +28,8 @@ local function delete_mod_formspec(dialogdata)
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
"label[6.5,4.5;" ..
|
"label[6.5,4.5;" ..
|
||||||
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.mod.name) .. ";]"..
|
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.mod.name) .. ";]"..
|
||||||
"image_button[4,5.7;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_delete_mod_confirm;" .. fgettext("Yes").. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[4,5.7;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_delete_mod_confirm;" .. fgettext("Yes").. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[8,5.7;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_delete_mod_cancel;" .. fgettext("No") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[8,5.7;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_delete_mod_cancel;" .. fgettext("No") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ local function delete_world_formspec(dialogdata)
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
"label[6.5,4.5;" ..
|
"label[6.5,4.5;" ..
|
||||||
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]"..
|
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]"..
|
||||||
"image_button[4,5.7;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete_confirm;" .. fgettext("Yes").. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[4,5.7;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete_confirm;" .. fgettext("Yes").. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[8,5.7;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete_cancel;" .. fgettext("No") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[8,5.7;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete_cancel;" .. fgettext("No") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ local function rename_modpack_formspec(dialogdata)
|
||||||
"field[4.5,1.4;6,0.5;te_modpack_name;;" ..
|
"field[4.5,1.4;6,0.5;te_modpack_name;;" ..
|
||||||
dialogdata.mod.name ..
|
dialogdata.mod.name ..
|
||||||
"]" ..
|
"]" ..
|
||||||
"image_button[5,4.2;2.6,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_rename_modpack_confirm;"..
|
"image_button[5,4.2;2.6,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_rename_modpack_confirm;"..
|
||||||
fgettext("Accept") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
fgettext("Accept") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[7.5,4.2;2.8,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_rename_modpack_cancel;"..
|
"image_button[7.5,4.2;2.8,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_rename_modpack_cancel;"..
|
||||||
fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,321 +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.
|
|
||||||
|
|
||||||
gamemgr = {}
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.dialog_new_game()
|
|
||||||
local retval =
|
|
||||||
"label[2,2;" .. fgettext("Game Name") .. "]"..
|
|
||||||
"field[4.5,2.4;6,0.5;te_game_name;;]" ..
|
|
||||||
"button[5,4.2;2.6,0.5;new_game_confirm;" .. fgettext("Create") .. "]" ..
|
|
||||||
"button[7.5,4.2;2.8,0.5;new_game_cancel;" .. fgettext("Cancel") .. "]"
|
|
||||||
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.handle_games_buttons(fields)
|
|
||||||
if fields["gamelist"] ~= nil then
|
|
||||||
local event = core.explode_textlist_event(fields["gamelist"])
|
|
||||||
gamemgr.selected_game = event.index
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields["btn_game_mgr_edit_game"] ~= nil then
|
|
||||||
return {
|
|
||||||
is_dialog = true,
|
|
||||||
show_buttons = false,
|
|
||||||
current_tab = "dialog_edit_game"
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields["btn_game_mgr_new_game"] ~= nil then
|
|
||||||
return {
|
|
||||||
is_dialog = true,
|
|
||||||
show_buttons = false,
|
|
||||||
current_tab = "dialog_new_game"
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.handle_new_game_buttons(fields)
|
|
||||||
|
|
||||||
if fields["new_game_confirm"] and
|
|
||||||
fields["te_game_name"] ~= nil and
|
|
||||||
fields["te_game_name"] ~= "" then
|
|
||||||
local gamepath = core.get_gamepath()
|
|
||||||
|
|
||||||
if gamepath ~= nil and
|
|
||||||
gamepath ~= "" then
|
|
||||||
local gamefolder = cleanup_path(fields["te_game_name"])
|
|
||||||
|
|
||||||
--TODO check for already existing first
|
|
||||||
core.create_dir(gamepath .. DIR_DELIM .. gamefolder)
|
|
||||||
core.create_dir(gamepath .. DIR_DELIM .. gamefolder .. DIR_DELIM .. "mods")
|
|
||||||
core.create_dir(gamepath .. DIR_DELIM .. gamefolder .. DIR_DELIM .. "menu")
|
|
||||||
|
|
||||||
local gameconf =
|
|
||||||
io.open(gamepath .. DIR_DELIM .. gamefolder .. DIR_DELIM .. "game.conf","w")
|
|
||||||
|
|
||||||
if gameconf then
|
|
||||||
gameconf:write("name = " .. fields["te_game_name"])
|
|
||||||
gameconf:close()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
is_dialog = false,
|
|
||||||
show_buttons = true,
|
|
||||||
current_tab = core.setting_get("main_menu_tab")
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.handle_edit_game_buttons(fields)
|
|
||||||
local current_game = gamemgr.get_game(gamemgr.selected_game)
|
|
||||||
|
|
||||||
if fields["btn_close_edit_game"] ~= nil or
|
|
||||||
current_game == nil then
|
|
||||||
return {
|
|
||||||
is_dialog = false,
|
|
||||||
show_buttons = true,
|
|
||||||
current_tab = core.setting_get("main_menu_tab")
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields["btn_remove_mod_from_game"] ~= nil then
|
|
||||||
gamemgr.delete_mod(current_game,core.get_textlist_index("mods_current"))
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields["btn_add_mod_to_game"] ~= nil then
|
|
||||||
local modindex = core.get_textlist_index("mods_available")
|
|
||||||
|
|
||||||
local mod = modmgr.get_global_mod(modindex)
|
|
||||||
if mod ~= nil then
|
|
||||||
|
|
||||||
local sourcepath = mod.path
|
|
||||||
|
|
||||||
if not gamemgr.add_mod(current_game,sourcepath) then
|
|
||||||
gamedata.errormessage =
|
|
||||||
fgettext("Gamemgr: Unable to copy mod \"$1\" to game \"$2\"", mod.name, current_game.id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.add_mod(gamespec,sourcepath)
|
|
||||||
if gamespec.gamemods_path ~= nil and
|
|
||||||
gamespec.gamemods_path ~= "" then
|
|
||||||
|
|
||||||
local modname = get_last_folder(sourcepath)
|
|
||||||
|
|
||||||
return core.copy_dir(sourcepath,gamespec.gamemods_path .. DIR_DELIM .. modname);
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.delete_mod(gamespec,modindex)
|
|
||||||
if gamespec.gamemods_path ~= nil and
|
|
||||||
gamespec.gamemods_path ~= "" then
|
|
||||||
local game_mods = {}
|
|
||||||
get_mods(gamespec.gamemods_path,game_mods)
|
|
||||||
|
|
||||||
if modindex > 0 and
|
|
||||||
#game_mods >= modindex then
|
|
||||||
|
|
||||||
if game_mods[modindex].path:sub(0,gamespec.gamemods_path:len())
|
|
||||||
== gamespec.gamemods_path then
|
|
||||||
core.delete_dir(game_mods[modindex].path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.find_by_gameid(gameid)
|
|
||||||
for i=1,#gamemgr.games,1 do
|
|
||||||
if gamemgr.games[i].id == gameid then
|
|
||||||
return gamemgr.games[i], i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil, nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.get_game_mods(gamespec, retval)
|
|
||||||
if gamespec ~= nil and
|
|
||||||
gamespec.gamemods_path ~= nil and
|
|
||||||
gamespec.gamemods_path ~= "" then
|
|
||||||
get_mods(gamespec.gamemods_path, retval)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.get_game_modlist(gamespec)
|
|
||||||
local retval = ""
|
|
||||||
local game_mods = {}
|
|
||||||
gamemgr.get_game_mods(gamespec, game_mods)
|
|
||||||
for i=1,#game_mods,1 do
|
|
||||||
if retval ~= "" then
|
|
||||||
retval = retval..","
|
|
||||||
end
|
|
||||||
retval = retval .. game_mods[i].name
|
|
||||||
end
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.gettab(name)
|
|
||||||
local retval = ""
|
|
||||||
|
|
||||||
if name == "dialog_edit_game" then
|
|
||||||
retval = retval .. gamemgr.dialog_edit_game()
|
|
||||||
end
|
|
||||||
|
|
||||||
if name == "dialog_new_game" then
|
|
||||||
retval = retval .. gamemgr.dialog_new_game()
|
|
||||||
end
|
|
||||||
|
|
||||||
if name == "game_mgr" then
|
|
||||||
retval = retval .. gamemgr.tab()
|
|
||||||
end
|
|
||||||
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.tab()
|
|
||||||
if gamemgr.selected_game == nil then
|
|
||||||
gamemgr.selected_game = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local retval =
|
|
||||||
"label[6.5,-0.25;" .. fgettext("Games") .. ":]" ..
|
|
||||||
"textlist[6.5,0.25;8,4.4;gamelist;" ..
|
|
||||||
gamemgr.gamelist() ..
|
|
||||||
";" .. gamemgr.selected_game .. "]"
|
|
||||||
|
|
||||||
local current_game = gamemgr.get_game(gamemgr.selected_game)
|
|
||||||
|
|
||||||
if current_game ~= nil then
|
|
||||||
if current_game.menuicon_path ~= nil and
|
|
||||||
current_game.menuicon_path ~= "" then
|
|
||||||
retval = retval ..
|
|
||||||
"image[6.5,5.5;2,2;" ..
|
|
||||||
core.formspec_escape(current_game.menuicon_path) .. "]"
|
|
||||||
end
|
|
||||||
|
|
||||||
retval = retval ..
|
|
||||||
"field[9,5.5;6,2;;" .. current_game.name .. ";]"..
|
|
||||||
"label[6.5,7.2;" .. fgettext("Mods:") .."]" ..
|
|
||||||
"button[6.5,11.4;3.2,0.2;btn_game_mgr_edit_game;" .. fgettext("edit game") .. "]" ..
|
|
||||||
"textlist[6.5,7.7;8,3.3;game_mgr_modlist;"
|
|
||||||
.. gamemgr.get_game_modlist(current_game) ..";0]" ..
|
|
||||||
"button[6.5,4.9;3.2,0.5;btn_game_mgr_new_game;" .. fgettext("new game") .. "]"
|
|
||||||
end
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.dialog_edit_game()
|
|
||||||
local current_game = gamemgr.get_game(gamemgr.selected_game)
|
|
||||||
if current_game ~= nil then
|
|
||||||
local retval =
|
|
||||||
"vertlabel[0,-0.25;" .. fgettext("EDIT GAME") .."]" ..
|
|
||||||
"label[0,-0.25;" .. current_game.name .. "]" ..
|
|
||||||
"button[11.55,-0.2;0.75,0.5;btn_close_edit_game;x]"
|
|
||||||
|
|
||||||
if current_game.menuicon_path ~= nil and
|
|
||||||
current_game.menuicon_path ~= "" then
|
|
||||||
retval = retval ..
|
|
||||||
"image[5.25,0;2,2;" ..
|
|
||||||
core.formspec_escape(current_game.menuicon_path) .. "]"
|
|
||||||
end
|
|
||||||
|
|
||||||
retval = retval ..
|
|
||||||
"textlist[0.5,0.5;4.5,4.3;mods_current;"
|
|
||||||
.. gamemgr.get_game_modlist(current_game) ..";0]"
|
|
||||||
|
|
||||||
|
|
||||||
retval = retval ..
|
|
||||||
"textlist[7,0.5;4.5,4.3;mods_available;"
|
|
||||||
.. modmgr.render_modlist() .. ";0]"
|
|
||||||
|
|
||||||
retval = retval ..
|
|
||||||
"button[0.55,4.95;4.7,0.5;btn_remove_mod_from_game;" .. fgettext("Remove selected mod") .."]"
|
|
||||||
|
|
||||||
retval = retval ..
|
|
||||||
"button[7.05,4.95;4.7,0.5;btn_add_mod_to_game;" .. fgettext("<<-- Add mod") .."]"
|
|
||||||
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.handle_buttons(tab,fields)
|
|
||||||
local retval = nil
|
|
||||||
|
|
||||||
if tab == "dialog_edit_game" then
|
|
||||||
retval = gamemgr.handle_edit_game_buttons(fields)
|
|
||||||
end
|
|
||||||
|
|
||||||
if tab == "dialog_new_game" then
|
|
||||||
retval = gamemgr.handle_new_game_buttons(fields)
|
|
||||||
end
|
|
||||||
|
|
||||||
if tab == "game_mgr" then
|
|
||||||
retval = gamemgr.handle_games_buttons(fields)
|
|
||||||
end
|
|
||||||
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.get_game(index)
|
|
||||||
if index > 0 and index <= #gamemgr.games then
|
|
||||||
return gamemgr.games[index]
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.update_gamelist()
|
|
||||||
gamemgr.games = core.get_games()
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
function gamemgr.gamelist()
|
|
||||||
local retval = ""
|
|
||||||
if #gamemgr.games > 0 then
|
|
||||||
retval = retval .. gamemgr.games[1].name
|
|
||||||
|
|
||||||
for i=2,#gamemgr.games,1 do
|
|
||||||
retval = retval .. "," .. gamemgr.games[i].name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return retval
|
|
||||||
end
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -66,11 +66,11 @@ end
|
||||||
local function get_formspec2(tabview, name, tabdata)
|
local function get_formspec2(tabview, name, tabdata)
|
||||||
local retval = ""
|
local retval = ""
|
||||||
retval = retval .. "bgcolor[#00000000;false]"
|
retval = retval .. "bgcolor[#00000000;false]"
|
||||||
retval = retval .. "image_button[2.5,3.4;7,1;"..minetest.formspec_escape(mm_texture.basetexturedir) .. "menu_button.png;btn_show_multiplayer;" .. fgettext("Multiplayer") .. ";true;true;" .. minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[2.5,3.4;7,1;"..core.formspec_escape(mm_texture.basetexturedir) .. "menu_button.png;btn_show_multiplayer;" .. fgettext("Multiplayer") .. ";true;true;" .. core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
retval = retval .. "image_button[2.5,4.8;7,1;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_options;".. fgettext("Options") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[2.5,4.8;7,1;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_options;".. fgettext("Options") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
--retval = retval .. "image_button[8.5,4.8;1,1;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_help;?;true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
--retval = retval .. "image_button[8.5,4.8;1,1;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_help;?;true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
retval = retval .. "image_button[2.5,6.2;7,1;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_exit;".. fgettext("Exit") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[2.5,6.2;7,1;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_exit;".. fgettext("Exit") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
retval = retval .. "image_button[2.5,2.0;7,1;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_singleplayer;".. fgettext("Singleplayer") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[2.5,2.0;7,1;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_singleplayer;".. fgettext("Singleplayer") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
local si = core.get_screen_info()
|
local si = core.get_screen_info()
|
||||||
|
|
||||||
|
@ -80,16 +80,16 @@ local function get_formspec2(tabview, name, tabdata)
|
||||||
--print(xdiv..' x '..ydiv..' = '..ratio)
|
--print(xdiv..' x '..ydiv..' = '..ratio)
|
||||||
|
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
local rnd = 'image['.. 12*ratio ..','.. 1 .. ';6,0.5;'..minetest.formspec_escape(mm_texture.basetexturedir)..'ad_label'..tostring(math.random(1,14))..'.png]'
|
-- local rnd = 'image['.. 12*ratio ..','.. 1 .. ';6,0.5;'..core.formspec_escape(mm_texture.basetexturedir)..'ad_label'..tostring(math.random(1,14))..'.png]'
|
||||||
|
|
||||||
return retval .. rnd
|
return retval --.. rnd
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function main_button_handler2(tabview, fields, name, tabdata)
|
local function main_button_handler2(tabview, fields, name, tabdata)
|
||||||
local index = ''
|
local index = ''
|
||||||
if fields["btn_show_singleplayer"] then index = "server" end
|
if fields["btn_show_singleplayer"] then index = "singleplayer" end
|
||||||
if fields["btn_show_multiplayer"] then index = "multiplayer" end
|
if fields["btn_show_multiplayer"] then index = "multiplayer" end
|
||||||
if fields["btn_show_options"] then index = "settings" end
|
if fields["btn_show_options"] then index = "settings" end
|
||||||
--if fields["btn_show_help"] then index = "help" end
|
--if fields["btn_show_help"] then index = "help" end
|
||||||
|
@ -126,8 +126,8 @@ local function on_activate2(type,old_tab,new_tab)
|
||||||
mm_texture.clear("header")
|
mm_texture.clear("header")
|
||||||
mm_texture.clear("footer")
|
mm_texture.clear("footer")
|
||||||
core.set_clouds(false)
|
core.set_clouds(false)
|
||||||
core.set_background("background",minetest.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
core.set_background("header",minetest.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -17,34 +17,34 @@
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function get_mods(path,retval,modpack)
|
function get_mods(path,retval,modpack)
|
||||||
local mods = core.get_dirlist(path, true)
|
local mods = core.get_dirlist(path, true)
|
||||||
|
|
||||||
for i=1, #mods, 1 do
|
|
||||||
if mods[i]:sub(1,1) ~= "." then
|
|
||||||
local toadd = {}
|
|
||||||
local modpackfile = nil
|
|
||||||
|
|
||||||
toadd.name = mods[i]
|
for i=1, #mods, 1 do
|
||||||
toadd.path = path .. DIR_DELIM .. mods[i] .. DIR_DELIM
|
if mods[i]:sub(1,1) ~= "." then
|
||||||
if modpack ~= nil and
|
local toadd = {}
|
||||||
modpack ~= "" then
|
local modpackfile = nil
|
||||||
toadd.modpack = modpack
|
|
||||||
else
|
|
||||||
local filename = path .. DIR_DELIM .. mods[i] .. DIR_DELIM .. "modpack.txt"
|
|
||||||
local error = nil
|
|
||||||
modpackfile,error = io.open(filename,"r")
|
|
||||||
end
|
|
||||||
|
|
||||||
if modpackfile ~= nil then
|
toadd.name = mods[i]
|
||||||
modpackfile:close()
|
toadd.path = path .. DIR_DELIM .. mods[i] .. DIR_DELIM
|
||||||
toadd.is_modpack = true
|
if modpack ~= nil and
|
||||||
table.insert(retval,toadd)
|
modpack ~= "" then
|
||||||
get_mods(path .. DIR_DELIM .. mods[i],retval,mods[i])
|
toadd.modpack = modpack
|
||||||
else
|
else
|
||||||
table.insert(retval,toadd)
|
local filename = path .. DIR_DELIM .. mods[i] .. DIR_DELIM .. "modpack.txt"
|
||||||
end
|
local error = nil
|
||||||
end
|
modpackfile,error = io.open(filename,"r")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if modpackfile ~= nil then
|
||||||
|
modpackfile:close()
|
||||||
|
toadd.is_modpack = true
|
||||||
|
table.insert(retval,toadd)
|
||||||
|
get_mods(path .. DIR_DELIM .. mods[i],retval,mods[i])
|
||||||
|
else
|
||||||
|
table.insert(retval,toadd)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--modmanager implementation
|
--modmanager implementation
|
||||||
|
@ -52,513 +52,513 @@ modmgr = {}
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.extract(modfile)
|
function modmgr.extract(modfile)
|
||||||
if modfile.type == "zip" then
|
if modfile.type == "zip" then
|
||||||
local tempfolder = os.tempfolder()
|
local tempfolder = os.tempfolder()
|
||||||
|
|
||||||
if tempfolder ~= nil and
|
if tempfolder ~= nil and
|
||||||
tempfolder ~= "" then
|
tempfolder ~= "" then
|
||||||
core.create_dir(tempfolder)
|
core.create_dir(tempfolder)
|
||||||
if core.extract_zip(modfile.name,tempfolder) then
|
if core.extract_zip(modfile.name,tempfolder) then
|
||||||
return tempfolder
|
return tempfolder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function modmgr.getbasefolder(temppath)
|
function modmgr.getbasefolder(temppath)
|
||||||
|
|
||||||
if temppath == nil then
|
if temppath == nil then
|
||||||
return {
|
return {
|
||||||
type = "invalid",
|
type = "invalid",
|
||||||
path = ""
|
path = ""
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local testfile = io.open(temppath .. DIR_DELIM .. "init.lua","r")
|
local testfile = io.open(temppath .. DIR_DELIM .. "init.lua","r")
|
||||||
if testfile ~= nil then
|
if testfile ~= nil then
|
||||||
testfile:close()
|
testfile:close()
|
||||||
return {
|
return {
|
||||||
type="mod",
|
type="mod",
|
||||||
path=temppath
|
path=temppath
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
testfile = io.open(temppath .. DIR_DELIM .. "modpack.txt","r")
|
testfile = io.open(temppath .. DIR_DELIM .. "modpack.txt","r")
|
||||||
if testfile ~= nil then
|
if testfile ~= nil then
|
||||||
testfile:close()
|
testfile:close()
|
||||||
return {
|
return {
|
||||||
type="modpack",
|
type="modpack",
|
||||||
path=temppath
|
path=temppath
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local subdirs = core.get_dirlist(temppath,true)
|
local subdirs = core.get_dirlist(temppath,true)
|
||||||
|
|
||||||
--only single mod or modpack allowed
|
--only single mod or modpack allowed
|
||||||
if #subdirs ~= 1 then
|
if #subdirs ~= 1 then
|
||||||
return {
|
return {
|
||||||
type = "invalid",
|
type = "invalid",
|
||||||
path = ""
|
path = ""
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
testfile =
|
testfile =
|
||||||
io.open(temppath .. DIR_DELIM .. subdirs[1] ..DIR_DELIM .."init.lua","r")
|
io.open(temppath .. DIR_DELIM .. subdirs[1] ..DIR_DELIM .."init.lua","r")
|
||||||
if testfile ~= nil then
|
if testfile ~= nil then
|
||||||
testfile:close()
|
testfile:close()
|
||||||
return {
|
return {
|
||||||
type="mod",
|
type="mod",
|
||||||
path= temppath .. DIR_DELIM .. subdirs[1]
|
path= temppath .. DIR_DELIM .. subdirs[1]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
testfile =
|
testfile =
|
||||||
io.open(temppath .. DIR_DELIM .. subdirs[1] ..DIR_DELIM .."modpack.txt","r")
|
io.open(temppath .. DIR_DELIM .. subdirs[1] ..DIR_DELIM .."modpack.txt","r")
|
||||||
if testfile ~= nil then
|
if testfile ~= nil then
|
||||||
testfile:close()
|
testfile:close()
|
||||||
return {
|
return {
|
||||||
type="modpack",
|
type="modpack",
|
||||||
path=temppath .. DIR_DELIM .. subdirs[1]
|
path=temppath .. DIR_DELIM .. subdirs[1]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type = "invalid",
|
type = "invalid",
|
||||||
path = ""
|
path = ""
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.isValidModname(modpath)
|
function modmgr.isValidModname(modpath)
|
||||||
if modpath:find("-") ~= nil then
|
if modpath:find("-") ~= nil then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.parse_register_line(line)
|
function modmgr.parse_register_line(line)
|
||||||
local pos1 = line:find("\"")
|
local pos1 = line:find("\"")
|
||||||
local pos2 = nil
|
local pos2 = nil
|
||||||
if pos1 ~= nil then
|
if pos1 ~= nil then
|
||||||
pos2 = line:find("\"",pos1+1)
|
pos2 = line:find("\"",pos1+1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if pos1 ~= nil and pos2 ~= nil then
|
if pos1 ~= nil and pos2 ~= nil then
|
||||||
local item = line:sub(pos1+1,pos2-1)
|
local item = line:sub(pos1+1,pos2-1)
|
||||||
|
|
||||||
if item ~= nil and
|
if item ~= nil and
|
||||||
item ~= "" then
|
item ~= "" then
|
||||||
local pos3 = item:find(":")
|
local pos3 = item:find(":")
|
||||||
|
|
||||||
if pos3 ~= nil then
|
if pos3 ~= nil then
|
||||||
local retval = item:sub(1,pos3-1)
|
local retval = item:sub(1,pos3-1)
|
||||||
if retval ~= nil and
|
if retval ~= nil and
|
||||||
retval ~= "" then
|
retval ~= "" then
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.parse_dofile_line(modpath,line)
|
function modmgr.parse_dofile_line(modpath,line)
|
||||||
local pos1 = line:find("\"")
|
local pos1 = line:find("\"")
|
||||||
local pos2 = nil
|
local pos2 = nil
|
||||||
if pos1 ~= nil then
|
if pos1 ~= nil then
|
||||||
pos2 = line:find("\"",pos1+1)
|
pos2 = line:find("\"",pos1+1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if pos1 ~= nil and pos2 ~= nil then
|
if pos1 ~= nil and pos2 ~= nil then
|
||||||
local filename = line:sub(pos1+1,pos2-1)
|
local filename = line:sub(pos1+1,pos2-1)
|
||||||
|
|
||||||
if filename ~= nil and
|
if filename ~= nil and
|
||||||
filename ~= "" and
|
filename ~= "" and
|
||||||
filename:find(".lua") then
|
filename:find(".lua") then
|
||||||
return modmgr.identify_modname(modpath,filename)
|
return modmgr.identify_modname(modpath,filename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.identify_modname(modpath,filename)
|
function modmgr.identify_modname(modpath,filename)
|
||||||
local testfile = io.open(modpath .. DIR_DELIM .. filename,"r")
|
local testfile = io.open(modpath .. DIR_DELIM .. filename,"r")
|
||||||
if testfile ~= nil then
|
if testfile ~= nil then
|
||||||
local line = testfile:read()
|
local line = testfile:read()
|
||||||
|
|
||||||
while line~= nil do
|
while line~= nil do
|
||||||
local modname = nil
|
local modname = nil
|
||||||
|
|
||||||
if line:find("minetest.register_tool") then
|
if line:find("core.register_tool") then
|
||||||
modname = modmgr.parse_register_line(line)
|
modname = modmgr.parse_register_line(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
if line:find("minetest.register_craftitem") then
|
if line:find("core.register_craftitem") then
|
||||||
modname = modmgr.parse_register_line(line)
|
modname = modmgr.parse_register_line(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if line:find("minetest.register_node") then
|
if line:find("core.register_node") then
|
||||||
modname = modmgr.parse_register_line(line)
|
modname = modmgr.parse_register_line(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
if line:find("dofile") then
|
if line:find("dofile") then
|
||||||
modname = modmgr.parse_dofile_line(modpath,line)
|
modname = modmgr.parse_dofile_line(modpath,line)
|
||||||
end
|
end
|
||||||
|
|
||||||
if modname ~= nil then
|
if modname ~= nil then
|
||||||
testfile:close()
|
testfile:close()
|
||||||
return modname
|
return modname
|
||||||
end
|
end
|
||||||
|
|
||||||
line = testfile:read()
|
line = testfile:read()
|
||||||
end
|
end
|
||||||
testfile:close()
|
testfile:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.render_modlist(render_list)
|
function modmgr.render_modlist(render_list)
|
||||||
local retval = ""
|
local retval = ""
|
||||||
|
|
||||||
if render_list == nil then
|
if render_list == nil then
|
||||||
if modmgr.global_mods == nil then
|
if modmgr.global_mods == nil then
|
||||||
modmgr.refresh_globals()
|
modmgr.refresh_globals()
|
||||||
end
|
end
|
||||||
render_list = modmgr.global_mods
|
render_list = modmgr.global_mods
|
||||||
end
|
end
|
||||||
|
|
||||||
local list = render_list:get_list()
|
local list = render_list:get_list()
|
||||||
local last_modpack = nil
|
local last_modpack = nil
|
||||||
|
|
||||||
for i,v in ipairs(list) do
|
for i,v in ipairs(list) do
|
||||||
if retval ~= "" then
|
if retval ~= "" then
|
||||||
retval = retval ..","
|
retval = retval ..","
|
||||||
end
|
end
|
||||||
|
|
||||||
local color = ""
|
local color = ""
|
||||||
|
|
||||||
if v.is_modpack then
|
if v.is_modpack then
|
||||||
local rawlist = render_list:get_raw_list()
|
local rawlist = render_list:get_raw_list()
|
||||||
|
|
||||||
local all_enabled = true
|
local all_enabled = true
|
||||||
for j=1,#rawlist,1 do
|
for j=1,#rawlist,1 do
|
||||||
if rawlist[j].modpack == list[i].name and
|
if rawlist[j].modpack == list[i].name and
|
||||||
rawlist[j].enabled ~= true then
|
rawlist[j].enabled ~= true then
|
||||||
all_enabled = false
|
all_enabled = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if all_enabled == false then
|
if all_enabled == false then
|
||||||
color = mt_color_grey
|
color = mt_color_grey
|
||||||
else
|
else
|
||||||
color = mt_color_dark_green
|
color = mt_color_dark_green
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if v.typ == "game_mod" then
|
if v.typ == "game_mod" then
|
||||||
color = mt_color_blue
|
color = mt_color_blue
|
||||||
else
|
else
|
||||||
if v.enabled then
|
if v.enabled then
|
||||||
color = mt_color_green
|
color = mt_color_green
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
retval = retval .. color
|
retval = retval .. color
|
||||||
if v.modpack ~= nil then
|
if v.modpack ~= nil then
|
||||||
retval = retval .. " "
|
retval = retval .. " "
|
||||||
end
|
end
|
||||||
retval = retval .. v.name
|
retval = retval .. v.name
|
||||||
end
|
end
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.get_dependencies(modfolder)
|
function modmgr.get_dependencies(modfolder)
|
||||||
local toadd = ""
|
local toadd = ""
|
||||||
if modfolder ~= nil then
|
if modfolder ~= nil then
|
||||||
local filename = modfolder ..
|
local filename = modfolder ..
|
||||||
DIR_DELIM .. "depends.txt"
|
DIR_DELIM .. "depends.txt"
|
||||||
|
|
||||||
local dependencyfile = io.open(filename,"r")
|
local dependencyfile = io.open(filename,"r")
|
||||||
|
|
||||||
if dependencyfile then
|
if dependencyfile then
|
||||||
local dependency = dependencyfile:read("*l")
|
local dependency = dependencyfile:read("*l")
|
||||||
while dependency do
|
while dependency do
|
||||||
if toadd ~= "" then
|
if toadd ~= "" then
|
||||||
toadd = toadd .. ","
|
toadd = toadd .. ","
|
||||||
end
|
end
|
||||||
toadd = toadd .. dependency
|
toadd = toadd .. dependency
|
||||||
dependency = dependencyfile:read()
|
dependency = dependencyfile:read()
|
||||||
end
|
end
|
||||||
dependencyfile:close()
|
dependencyfile:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return toadd
|
return toadd
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.get_worldconfig(worldpath)
|
function modmgr.get_worldconfig(worldpath)
|
||||||
local filename = worldpath ..
|
local filename = worldpath ..
|
||||||
DIR_DELIM .. "world.mt"
|
DIR_DELIM .. "world.mt"
|
||||||
|
|
||||||
local worldfile = Settings(filename)
|
local worldfile = Settings(filename)
|
||||||
|
|
||||||
local worldconfig = {}
|
local worldconfig = {}
|
||||||
worldconfig.global_mods = {}
|
worldconfig.global_mods = {}
|
||||||
worldconfig.game_mods = {}
|
worldconfig.game_mods = {}
|
||||||
|
|
||||||
for key,value in pairs(worldfile:to_table()) do
|
for key,value in pairs(worldfile:to_table()) do
|
||||||
if key == "gameid" then
|
if key == "gameid" then
|
||||||
worldconfig.id = value
|
worldconfig.id = value
|
||||||
else
|
else
|
||||||
worldconfig.global_mods[key] = core.is_yes(value)
|
worldconfig.global_mods[key] = core.is_yes(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--read gamemods
|
--read gamemods
|
||||||
local gamespec = gamemgr.find_by_gameid(worldconfig.id)
|
local gamespec = gamemgr.find_by_gameid(worldconfig.id)
|
||||||
gamemgr.get_game_mods(gamespec, worldconfig.game_mods)
|
gamemgr.get_game_mods(gamespec, worldconfig.game_mods)
|
||||||
|
|
||||||
return worldconfig
|
return worldconfig
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.installmod(modfilename,basename)
|
function modmgr.installmod(modfilename,basename)
|
||||||
local modfile = modmgr.identify_filetype(modfilename)
|
local modfile = modmgr.identify_filetype(modfilename)
|
||||||
local modpath = modmgr.extract(modfile)
|
local modpath = modmgr.extract(modfile)
|
||||||
|
|
||||||
if modpath == nil then
|
if modpath == nil then
|
||||||
gamedata.errormessage = fgettext("Install Mod: file: \"$1\"", modfile.name) ..
|
gamedata.errormessage = fgettext("Install Mod: file: \"$1\"", modfile.name) ..
|
||||||
fgettext("\nInstall Mod: unsupported filetype \"$1\" or broken archive", modfile.type)
|
fgettext("\nInstall Mod: unsupported filetype \"$1\" or broken archive", modfile.type)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local basefolder = modmgr.getbasefolder(modpath)
|
local basefolder = modmgr.getbasefolder(modpath)
|
||||||
|
|
||||||
if basefolder.type == "modpack" then
|
if basefolder.type == "modpack" then
|
||||||
local clean_path = nil
|
local clean_path = nil
|
||||||
|
|
||||||
if basename ~= nil then
|
if basename ~= nil then
|
||||||
clean_path = "mp_" .. basename
|
clean_path = "mp_" .. basename
|
||||||
end
|
end
|
||||||
|
|
||||||
if clean_path == nil then
|
if clean_path == nil then
|
||||||
clean_path = get_last_folder(cleanup_path(basefolder.path))
|
clean_path = get_last_folder(cleanup_path(basefolder.path))
|
||||||
end
|
end
|
||||||
|
|
||||||
if clean_path ~= nil then
|
if clean_path ~= nil then
|
||||||
local targetpath = core.get_modpath() .. DIR_DELIM .. clean_path
|
local targetpath = core.get_modpath() .. DIR_DELIM .. clean_path
|
||||||
if not core.copy_dir(basefolder.path,targetpath) then
|
if not core.copy_dir(basefolder.path,targetpath) then
|
||||||
gamedata.errormessage = fgettext("Failed to install $1 to $2", basename, targetpath)
|
gamedata.errormessage = fgettext("Failed to install $1 to $2", basename, targetpath)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
gamedata.errormessage = fgettext("Install Mod: unable to find suitable foldername for modpack $1", modfilename)
|
gamedata.errormessage = fgettext("Install Mod: unable to find suitable foldername for modpack $1", modfilename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if basefolder.type == "mod" then
|
if basefolder.type == "mod" then
|
||||||
local targetfolder = basename
|
local targetfolder = basename
|
||||||
|
|
||||||
if targetfolder == nil then
|
if targetfolder == nil then
|
||||||
targetfolder = modmgr.identify_modname(basefolder.path,"init.lua")
|
targetfolder = modmgr.identify_modname(basefolder.path,"init.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
--if heuristic failed try to use current foldername
|
--if heuristic failed try to use current foldername
|
||||||
if targetfolder == nil then
|
if targetfolder == nil then
|
||||||
targetfolder = get_last_folder(basefolder.path)
|
targetfolder = get_last_folder(basefolder.path)
|
||||||
end
|
end
|
||||||
|
|
||||||
if targetfolder ~= nil and modmgr.isValidModname(targetfolder) then
|
if targetfolder ~= nil and modmgr.isValidModname(targetfolder) then
|
||||||
local targetpath = core.get_modpath() .. DIR_DELIM .. targetfolder
|
local targetpath = core.get_modpath() .. DIR_DELIM .. targetfolder
|
||||||
core.copy_dir(basefolder.path,targetpath)
|
core.copy_dir(basefolder.path,targetpath)
|
||||||
else
|
else
|
||||||
gamedata.errormessage = fgettext("Install Mod: unable to find real modname for: $1", modfilename)
|
gamedata.errormessage = fgettext("Install Mod: unable to find real modname for: $1", modfilename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
core.delete_dir(modpath)
|
core.delete_dir(modpath)
|
||||||
|
|
||||||
modmgr.refresh_globals()
|
modmgr.refresh_globals()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.preparemodlist(data)
|
function modmgr.preparemodlist(data)
|
||||||
local retval = {}
|
local retval = {}
|
||||||
|
|
||||||
local global_mods = {}
|
local global_mods = {}
|
||||||
local game_mods = {}
|
local game_mods = {}
|
||||||
|
|
||||||
--read global mods
|
--read global mods
|
||||||
local modpath = core.get_modpath()
|
local modpath = core.get_modpath()
|
||||||
|
|
||||||
if modpath ~= nil and
|
if modpath ~= nil and
|
||||||
modpath ~= "" then
|
modpath ~= "" then
|
||||||
get_mods(modpath,global_mods)
|
get_mods(modpath,global_mods)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#global_mods,1 do
|
for i=1,#global_mods,1 do
|
||||||
global_mods[i].typ = "global_mod"
|
global_mods[i].typ = "global_mod"
|
||||||
table.insert(retval,global_mods[i])
|
table.insert(retval,global_mods[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
--read game mods
|
--read game mods
|
||||||
local gamespec = gamemgr.find_by_gameid(data.gameid)
|
local gamespec = gamemgr.find_by_gameid(data.gameid)
|
||||||
gamemgr.get_game_mods(gamespec, game_mods)
|
gamemgr.get_game_mods(gamespec, game_mods)
|
||||||
|
|
||||||
for i=1,#game_mods,1 do
|
for i=1,#game_mods,1 do
|
||||||
game_mods[i].typ = "game_mod"
|
game_mods[i].typ = "game_mod"
|
||||||
table.insert(retval,game_mods[i])
|
table.insert(retval,game_mods[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.worldpath == nil then
|
if data.worldpath == nil then
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
--read world mod configuration
|
--read world mod configuration
|
||||||
local filename = data.worldpath ..
|
local filename = data.worldpath ..
|
||||||
DIR_DELIM .. "world.mt"
|
DIR_DELIM .. "world.mt"
|
||||||
|
|
||||||
local worldfile = Settings(filename)
|
local worldfile = Settings(filename)
|
||||||
|
|
||||||
for key,value in pairs(worldfile:to_table()) do
|
for key,value in pairs(worldfile:to_table()) do
|
||||||
if key:sub(1, 9) == "load_mod_" then
|
if key:sub(1, 9) == "load_mod_" then
|
||||||
key = key:sub(10)
|
key = key:sub(10)
|
||||||
local element = nil
|
local element = nil
|
||||||
for i=1,#retval,1 do
|
for i=1,#retval,1 do
|
||||||
if retval[i].name == key and
|
if retval[i].name == key and
|
||||||
not retval[i].is_modpack then
|
not retval[i].is_modpack then
|
||||||
element = retval[i]
|
element = retval[i]
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if element ~= nil then
|
if element ~= nil then
|
||||||
element.enabled = core.is_yes(value)
|
element.enabled = core.is_yes(value)
|
||||||
else
|
else
|
||||||
core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
|
core.log("info", "Mod: " .. key .. " " .. dump(value) .. " but not found")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.comparemod(elem1,elem2)
|
function modmgr.comparemod(elem1,elem2)
|
||||||
if elem1 == nil or elem2 == nil then
|
if elem1 == nil or elem2 == nil then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if elem1.name ~= elem2.name then
|
if elem1.name ~= elem2.name then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if elem1.is_modpack ~= elem2.is_modpack then
|
if elem1.is_modpack ~= elem2.is_modpack then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if elem1.typ ~= elem2.typ then
|
if elem1.typ ~= elem2.typ then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if elem1.modpack ~= elem2.modpack then
|
if elem1.modpack ~= elem2.modpack then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if elem1.path ~= elem2.path then
|
if elem1.path ~= elem2.path then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.mod_exists(basename)
|
function modmgr.mod_exists(basename)
|
||||||
|
|
||||||
if modmgr.global_mods == nil then
|
if modmgr.global_mods == nil then
|
||||||
modmgr.refresh_globals()
|
modmgr.refresh_globals()
|
||||||
end
|
end
|
||||||
|
|
||||||
if modmgr.global_mods:raw_index_by_uid(basename) > 0 then
|
if modmgr.global_mods:raw_index_by_uid(basename) > 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.get_global_mod(idx)
|
function modmgr.get_global_mod(idx)
|
||||||
|
|
||||||
if modmgr.global_mods == nil then
|
if modmgr.global_mods == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if idx == nil or idx < 1 or
|
if idx == nil or idx < 1 or
|
||||||
idx > modmgr.global_mods:size() then
|
idx > modmgr.global_mods:size() then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return modmgr.global_mods:get_list()[idx]
|
return modmgr.global_mods:get_list()[idx]
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.refresh_globals()
|
function modmgr.refresh_globals()
|
||||||
modmgr.global_mods = filterlist.create(
|
modmgr.global_mods = filterlist.create(
|
||||||
modmgr.preparemodlist, --refresh
|
modmgr.preparemodlist, --refresh
|
||||||
modmgr.comparemod, --compare
|
modmgr.comparemod, --compare
|
||||||
function(element,uid) --uid match
|
function(element,uid) --uid match
|
||||||
if element.name == uid then
|
if element.name == uid then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
nil, --filter
|
nil, --filter
|
||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
modmgr.global_mods:add_sort_mechanism("alphabetic", sort_mod_list)
|
modmgr.global_mods:add_sort_mechanism("alphabetic", sort_mod_list)
|
||||||
modmgr.global_mods:set_sortmode("alphabetic")
|
modmgr.global_mods:set_sortmode("alphabetic")
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function modmgr.identify_filetype(name)
|
function modmgr.identify_filetype(name)
|
||||||
|
|
||||||
if name:sub(-3):lower() == "zip" then
|
if name:sub(-3):lower() == "zip" then
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
type = "zip"
|
type = "zip"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if name:sub(-6):lower() == "tar.gz" or
|
if name:sub(-6):lower() == "tar.gz" or
|
||||||
name:sub(-3):lower() == "tgz"then
|
name:sub(-3):lower() == "tgz"then
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
type = "tgz"
|
type = "tgz"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if name:sub(-6):lower() == "tar.bz2" then
|
if name:sub(-6):lower() == "tar.bz2" then
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
type = "tbz"
|
type = "tbz"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if name:sub(-2):lower() == "7z" then
|
if name:sub(-2):lower() == "7z" then
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
type = "7z"
|
type = "7z"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
type = "ukn"
|
type = "ukn"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -164,7 +164,7 @@ function modstore.successfulldialog()
|
||||||
retval = retval .. "label[3,0.75;" .. core.formspec_escape(modstore.lastmodentry.moddetails.basename) .. "]"
|
retval = retval .. "label[3,0.75;" .. core.formspec_escape(modstore.lastmodentry.moddetails.basename) .. "]"
|
||||||
|
|
||||||
end
|
end
|
||||||
retval = retval .. "image_button[2.5,1.5;1,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_confirm_mod_successfull;" .. fgettext("ok") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. "image_button[2.5,1.5;1,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_confirm_mod_successfull;" .. fgettext("ok") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
end,
|
end,
|
||||||
function(this,fields)
|
function(this,fields)
|
||||||
if fields["btn_confirm_mod_successfull"] ~= nil then
|
if fields["btn_confirm_mod_successfull"] ~= nil then
|
||||||
|
@ -495,12 +495,12 @@ function modstore.getshortmodinfo(ypos,listentry,details)
|
||||||
if details.basename then
|
if details.basename then
|
||||||
--install button
|
--install button
|
||||||
local buttony = ypos + 1.2
|
local buttony = ypos + 1.2
|
||||||
retval = retval .."image_button[9.1," .. buttony .. ";2.5,0.5;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_install_mod_" .. details.id .. ";"
|
retval = retval .."image_button[9.1," .. buttony .. ";2.5,0.5;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_install_mod_" .. details.id .. ";"
|
||||||
|
|
||||||
if modmgr.mod_exists(details.basename) then
|
if modmgr.mod_exists(details.basename) then
|
||||||
retval = retval .. fgettext("re-Install") ..";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. fgettext("re-Install") ..";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
else
|
else
|
||||||
retval = retval .. fgettext("Install") ..";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
retval = retval .. fgettext("Install") ..";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ function modstore.getmodlist(list,yoffset)
|
||||||
local sb_y_start = 0.2 + yoffset
|
local sb_y_start = 0.2 + yoffset
|
||||||
local sb_y_end = (modstore.modsperpage * 1.75) + ((modstore.modsperpage-1) * 0.15)
|
local sb_y_end = (modstore.modsperpage * 1.75) + ((modstore.modsperpage-1) * 0.15)
|
||||||
local close_button = "image_button[4," .. (sb_y_end + 0.3 + yoffset) ..
|
local close_button = "image_button[4," .. (sb_y_end + 0.3 + yoffset) ..
|
||||||
";4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_close;" .. fgettext("Close store") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
";4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_close;" .. fgettext("Close store") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
if #list.data == 0 then
|
if #list.data == 0 then
|
||||||
return close_button
|
return close_button
|
||||||
|
@ -533,9 +533,9 @@ function modstore.getmodlist(list,yoffset)
|
||||||
((sb_y_end -1.6)/(list.pagecount-1)) * list.page
|
((sb_y_end -1.6)/(list.pagecount-1)) * list.page
|
||||||
scrollbar = scrollbar .. "box[11.6," ..scrollbarpos .. ";0.28,0.5;#32CD32]"
|
scrollbar = scrollbar .. "box[11.6," ..scrollbarpos .. ";0.28,0.5;#32CD32]"
|
||||||
scrollbar = scrollbar .. "image_button[11.6," .. (sb_y_start)
|
scrollbar = scrollbar .. "image_button[11.6," .. (sb_y_start)
|
||||||
.. ";0.5,0.5;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_page_up;^;true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
.. ";0.5,0.5;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_page_up;^;true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
scrollbar = scrollbar .. "image_button[11.6," .. (sb_y_start + sb_y_end - 0.5)
|
scrollbar = scrollbar .. "image_button[11.6," .. (sb_y_start + sb_y_end - 0.5)
|
||||||
.. ";0.5,0.5;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_page_down;v;true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
.. ";0.5,0.5;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_page_down;v;true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
local retval = ""
|
local retval = ""
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ function modstore.getsearchpage(tabview, name, tabdata)
|
||||||
end
|
end
|
||||||
|
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"image_button[9.5,0.2;2.5,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_search;".. fgettext("Search") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[9.5,0.2;2.5,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore_search;".. fgettext("Search") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"field[0.5,0.5;9,0.5;te_modstore_search;;" .. search .. "]"
|
"field[0.5,0.5;9,0.5;te_modstore_search;;" .. search .. "]"
|
||||||
|
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
|
|
|
@ -27,7 +27,7 @@ tab_credits = {
|
||||||
"box[-100,8.5;200,10;#999999]" ..
|
"box[-100,8.5;200,10;#999999]" ..
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
|
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"label[3.5,9.75;Magichet 1.0 (based on FM " .. core.get_version() .. ")]" ..
|
"label[3.5,9.75;Magichet 1.0 (based on FM " .. core.get_version() .. ")]" ..
|
||||||
"image[0.25,9;2,2;"..core.formspec_escape(logofile).."]"..
|
"image[0.25,9;2,2;"..core.formspec_escape(logofile).."]"..
|
||||||
"textlist[0,2.0;15.8,6.25;list_credits;" ..
|
"textlist[0,2.0;15.8,6.25;list_credits;" ..
|
||||||
|
|
|
@ -1,59 +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.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
tab_help = {
|
|
||||||
name = "help",
|
|
||||||
caption = fgettext("Help"),
|
|
||||||
cbf_formspec = function (tabview, name, tabdata)
|
|
||||||
local logofile = defaulttexturedir .. "logo.png"
|
|
||||||
return "size[16,11]"..
|
|
||||||
"bgcolor[#00000070;true]"..
|
|
||||||
"box[-100,8.5;200,10;#999999]" ..
|
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
|
||||||
|
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
|
||||||
"label[3.5,9.75;Magichet 1.0 (based on FM " .. core.get_version() .. ")]" ..
|
|
||||||
"image[0.25,9;2,2;"..core.formspec_escape(logofile).."]"..
|
|
||||||
|
|
||||||
"textlist[0,2;15.8,6.25;list_help;" ..
|
|
||||||
"#FFFF00How to begin to play (ENG)," ..
|
|
||||||
" - Press and hold to dig a block,"..
|
|
||||||
" - Doubletap to place a block,"..
|
|
||||||
" - To split a stack 'long pess' on it and,"..
|
|
||||||
" w/o releasing it tap a separate inventory cell,"..
|
|
||||||
","..
|
|
||||||
","..
|
|
||||||
"#FFFF00Как начать играть (RUS)," ..
|
|
||||||
" - Долгое нажатие = сломать блок,"..
|
|
||||||
" - Двойное нажатие = поставить блок,"..
|
|
||||||
" - Для разделения стака на части,"..
|
|
||||||
" нажмите на стак и удерживая его,"..
|
|
||||||
" нажмите вторым пальцем на свободной,"..
|
|
||||||
" ячейке интвентаря"..
|
|
||||||
";0;true]"
|
|
||||||
end,
|
|
||||||
cbf_button_handler = function(tabview, fields, name, tabdata)
|
|
||||||
if fields["btn_cancel"] ~= nil then
|
|
||||||
tabview:hide()
|
|
||||||
tabview.parent:show()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
}
|
|
|
@ -36,7 +36,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
-- "label[0.8,4.2;" .. fgettext("Add mod:") .. "]" ..
|
-- "label[0.8,4.2;" .. fgettext("Add mod:") .. "]" ..
|
||||||
-- TODO Disabled due to upcoming release 0.4.8 and irrlicht messing up localization
|
-- TODO Disabled due to upcoming release 0.4.8 and irrlicht messing up localization
|
||||||
-- "button[0.75,4.85;1.8,0.5;btn_mod_mgr_install_local;".. fgettext("Local install") .. "]" ..
|
-- "button[0.75,4.85;1.8,0.5;btn_mod_mgr_install_local;".. fgettext("Local install") .. "]" ..
|
||||||
"image_button[0,4.85;5.25,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore;".. fgettext("Online mod repository") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[0,4.85;5.25,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_modstore;".. fgettext("Online mod repository") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
local selected_mod = nil
|
local selected_mod = nil
|
||||||
|
|
||||||
|
@ -89,10 +89,10 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
|
|
||||||
if selected_mod.is_modpack then
|
if selected_mod.is_modpack then
|
||||||
retval = retval .. ";0]" ..
|
retval = retval .. ";0]" ..
|
||||||
"image_button[10,4.85;2,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mod_mgr_rename_modpack;" ..
|
"image_button[10,4.85;2,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mod_mgr_rename_modpack;" ..
|
||||||
fgettext("Rename") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
fgettext("Rename") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
retval = retval .. "image_button[5.5,4.85;4.5,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mod_mgr_delete_mod;"
|
retval = retval .. "image_button[5.5,4.85;4.5,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mod_mgr_delete_mod;"
|
||||||
.. fgettext("Uninstall selected modpack") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
.. fgettext("Uninstall selected modpack") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
else
|
else
|
||||||
--show dependencies
|
--show dependencies
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
|
|
||||||
retval = retval .. toadd .. ";0]"
|
retval = retval .. toadd .. ";0]"
|
||||||
|
|
||||||
retval = retval .. "image_button[5.5,4.85;4.5,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mod_mgr_delete_mod;"
|
retval = retval .. "image_button[5.5,4.85;4.5,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mod_mgr_delete_mod;"
|
||||||
.. fgettext("Uninstall selected mod") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
.. fgettext("Uninstall selected mod") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return retval
|
return retval
|
||||||
|
|
|
@ -23,7 +23,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
"bgcolor[#00000070;true]"..
|
"bgcolor[#00000070;true]"..
|
||||||
|
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;cancel;".. fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;cancel;".. fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
--"label[0,1.25;" .. fgettext("Address/Port") .. "]" ..
|
--"label[0,1.25;" .. fgettext("Address/Port") .. "]" ..
|
||||||
"field[1000.25,5.25;5.5,0.5;te_address;;" ..
|
"field[1000.25,5.25;5.5,0.5;te_address;;" ..
|
||||||
core.formspec_escape(core.setting_get("address")) .. "]" ..
|
core.formspec_escape(core.setting_get("address")) .. "]" ..
|
||||||
|
@ -40,15 +40,15 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
--if not core.setting_getbool("public_serverlist") then
|
--if not core.setting_getbool("public_serverlist") then
|
||||||
if (core.get_table_index("favourites") or 10000) <= #core.get_favorites("local") then
|
if (core.get_table_index("favourites") or 10000) <= #core.get_favorites("local") then
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"image_button[4,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_delete_favorite;" .. fgettext("Delete") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[4,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_delete_favorite;" .. fgettext("Delete") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
else
|
else
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"image_button[4,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;add_server;" .. fgettext("Add") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[4,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;add_server;" .. fgettext("Add") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
end
|
end
|
||||||
|
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"image_button[8,9.55;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mp_connect;" .. fgettext("Connect") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[8,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_mp_connect;" .. fgettext("Connect") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[3.2,9.55;0.8,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."server_flags_favourite.png;btn_mp_favour;;true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[3.2,9.55;0.8,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."server_flags_favourite.png;btn_mp_favour;;true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
|
|
||||||
"label[8,8;" .. fgettext("Name") .. ":]" ..
|
"label[8,8;" .. fgettext("Name") .. ":]" ..
|
||||||
"field[8.3,9;3.95,0.8;te_name;;" ..
|
"field[8.3,9;3.95,0.8;te_name;;" ..
|
||||||
|
@ -231,7 +231,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||||
--gamedata.errormessage = err..' ('..errcode..')'
|
--gamedata.errormessage = err..' ('..errcode..')'
|
||||||
end
|
end
|
||||||
if favourites then
|
if favourites then
|
||||||
favourites = minetest.parse_json(favourites)
|
favourites = core.parse_json(favourites)
|
||||||
else
|
else
|
||||||
favourites = {["list"]={},}
|
favourites = {["list"]={},}
|
||||||
end
|
end
|
||||||
|
@ -245,7 +245,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
favourites = minetest.write_json(favourites)
|
favourites = core.write_json(favourites)
|
||||||
|
|
||||||
local output,err,errcode = io.open(path, "w")
|
local output,err,errcode = io.open(path, "w")
|
||||||
if output then
|
if output then
|
||||||
|
|
|
@ -27,27 +27,31 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
"box[-100,8.5;200,10;#999999]" ..
|
"box[-100,8.5;200,10;#999999]" ..
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
"bgcolor[#00000070;true]"..
|
"bgcolor[#00000070;true]"..
|
||||||
"image_button[4,8.7;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;start_server;".. fgettext("Play") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[4,8.7;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;start_server;".. fgettext("Play") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[7.8,8.7;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create;".. fgettext("New") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[7.8,8.7;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create;".. fgettext("New") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
|
|
||||||
"image_button[4,9.55;2.68,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete;".. fgettext("Delete") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[4,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete;".. fgettext("Delete") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[6.53,9.55;2.68,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_configure;".. fgettext("Configure") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
--"image_button[6.53,9.55;2.68,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_configure;".. fgettext("Configure") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[9.07,9.55;2.68,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;cancel;".. fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[7.8,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;cancel;".. fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"label[7,1.5;" .. fgettext("Select World:") .. "]" ..
|
"label[7,1.5;" .. fgettext("Select World:") .. "]" ..
|
||||||
|
|
||||||
"checkbox[12,8.70;cb_creative_mode;" .. fgettext("Creative Mode") .. ";" .. dump(core.setting_getbool("creative_mode")) .. "]" ..
|
"checkbox[12,8.70;cb_creative_mode;" .. fgettext("Creative Mode") .. ";" .. dump(core.setting_getbool("creative_mode")) .. "]" ..
|
||||||
--"checkbox[1000,9.20;cb_enable_damage;" .. fgettext("Enable Damage") .. ";" .. dump(core.setting_getbool("enable_damage")) .. "]" ..
|
--"checkbox[1000,9.20;cb_enable_damage;" .. fgettext("Enable Damage") .. ";" .. dump(core.setting_getbool("enable_damage")) .. "]" ..
|
||||||
"checkbox[12,9.50;cb_server_announce;" .. fgettext("Public") .. ";" .. dump(core.setting_getbool("server_announce")) .. "]" ..
|
"checkbox[12,9.50;cb_server_announce;" .. fgettext("Public") .. ";" .. dump(core.setting_getbool("server_announce")) .. "]" ..
|
||||||
"label[0.2,8.55;" .. fgettext("Name/Password") .. "]" ..
|
|
||||||
"field[0.5,9.45;3.5,0.5;te_playername;;"
|
"checkbox[0.2,8.35;btn_single;Local Server;true]"..
|
||||||
|
|
||||||
|
"label[-0.25,9.15;Name]" ..
|
||||||
|
"field[1,9.45;3,0.5;te_playername;;"
|
||||||
|
|
||||||
local nm = core.formspec_escape(core.setting_get("name"))
|
local nm = core.formspec_escape(core.setting_get("name"))
|
||||||
if nm=='' then
|
if nm=='' then
|
||||||
nm='Wanderer'
|
nm='Player'
|
||||||
end
|
end
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
nm .. "]" ..
|
nm .. "]" ..
|
||||||
"pwdfield[0.5,10.15;3.5,0.5;te_passwd;]"
|
"label[-0.25,9.8;Pass]" ..
|
||||||
|
"pwdfield[1,10.15;3,0.5;te_passwd;]"
|
||||||
|
|
||||||
local bind_addr = core.setting_get("bind_address")
|
local bind_addr = core.setting_get("bind_address")
|
||||||
|
|
||||||
|
@ -76,6 +80,14 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||||
|
|
||||||
local world_doubleclick = false
|
local world_doubleclick = false
|
||||||
|
|
||||||
|
if fields["btn_single"]~=nil then
|
||||||
|
local single = create_tab_single(true)
|
||||||
|
single:set_parent(this.parent)
|
||||||
|
single:show()
|
||||||
|
this:hide()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
if fields["srv_worlds"] ~= nil then
|
if fields["srv_worlds"] ~= nil then
|
||||||
local event = core.explode_textlist_event(fields["srv_worlds"])
|
local event = core.explode_textlist_event(fields["srv_worlds"])
|
||||||
|
|
||||||
|
@ -102,7 +114,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||||
bool = 'true'
|
bool = 'true'
|
||||||
end
|
end
|
||||||
core.setting_set("enable_damage", bool)
|
core.setting_set("enable_damage", bool)
|
||||||
print(bool)
|
-- print(bool)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -202,3 +214,12 @@ tab_server = {
|
||||||
cbf_button_handler = main_button_handler,
|
cbf_button_handler = main_button_handler,
|
||||||
on_change = nil
|
on_change = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function create_tab_server()
|
||||||
|
local retval = dialog_create("server",
|
||||||
|
get_formspec,
|
||||||
|
main_button_handler,
|
||||||
|
nil)
|
||||||
|
return retval
|
||||||
|
end
|
|
@ -73,10 +73,10 @@ local function dlg_confirm_reset_formspec(data)
|
||||||
local retval =
|
local retval =
|
||||||
"size[8,3]" ..
|
"size[8,3]" ..
|
||||||
"label[1,1;".. fgettext("Are you sure to reset your singleplayer world?") .. "]"..
|
"label[1,1;".. fgettext("Are you sure to reset your singleplayer world?") .. "]"..
|
||||||
"image_button[1,2;2.6,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_reset_singleplayer_confirm;"..
|
"image_button[1,2;2.6,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_reset_singleplayer_confirm;"..
|
||||||
fgettext("Yes") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
fgettext("Yes") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[4,2;2.8,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_reset_singleplayer_cancel;"..
|
"image_button[4,2;2.8,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;dlg_reset_singleplayer_cancel;"..
|
||||||
fgettext("No!!!") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
fgettext("No!!!") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ local function formspec(tabview, name, tabdata)
|
||||||
"dropdown[5.85,5.1;3.85;dd_video_driver;"
|
"dropdown[5.85,5.1;3.85;dd_video_driver;"
|
||||||
.. driver_formspec_string .. ";" .. driver_current_idx .. "]" ..
|
.. driver_formspec_string .. ";" .. driver_current_idx .. "]" ..
|
||||||
"tooltip[dd_video_driver;" ..
|
"tooltip[dd_video_driver;" ..
|
||||||
fgettext("Restart minetest for driver change to take effect") .. "]"
|
fgettext("Restart multicraft for driver change to take effect") .. "]"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,29 +223,29 @@ local function formspec(tabview, name, tabdata)
|
||||||
"box[9.75,2.5;5.25,4;#999999]"..
|
"box[9.75,2.5;5.25,4;#999999]"..
|
||||||
"checkbox[10,2.5;cb_shaders;".. fgettext("Shaders") .. ";"
|
"checkbox[10,2.5;cb_shaders;".. fgettext("Shaders") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_shaders")) .. "]"..
|
.. dump(core.setting_getbool("enable_shaders")) .. "]"..
|
||||||
"image_button[0,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_change_keys;".. fgettext("Change keys") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"--..
|
"image_button[0,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_change_keys;".. fgettext("Change keys") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"--..
|
||||||
-- "image_button[3.75,5;3.88,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
-- "image_button[3.75,5;3.88,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
else
|
else
|
||||||
--tab_string = tab_string ..
|
--tab_string = tab_string ..
|
||||||
-- "image_button[3.75,5;3.88,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
-- "image_button[3.75,5;3.88,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
end
|
end
|
||||||
|
|
||||||
tab_string = tab_string ..
|
tab_string = tab_string ..
|
||||||
"image_button[4,9.55;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_textures;".. fgettext("Texturepacks") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir)..
|
"image_button[4,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_textures;".. fgettext("Texturepacks") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir)..
|
||||||
"menu_button_b.png]"..
|
"menu_button_b.png]"..
|
||||||
"image_button[8,9.55;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_credits;".. fgettext("Credits") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[8,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_show_credits;".. fgettext("Credits") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"
|
||||||
|
|
||||||
|
|
||||||
if PLATFORM == "Android" then
|
if PLATFORM == "Android" then
|
||||||
tab_string = tab_string ..
|
tab_string = tab_string ..
|
||||||
"box[9.75,2.5;5.25,2.5;#999999]" ..
|
"box[9.75,2.5;5.25,2.5;#999999]" ..
|
||||||
"checkbox[10,2.75;cb_touchscreen_target;".. fgettext("Touch free target") .. ";" .. dump(core.setting_getbool("touchtarget")) .. "]"..
|
"checkbox[10,2.75;cb_touchscreen_target;".. fgettext("Touch free target") .. ";" .. dump(core.setting_getbool("touchtarget")) .. "]"..
|
||||||
|
""
|
||||||
"box[0.75,6.8;14.25,1.35;#999999]" ..
|
-- "box[0.75,6.8;14.25,1.35;#999999]" ..
|
||||||
"label[1.5,6.8;" .. fgettext("GUI scale factor") .. "]"..
|
-- "label[1.5,6.8;" .. fgettext("GUI scale factor") .. "]"..
|
||||||
"scrollbar[1.0,7.2;13.75,0.7;sb_gui_scaling;horizontal;" .. gui_scale_to_scrollbar() .. "]" ..
|
--"scrollbar[1.0,7.2;13.75,0.7;sb_gui_scaling;horizontal;" .. gui_scale_to_scrollbar() .. "]" ..
|
||||||
"tooltip[sb_gui_scaling;" .. fgettext("Scaling factor applied to menu elements: ") .. dump(core.setting_get("gui_scaling")) .. "]"
|
-- "tooltip[sb_gui_scaling;" .. fgettext("Scaling factor applied to menu elements: ") .. dump(core.setting_get("gui_scaling")) .. "]"
|
||||||
|
|
||||||
-- if core.setting_get("touchscreen_threshold") ~= nil then
|
-- if core.setting_get("touchscreen_threshold") ~= nil then
|
||||||
tab_string = tab_string ..
|
tab_string = tab_string ..
|
||||||
|
@ -253,12 +253,12 @@ local function formspec(tabview, name, tabdata)
|
||||||
"dropdown[10,4.0;5.18;dd_touchthreshold;0,10,20,30,40,50;" .. ((tonumber(core.setting_get("touchscreen_threshold") or 20)/10)+1) .. "]"
|
"dropdown[10,4.0;5.18;dd_touchthreshold;0,10,20,30,40,50;" .. ((tonumber(core.setting_get("touchscreen_threshold") or 20)/10)+1) .. "]"
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
else
|
--else
|
||||||
tab_string = tab_string ..
|
-- tab_string = tab_string ..
|
||||||
"box[0.75,6.8;14.25,1.35;#999999]" ..
|
-- "box[0.75,6.8;14.25,1.35;#999999]" ..
|
||||||
"label[1.5,6.8;" .. fgettext("GUI scale factor") .. "]"..
|
-- "label[1.5,6.8;" .. fgettext("GUI scale factor") .. "]"..
|
||||||
"scrollbar[1.0,7.5;13.75,0.4;sb_gui_scaling;horizontal;" .. gui_scale_to_scrollbar() .. "]" ..
|
-- "scrollbar[1.0,7.5;13.75,0.4;sb_gui_scaling;horizontal;" .. gui_scale_to_scrollbar() .. "]" ..
|
||||||
"tooltip[sb_gui_scaling;" .. fgettext("Scaling factor applied to menu elements: ") .. dump(core.setting_get("gui_scaling")) .. "]"
|
-- "tooltip[sb_gui_scaling;" .. fgettext("Scaling factor applied to menu elements: ") .. dump(core.setting_get("gui_scaling")) .. "]"
|
||||||
end
|
end
|
||||||
|
|
||||||
if PLATFORM ~= "Android" then
|
if PLATFORM ~= "Android" then
|
||||||
|
|
|
@ -1,69 +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.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
--favourites
|
|
||||||
local function image_column(tooltip, flagname)
|
|
||||||
return "image," ..
|
|
||||||
"tooltip=" .. core.formspec_escape(tooltip) .. "," ..
|
|
||||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
|
||||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_" .. flagname .. ".png")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_formspec(tabview, name, tabdata)
|
|
||||||
local retval = ""
|
|
||||||
retval = retval .. "bgcolor[#00000000;false]"
|
|
||||||
retval = retval .. "image_button[2.5,1.0;7,1;multicraftbutton.png;btn_show_singleplayer;".. fgettext("Singleplayer") .. ";true;true;multicraftbutton.png]"
|
|
||||||
retval = retval .. "image_button[2.5,2.4;7,1;multicraftbutton.png;btn_show_multiplayer;" .. fgettext("Multiplayer") .. ";true;true;multicraftbutton.png]"
|
|
||||||
retval = retval .. "image_button[2.5,3.8;7,1;multicraftbutton.png;btn_show_options;".. fgettext("Options") .. ";true;true;multicraftbutton.png]"
|
|
||||||
retval = retval .. "image_button[2.5,5.2;7,1;multicraftbutton.png;btn_exit;".. fgettext("Exit") .. ";true;true;multicraftbutton.png]"
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
local function main_button_handler(tabview, fields, name, tabdata)
|
|
||||||
local index = 0
|
|
||||||
if fields["btn_show_singleplayer"] then index = 1 end
|
|
||||||
if fields["btn_show_multiplayer"] then index = 2 end
|
|
||||||
if fields["btn_show_options"] then index = 3 end
|
|
||||||
if fields["btn_exit"] then core.close() end
|
|
||||||
|
|
||||||
--switch_to_tab(self, index)
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
local function on_activate(type,old_tab,new_tab)
|
|
||||||
if type == "LEAVE" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
core.set_topleft_text('Multicraft II')
|
|
||||||
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
|
|
||||||
}
|
|
|
@ -75,35 +75,66 @@ local function singleplayer_refresh_gamebar()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_formspec(tabview, name, tabdata)
|
local function get_formspec(tabview, name, tabdata)
|
||||||
local retval = ""
|
|
||||||
|
|
||||||
local index = filterlist.get_current_index(menudata.worldlist,
|
local index = menudata.worldlist:get_current_index(
|
||||||
tonumber(core.setting_get("mainmenu_last_selected_world"))
|
tonumber(core.setting_get("mainmenu_last_selected_world"))
|
||||||
)
|
)
|
||||||
|
|
||||||
retval = retval ..
|
local retval =
|
||||||
"image_button[4,4.05;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;play;".. fgettext("Play") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"size[16,11]"..
|
||||||
"image_button[7.8,4.05;3.95,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create;".. fgettext("New") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"box[-100,8.5;200,10;#999999]" ..
|
||||||
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
|
"bgcolor[#00000070;true]"..
|
||||||
|
"image_button[4,8.7;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;play;".. fgettext("Play") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
|
"image_button[7.8,8.7;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_create;".. fgettext("New") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
|
|
||||||
"image_button[4,4.8;2.68,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete;".. fgettext("Delete") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[4,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_delete;".. fgettext("Delete") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[6.53,4.8;2.68,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_configure;".. fgettext("Configure") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
--"image_button[6.53,9.55;2.68,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;world_configure;".. fgettext("Configure") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"image_button[9.07,4.8;2.68,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;cancel;".. fgettext("Cancel") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[7.8,9.55;3.95,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;cancel;".. fgettext("Cancel") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
|
"label[7,1.5;" .. fgettext("Select World:") .. "]" ..
|
||||||
|
|
||||||
"label[4,-0.25;".. fgettext("Select World:") .. "]"..
|
"checkbox[12,8.70;cb_creative_mode;" .. fgettext("Creative Mode") .. ";" .. dump(core.setting_getbool("creative_mode")) .. "]" ..
|
||||||
"checkbox[0.25,0.25;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
--"checkbox[1000,9.20;cb_enable_damage;" .. fgettext("Enable Damage") .. ";" .. dump(core.setting_getbool("enable_damage")) .. "]" ..
|
||||||
dump(core.setting_getbool("creative_mode")) .. "]"..
|
-- "checkbox[12,9.50;cb_server_announce;" .. fgettext("Public") .. ";" .. dump(core.setting_getbool("server_announce")) .. "]" ..
|
||||||
"checkbox[0.25,0.7;cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
|
|
||||||
dump(core.setting_getbool("enable_damage")) .. "]"..
|
|
||||||
"textlist[4,0.25;7.5,3.7;sp_worlds;" ..
|
"checkbox[0.2,8.35;btn_server;Local Server;false]"
|
||||||
menu_render_worldlist() ..
|
|
||||||
";" .. index .. "]"
|
|
||||||
return retval
|
local bind_addr = core.setting_get("bind_address")
|
||||||
|
|
||||||
|
if not PLATFORM=="android" and bind_addr ~= nil and bind_addr ~= "" then
|
||||||
|
retval = retval ..
|
||||||
|
"field[300,0;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" ..
|
||||||
|
core.formspec_escape(core.setting_get("bind_address")) .. "]"..
|
||||||
|
"field[300,1;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" ..
|
||||||
|
core.formspec_escape(core.setting_get("port")) .. "]"
|
||||||
|
else
|
||||||
|
retval = retval ..
|
||||||
|
"field[300,1;3.5,0.5;te_serverport;" .. fgettext("Server Port") .. ";" ..
|
||||||
|
core.formspec_escape(core.setting_get("port")) .. "]"
|
||||||
|
end
|
||||||
|
|
||||||
|
retval = retval ..
|
||||||
|
"textlist[0,2.2;16,6.5;sp_worlds;" ..
|
||||||
|
menu_render_worldlist() ..
|
||||||
|
";" .. (index or 1) .. ";true]"
|
||||||
|
|
||||||
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
local function main_button_handler(this, fields, name, tabdata)
|
local function main_button_handler(this, fields, name, tabdata)
|
||||||
|
|
||||||
--assert(name == "singleplayer")
|
--assert(name == "singleplayer")
|
||||||
|
|
||||||
|
if fields["btn_server"]~=nil then
|
||||||
|
local single = create_tab_server(true)
|
||||||
|
single:set_parent(this.parent)
|
||||||
|
single:show()
|
||||||
|
this:hide()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local world_doubleclick = false
|
local world_doubleclick = false
|
||||||
|
|
||||||
if fields["sp_worlds"] ~= nil then
|
if fields["sp_worlds"] ~= nil then
|
||||||
|
@ -138,7 +169,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
||||||
world_doubleclick or
|
world_doubleclick or
|
||||||
fields["key_enter"] then
|
fields["key_enter"] then
|
||||||
local selected = core.get_textlist_index("sp_worlds")
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
|
print(selected)
|
||||||
if selected ~= nil then
|
if selected ~= nil then
|
||||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||||
gamedata.singleplayer = true
|
gamedata.singleplayer = true
|
||||||
|
@ -237,3 +268,12 @@ tab_singleplayer = {
|
||||||
cbf_button_handler = main_button_handler,
|
cbf_button_handler = main_button_handler,
|
||||||
on_change = on_change
|
on_change = on_change
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_tab_single()
|
||||||
|
local retval = dialog_create("singleplayer",
|
||||||
|
get_formspec,
|
||||||
|
main_button_handler,
|
||||||
|
nil)
|
||||||
|
return retval
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
"box[-100,8.5;200,10;#999999]" ..
|
"box[-100,8.5;200,10;#999999]" ..
|
||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
"label[4,-0.25;".. fgettext("Select texture pack:") .. "]"..
|
"label[4,-0.25;".. fgettext("Select texture pack:") .. "]"..
|
||||||
"image_button[12,9.55;4,0.8;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..minetest.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"textlist[0,2.0;15.8,6.25;TPs;"
|
"textlist[0,2.0;15.8,6.25;TPs;"
|
||||||
|
|
||||||
local current_texture_path = core.setting_get("texture_path")
|
local current_texture_path = core.setting_get("texture_path")
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
-------------------------
|
-------------------------
|
||||||
-- adbs mod by 4aiman --
|
-- adbs mod by 4aiman --
|
||||||
|
@ -1532,7 +1533,24 @@ function adbs.register_spawn(name,
|
||||||
action = function(pos, node, aoc, aocw)
|
action = function(pos, node, aoc, aocw)
|
||||||
if aocw > aocnt then return end
|
if aocw > aocnt then return end
|
||||||
if not adbs.spawning_mobs[nm] then return end
|
if not adbs.spawning_mobs[nm] then return end
|
||||||
|
|
||||||
|
local test = minetest.get_node(pos).name
|
||||||
|
if test:find('water')
|
||||||
|
then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
--print(test)
|
||||||
|
end
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
|
local test = minetest.get_node(pos).name
|
||||||
|
if test:find('water')
|
||||||
|
then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
-- print(test)
|
||||||
|
end
|
||||||
|
pos.y = pos.y+1
|
||||||
|
|
||||||
local l = multicraft.get_node_light(pos)
|
local l = multicraft.get_node_light(pos)
|
||||||
local daytime = multicraft.get_timeofday()
|
local daytime = multicraft.get_timeofday()
|
||||||
local high_time
|
local high_time
|
||||||
|
@ -1549,6 +1567,7 @@ function adbs.register_spawn(name,
|
||||||
high_time = true
|
high_time = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not high_time then return end
|
if not high_time then return end
|
||||||
if not l then return end
|
if not l then return end
|
||||||
if l > light then return end
|
if l > light then return end
|
||||||
|
@ -2150,21 +2169,21 @@ end
|
||||||
local _
|
local _
|
||||||
|
|
||||||
adbs.register_spawn("adbs:sheep", {"group:crumbly"}, _,
|
adbs.register_spawn("adbs:sheep", {"group:crumbly"}, _,
|
||||||
5, 15, 5, 40, 2, 50, 10, 100, _, 100, _, 2, _,0,1)
|
5, 15, 5, 48, 2, 50, 10, 100, _, 100, _, 2, _,0,1)
|
||||||
|
|
||||||
adbs.register_spawn("adbs:pig", {"group:crumbly"}, "default:water_source",
|
adbs.register_spawn("adbs:pig", {"group:crumbly"}, _,
|
||||||
4, 15, 5, 50, 3, 100, _, 100, _, 100, _, 1, _,0,1)
|
3, 15, 5, 40, 3, 100, _, 100, _, 100, _, 1, _,0,1)
|
||||||
|
|
||||||
adbs.register_spawn("adbs:chicken", {"group:crumbly"}, _,
|
adbs.register_spawn("adbs:chicken", {"group:crumbly"}, _,
|
||||||
3, 15, 5, 60, 2, 100, _, 100, _, 100, _, 1, _,0,1)
|
3, 15, 5, 60, 2, 100, _, 100, _, 100, _, 1, _,0,1)
|
||||||
|
|
||||||
adbs.register_spawn("adbs:cow", {"group:crumbly"}, "default:water_source",
|
adbs.register_spawn("adbs:cow", {"group:crumbly"}, _,
|
||||||
6, 15, 5, 50, 3, 100, _, 100, _, 100, _, 1, _,0,1)
|
5, 15, 5, 50, 3, 100, _, 100, _, 100, _, 1, _,0,1)
|
||||||
|
|
||||||
adbs.register_spawn("adbs:skeleton", {"group:cracky", "group:crumbly"}, _,
|
adbs.register_spawn("adbs:skeleton", {"group:cracky", "group:crumbly"}, _,
|
||||||
7, 8, _, 40, 2, 100, -5000, 100, _, 100, _, 1, _,0.7,0.3)
|
7, 8, _, 40, 2, 100, -5000, 100, _, 100, _, 1, _,0.7,0.3)
|
||||||
|
|
||||||
adbs.register_spawn("adbs:zombie", {"group:crumbly"}, _,
|
adbs.register_spawn("adbs:zombie", {"group:crumbly", }, _,
|
||||||
7, 9, _, 40, 2, 100, -5000, 100, _, 100, _, 1, _,0.7,0.3)
|
7, 9, _, 40, 2, 100, -5000, 100, _, 100, _, 1, _,0.7,0.3)
|
||||||
|
|
||||||
adbs.register_spawn("adbs:skeleton", {"group:cracky", "group:crumbly"}, _,
|
adbs.register_spawn("adbs:skeleton", {"group:cracky", "group:crumbly"}, _,
|
||||||
|
|
|
@ -12,6 +12,7 @@ multicraft.register_alias("mapgen_jungletree", "default:jungletree")
|
||||||
multicraft.register_alias("mapgen_jungleleaves", "default:jungleleaves")
|
multicraft.register_alias("mapgen_jungleleaves", "default:jungleleaves")
|
||||||
multicraft.register_alias("mapgen_apple", "default:leaves")
|
multicraft.register_alias("mapgen_apple", "default:leaves")
|
||||||
multicraft.register_alias("mapgen_water_source", "default:water_source")
|
multicraft.register_alias("mapgen_water_source", "default:water_source")
|
||||||
|
multicraft.register_alias("mapgen_river_water_source", "default:water_source")
|
||||||
multicraft.register_alias("mapgen_dirt", "default:dirt")
|
multicraft.register_alias("mapgen_dirt", "default:dirt")
|
||||||
multicraft.register_alias("mapgen_sand", "default:sand")
|
multicraft.register_alias("mapgen_sand", "default:sand")
|
||||||
multicraft.register_alias("mapgen_gravel", "default:gravel")
|
multicraft.register_alias("mapgen_gravel", "default:gravel")
|
||||||
|
@ -26,6 +27,7 @@ multicraft.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
||||||
multicraft.register_alias("mapgen_desert_sand", "default:sand")
|
multicraft.register_alias("mapgen_desert_sand", "default:sand")
|
||||||
multicraft.register_alias("mapgen_desert_stone", "default:sandstone")
|
multicraft.register_alias("mapgen_desert_stone", "default:sandstone")
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Ore generation
|
-- Ore generation
|
||||||
--
|
--
|
||||||
|
|
Loading…
Reference in New Issue