From 196bccb5a1f12ef76450fd0a577b9ee4eac01ba7 Mon Sep 17 00:00:00 2001 From: adrido Date: Sun, 27 Jul 2014 08:37:22 +0200 Subject: [PATCH] small rewrite and optimition --- mods.lua => 4seasons.lua | 0 init.lua | 36 +++++++++++++++++++++++++++++++++--- readme.txt | 18 ++++++++++++++++++ settings.txt | 14 -------------- settings.lua => snow.lua | 0 5 files changed, 51 insertions(+), 17 deletions(-) rename mods.lua => 4seasons.lua (100%) delete mode 100644 settings.txt rename settings.lua => snow.lua (100%) diff --git a/mods.lua b/4seasons.lua similarity index 100% rename from mods.lua rename to 4seasons.lua diff --git a/init.lua b/init.lua index 5dedac4..c7ae21a 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,36 @@ ---dofile(minetest.get_modpath("christmas_craft").."/mods.lua")--disabled because 4seasons is not installed -dofile(minetest.get_modpath("christmas_craft").."/crafts.lua") --temporary disabled because cristmas is over-- -dofile(minetest.get_modpath("christmas_craft").."/settings.lua") -- makes it snow +local worldpath = minetest.get_worldpath() +christmas_craft = {}; +christmas_craft.config = Settings(worldpath.."/christmas_craft.conf") + +local conf_table = christmas_craft.config:to_table() + +--look into readme.txt how to change settings +local defaults = { +enable_4seasons = "false", +enable_crafts = "true", +enable_snowing = "true", +} + +for k, v in pairs(defaults) do +if conf_table[k] == nil then +christmas_craft.config:set(k, v) +end +end + + +if christmas_craft.config:get("enable_enable_4seasons") == "true" then +dofile(minetest.get_modpath("christmas_craft").."/4seasons.lua")--enable in christmas_craft.conf if you have 4 seasons installed +end + +if christmas_craft.config:get("enable_crafts") == "true" then +dofile(minetest.get_modpath("christmas_craft").."/crafts.lua") --enable this if you want craft rezieps +end + +if christmas_craft.config:get("enable_snow") == "true" then +dofile(minetest.get_modpath("christmas_craft").."/snow.lua") -- enable this if you want snow +end + + -- blocks -- minetest.register_node("christmas_craft:snowman", { diff --git a/readme.txt b/readme.txt index 135b8c8..121c29e 100644 --- a/readme.txt +++ b/readme.txt @@ -39,6 +39,24 @@ HOW TO INSTALL? 6. enjoy the mod +Configuration +.................................................... +to edit the settings create a christmas_craft.conf file in your world dir. +add and modify the following lines: + + enable_4seasons = "false" + enable_crafts = "true" + enable_snowing = "true" + +example if you dont want the snowing landscape change + + enable_snowing = "true" +to + enable_snowing = "false" + +thats all :) + + OTHER STUFF .................................................... CHRISTMAS CRAFT MOD FOR MINETEST BY INFINATUM diff --git a/settings.txt b/settings.txt deleted file mode 100644 index 59562f3..0000000 --- a/settings.txt +++ /dev/null @@ -1,14 +0,0 @@ --------------------------------------------------- --- CONFIGURATION --------------------------------- --------------------------------------------------- - -------------------------------------------------------------- --- Change settings by changing the values after the "=". ---- -------------------------------------------------------------- - --- enabels mod support -- -dofile.enable_4seasons = false - - - - diff --git a/settings.lua b/snow.lua similarity index 100% rename from settings.lua rename to snow.lua