- if selected ~= nil then
- local filename = menudata.worldlist:get_list()[selected].path
- local worldconfig = modmgr.get_worldconfig(filename)
- filename = filename .. DIR_DELIM .. "world.mt"
-
- if worldconfig.creative_mode ~= nil then
- core.setting_set("creative_mode", worldconfig.creative_mode)
- else
- local worldfile = Settings(filename)
- worldfile:set("creative_mode", core.setting_get("creative_mode"))
- if not worldfile:write() then
- core.log("error", "Failed to write world config file")
- end
- end
- if worldconfig.enable_damage ~= nil then
- core.setting_set("enable_damage", worldconfig.enable_damage)
- else
- local worldfile = Settings(filename)
- worldfile:set("enable_damage", core.setting_get("enable_damage"))
- if not worldfile:write() then
- core.log("error", "Failed to write world config file")
- end
- end
- end