summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua43
1 files changed, 33 insertions, 10 deletions
diff --git a/init.lua b/init.lua
index 204ee06..1e27f51 100644
--- a/init.lua
+++ b/init.lua
@@ -10,15 +10,38 @@ of the license, or (at your option) any later version.
--]]
-crops_interval = 30
-crops_chance = 8
-
-dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/melon.lua")
-dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/corn.lua")
-dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/tomato.lua")
-dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/potato.lua")
-dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/polebean.lua")
-
-dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/cooking.lua")
+crops = {}
+
+local worldpath = minetest.get_worldpath()
+local modpath = minetest.get_modpath(minetest.get_current_modname())
+
+dofile(modpath .. "/crops_settings.txt")
+
+if io.open(worldpath .. "/crops_settings.txt", "r") == nil then
+ io.input(modpath .. "/crops_settings.txt")
+ io.output(worldpath .. "/crops_settings.txt")
+
+ local size = 4096
+ while true do
+ local buf = io.read(size)
+ if not buf then
+ io.close()
+ break
+ end
+ io.write(buf)
+ end
+else
+ dofile(worldpath .. "/crops_settings.txt")
+end
+
+-- crop nodes, crafts, craftitems
+dofile(modpath .. "/melon.lua")
+dofile(modpath .. "/corn.lua")
+dofile(modpath .. "/tomato.lua")
+dofile(modpath .. "/potato.lua")
+dofile(modpath .. "/polebean.lua")
+
+-- cooking recipes that mix craftitems
+dofile(modpath .. "/cooking.lua")
minetest.log("action", "[crops] loaded.")