From baf1b9ce6a9238d9669d28bebb5b6b222aad6b97 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 23 Apr 2015 22:51:27 -0700 Subject: Configuration - persistent config file This allows a server admin to tweak the mods growth rate, chance and required light level. For convenience I've made 3 sets of "easy", "normal" and "difficult" settings so that it's easy to understand what the difference is and what good starting values are. --- potato.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'potato.lua') diff --git a/potato.lua b/potato.lua index a202a35..a253811 100644 --- a/potato.lua +++ b/potato.lua @@ -10,9 +10,6 @@ of the license, or (at your option) any later version. --]] -local interval = crops_interval -local chance = crops_chance - minetest.register_node("crops:potato_eyes", { description = "potato eyes", inventory_image = "crops_potato_eyes.png", @@ -110,14 +107,14 @@ minetest.register_node("crops:soil_with_potatoes", { minetest.register_abm({ nodenames = { "crops:potato_plant_1", "crops:potato_plant_2", "crops:potato_plant_3" }, neighbors = { "group:soil" }, - interval = interval, - chance = chance, + interval = crops.interval, + chance = crops.chance, action = function(pos, node, active_object_count, active_object_count_wider) local below = { x = pos.x, y = pos.y - 1, z = pos.z } if not minetest.registered_nodes[minetest.get_node(below).name].groups.soil then return end - if minetest.get_node_light(pos, nil) < 13 then + if minetest.get_node_light(pos, nil) < crops.light then return end local n = string.gsub(node.name, "3", "4") @@ -133,10 +130,10 @@ minetest.register_abm({ minetest.register_abm({ nodenames = { "crops:potato_plant_4" }, neighbors = { "group:soil" }, - interval = interval, - chance = chance, + interval = crops.interval, + chance = crops.chance, action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.get_node_light(pos, nil) < 13 then + if minetest.get_node_light(pos, nil) < crops.light then return end local below = { x = pos.x, y = pos.y - 1, z = pos.z } -- cgit v1.2.3