ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 04 00 00 00 04 00 08 06 00 00 00 7f 1d 2b | .PNG........IHDR...............+ |
0020 | 83 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 | .....bKGD..............pHYs..... |
0040 | 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e0 09 0d 0e 32 2d 87 db 2e 80 00 00 16 89 49 | ............tIME.....2-........I |
0060 | 44 41 54 78 da ed dd 41 6d c4 30 10 86 d1 b6 32 80 20 98 c3 c2 08 05 63 59 34 8b a5 81 10 18 3d | DATx...Am.0....2.......cY4.....= |
0080 | 18 41 18 6c 2f d5 aa c7 46 72 b7 e3 fa 3d 04 d6 7f fc 34 4a 5e 6b ad f7 17 00 00 00 e0 5f 7b 33 | .A.l/...Fr...=....4J^k......._{3 |
00a0 | 01 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 | ................................ |
00c0 | 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 | ................................ |
00e0 | 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 00 00 00 | ................................ |
0100 | 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 | ................................ |
0120 | 00 00 08 00 00 00 00 30 bb 62 02 00 00 38 ef e3 fa 6e 84 04 2e b7 6a 04 f8 21 17 00 00 00 00 20 | .......0.b...8...n....j..!...... |
0140 | 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 f0 24 fe 02 00 a4 d3 5a 33 02 fc | ......................$.....Z3.. |
0160 | 92 88 30 02 00 4c ca 05 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 | ..0..L.......................... |
0180 | 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 | ................................ |
01a0 | 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 | ................................ |
01c0 | 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 | ................................ |
01e0 | 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 98 00 00 00 00 04 00 00 00 00 40 00 00 00 00 | ...........................@.... |
0200 | 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 | ......@..........@..........@... |
0220 | 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 | ................................ |
0240 | 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 | .............@..........@....... |
0260 | 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 | ...@..........@................. |
0280 | 00 00 00 00 10 00 00 00 00 80 01 14 13 00 00 00 f4 d5 5a 33 02 0f 11 91 e2 1d 2e 00 00 00 00 60 | ..................Z3...........` |
02a0 | 02 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 | ................................ |
02c0 | 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 | ................................ |
02e0 | 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 00 | ................................ |
0300 | 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 | ................................ |
0320 | 00 00 00 00 08 00 00 00 00 20 00 98 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 46 50 4c 00 00 | .....................@.....FPL.. |
0340 | 00 e7 5d 6e d5 08 c0 50 5c 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 | ..]n...P\....................... |
0360 | 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 | ................................ |
0380 | 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 | ................................ |
03a0 | 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 | ................................ |
03c0 | 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 80 09 00 00 00 40 00 00 00 00 00 04 00 00 | .......................@........ |
03e0 | 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 | ..@..........@..........@....... |
0400 | 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 | ................................ |
0420 | 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 | ....................@..........@ |
0440 | 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 | ..........@..........@.......... |
0460 | 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 | ................................ |
0480 | 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 | .................@..........@... |
04a0 | 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 | .......@..........@............. |
04c0 | 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 | ................................ |
04e0 | 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 | ...@..........@..........@...... |
0500 | 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 | ....@..........@................ |
0520 | 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 e8 ac 98 00 00 e8 ed 38 0e 23 00 53 5a 96 c5 08 | .......................8.#.SZ... |
--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.
--------------------------------------------------------------------------------
local enabled_all = false
local function modname_valid(name)
return not name:find("[^a-z0-9_]")
end
local function get_formspec(data)
local mod = data.list:get_list()[data.selected_mod]
local retval =
"size[11.5,7.5,true]" ..
"label[0.5,0;" .. fgettext("World:") .. "]" ..
"label[1.75,0;" .. data.worldspec.name .. "]"
if mod == nil then
mod = {name=""}
end
local hard_deps, soft_deps = modmgr.get_dependencies(mod.path)
retval = retval ..
"label[0,0.7;" .. fgettext("Mod:") .. "]" ..
"label[0.75,0.7;" .. mod.name .. "]" ..
"label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
"textlist[0,1.75;5,2.125;world_config_depends;" ..
hard_deps .. ";0]" ..
"label[0,3.875;" .. fgettext("Optional dependencies:") .. "]" ..
"textlist[0,4.375;5,1.8;world_config_optdepends;" ..
soft_deps .. ";0]" ..
"button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
"button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
if mod and mod.name ~= "" and not mod.is_game_content then
if mod.is_modpack then
local rawlist = data.list:get_raw_list()
local all_enabled = true
for j = 1, #rawlist, 1 do
if rawlist[j].modpack == mod.name and not rawlist[j].enabled then
all_enabled = false
break
end
end
if all_enabled then
retval = retval .. "button[5.5,0.125;2.5,0.5;btn_mp_disable;" ..
fgettext("Disable MP") .. "]"
else
retval = retval .. "button[5.5,0.125;2.5,0.5;btn_mp_enable;" ..
fgettext("Enable MP") .. "]"
end
else
if mod.enabled then
retval = retval .. "checkbox[5.5,-0.125;cb_mod_enable;" ..
fgettext("enabled") .. ";true]"
else
retval = retval .. "checkbox[5.5,-0.125;cb_mod_enable;" ..
fgettext("enabled") .. ";false]"
end
end
end
if enabled_all then
retval = retval ..
"button[8.75,0.125;2.5,0.5;btn_disable_all_mods;" .. fgettext("Disable all") .. "]"
else
retval = retval ..
"button[8.75,0.125;2.5,0.5;btn_enable_all_mods;" .. fgettext("Enable all") .. "]"
end
retval = retval ..
"tablecolumns[color;tree;text]" ..
"table[5.5,0.75;5.75,6;world_config_modlist;"
retval = retval .. modmgr.render_modlist(data.list)
retval = retval .. ";" .. data.selected_mod .."]"
return retval
end
local function enable_mod(this, toset)
local mod = this.data.list:get_list()[this.data.selected_mod]
if mod.is_game_content then
-- game mods can't be enabled or disabled
elseif not mod.is_modpack then
if toset == nil then
mod.enabled = not mod.enabled
else
mod.enabled = toset
end
else
local list = this.data.list:get_raw_list()
for i=1,#list,1 do
if list[i].modpack == mod.name then
if toset == nil then
toset = not list[i].enabled
end
list[i].enabled = toset
end
end
end
end
local function handle_buttons( | ................................ |
0dc0 | 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 | ................................ |
0de0 | 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 | ................................ |
0e00 | 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 | ................................ |
0e20 | 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 | ................................ |
0e40 | 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 | ................................ |
0e60 | 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 | ................................ |
0e80 | 60 02 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 | `............................... |
0ea0 | 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 | ......................@......... |
0ec0 | 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 | .@..........@..........@........ |
0ee0 | 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 | ................................ |
0f00 | 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 | ........@..........@..........@. |
0f20 | 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 | .........@..........@........... |
0f40 | 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 | ................................ |
0f60 | 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 | .....@..........@..........@.... |
0f80 | 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 | ......@......................... |
0fa0 | 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 | ................................ |
0fc0 | 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 | ..@..........@..........@....... |
0fe0 | 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 | ...@............................ |
1000 | 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 | ...............................@ |
1020 | 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 | ..........@..........@.......... |
1040 | 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 | @............................... |
1060 | 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 | ............................@... |
1080 | 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 | .......@..........@..........@.. |
10a0 |
if modname_valid(mod.name) then
worldfile:set("load_mod_"..mod.name, tostring(mod.enabled))
else
if mod.enabled then
gamedata.errormessage = fgettext_ne("Failed to enable mod \"$1\" as it contains disallowed characters. Only chararacters [a-z0-9_] are allowed.", mod.name)
end
end
mods["load_mod_"..mod.name] = nil
end
end
-- Remove mods that are not present anymore
for key,value in pairs(mods) do
if key:sub(1,9) == "load_mod_" then
worldfile:remove(key)
end
end
if not worldfile:write() then
core.log("error", "Failed to write world config file")
end
this:delete()
return true
end
if fields["btn_config_world_cancel"] then
this:delete()
return true
end
if fields.btn_enable_all_mods then
local list = this.data.list:get_raw_list()
for i = 1, #list do
if not list[i].is_game_content
and not list[i].is_modpack then
list[i].enabled = true
end
end
enabled_all = true
return true
end
if fields.btn_disable_all_mods then
local list = this.data.list:get_raw_list()
for i = 1, #list do
if not list[i].is_game_content
and not list[i].is_modpack then
list[i].enabled = false
end
end
enabled_all = false
return true
end
return false
end
function create_configure_world_dlg(worldidx)
local dlg = dialog_create("sp_config_world",
get_formspec,
handle_buttons,
nil)
dlg.data.selected_mod = tonumber(core.settings:get("world_config_selected_mod"))
if dlg.data.selected_mod == nil then
dlg.data.selected_mod = 0
end
dlg.data.worldspec = core.get_worlds()[worldidx]
if dlg.data.worldspec == nil then dlg:delete() return nil end
dlg.data.worldconfig = modmgr.get_worldconfig(dlg.data.worldspec.path)
if dlg.data.worldconfig == nil or dlg.data.worldconfig.id == nil or
dlg.data.worldconfig.id == "" then
dlg:delete()
return nil
end
dlg.data.list = filterlist.create(
modmgr.preparemodlist, --refresh
modmgr.comparemod, --compare
function(element,uid) --uid match
if element.name == uid then
return true
end
end,
function(element, criteria)
if criteria.hide_game and
element.is_game_content then
return false
end
if criteria.hide_modpackcontents and
element.modpack ~= nil then
return false
end
return true
end, --filter
{ worldpath= dlg.data.worldspec |