diff options
author | fz72 <fz72@gmx.de> | 2015-03-15 14:52:10 +0100 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-18 09:53:24 +0100 |
commit | 8ca08a850ff2494652aa0ac2daa3d00f03aa4e7a (patch) | |
tree | 3625c1d51e16963a242c05ea1288ad70f90a5c9a /builtin/mainmenu/common.lua | |
parent | 2f0107f4a7e82019a68ae3c0572886622d9d49bf (diff) | |
download | minetest-8ca08a850ff2494652aa0ac2daa3d00f03aa4e7a.tar.gz minetest-8ca08a850ff2494652aa0ac2daa3d00f03aa4e7a.tar.bz2 minetest-8ca08a850ff2494652aa0ac2daa3d00f03aa4e7a.zip |
Save creative_mode and enable_damage setting for each world in world.mt
Create Parameters on world initialisation and set settings of old worlds
Diffstat (limited to 'builtin/mainmenu/common.lua')
-rw-r--r-- | builtin/mainmenu/common.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua index f32d77f2a..c1e8ee9c4 100644 --- a/builtin/mainmenu/common.lua +++ b/builtin/mainmenu/common.lua @@ -189,7 +189,6 @@ end -------------------------------------------------------------------------------- function menu_handle_key_up_down(fields,textlist,settingname) - if fields["key_up"] then local oldidx = core.get_textlist_index(textlist) @@ -197,6 +196,16 @@ function menu_handle_key_up_down(fields,textlist,settingname) local newidx = oldidx -1 core.setting_set(settingname, menudata.worldlist:get_raw_index(newidx)) + + local worldconfig = modmgr.get_worldconfig( + menudata.worldlist:get_list()[newidx].path) + + if worldconfig.creative_mode ~= nil then + core.setting_set("creative_mode", worldconfig.creative_mode) + end + if worldconfig.enable_damage ~= nil then + core.setting_set("enable_damage", worldconfig.enable_damage) + end end return true end @@ -208,6 +217,15 @@ function menu_handle_key_up_down(fields,textlist,settingname) local newidx = oldidx + 1 core.setting_set(settingname, menudata.worldlist:get_raw_index(newidx)) + local worldconfig = modmgr.get_worldconfig( + menudata.worldlist:get_list()[newidx].path) + + if worldconfig.creative_mode ~= nil then + core.setting_set("creative_mode", worldconfig.creative_mode) + end + if worldconfig.enable_damage ~= nil then + core.setting_set("enable_damage", worldconfig.enable_damage) + end end return true |