From f846f5624c1676aa1481e1d667260876ce129723 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Fri, 7 Feb 2014 13:35:02 +0100 Subject: [PATCH] Add new configuration loading --- init.lua | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index e6d182d..42fa05f 100644 --- a/init.lua +++ b/init.lua @@ -1,11 +1,29 @@ --Created by Krock for the BitChange mod local mod_path = minetest.get_modpath("bitchange") +local world_path = minetest.get_worldpath() if freeminer then minetest = freeminer end -dofile(mod_path.."/config.txt") +dofile(mod_path.."/config.default.txt") +-- Copied from moretrees mod +if io.open(world_path.."/bitchange_config.txt","r") == nil then + io.input(mod_path.."/config.default.txt") + io.output(world_path.."/bitchange_config.txt") + + while true do + local block = io.read(256) -- 256B at once + if not block then + io.close() + break + end + io.write(block) + end +else + dofile(world_path.."/bitchange_config.txt") +end + dofile(mod_path.."/minecoins.lua") if(bitchange_use_moreores_tin or bitchange_use_technic_zinc or bitchange_use_gold) then dofile(mod_path.."/moreores.lua") @@ -52,4 +70,4 @@ function bitchange_has_access(owner, player_name) return (player_name == owner or minetest.get_player_privs(player_name).server or minetest.get_player_privs(player_name).bitchange) end -print("[BitChange] Loaded.") \ No newline at end of file +print("[BitChange] Loaded.")