summaryrefslogtreecommitdiff
path: root/corn.lua
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2015-04-23 22:51:27 -0700
committerAuke Kok <auke-jan.h.kok@intel.com>2015-04-23 22:51:27 -0700
commitbaf1b9ce6a9238d9669d28bebb5b6b222aad6b97 (patch)
tree021fca8ee782fbe9075eb85106cbcc42848f80e9 /corn.lua
parent9e2f05283caa9223af6c069715fe8eeb36f0c496 (diff)
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.
Diffstat (limited to 'corn.lua')
-rw-r--r--corn.lua27
1 files changed, 12 insertions, 15 deletions
diff --git a/corn.lua b/corn.lua
index 6f21055..84f315f 100644
--- a/corn.lua
+++ b/corn.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:corn", {
description = "corn",
inventory_image = "crops_corn.png",
@@ -87,10 +84,10 @@ minetest.register_node("crops:corn_base_seed", {
minetest.register_abm({
nodenames = { "crops:corn_base_seed" },
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
minetest.set_node(pos, { name = "crops:corn_base_1" })
@@ -115,10 +112,10 @@ minetest.register_node("crops:corn_base_1", {
minetest.register_abm({
nodenames = { "crops:corn_base_1" },
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
if not minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then
@@ -211,10 +208,10 @@ minetest.register_node("crops:corn_top_1", {
minetest.register_abm({
nodenames = { "crops:corn_top_1" },
neighbors = { "crops:corn_base_2" },
- 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
minetest.set_node(pos, { name = "crops:corn_top_2" })
@@ -247,10 +244,10 @@ minetest.register_node("crops:corn_top_2", {
minetest.register_abm({
nodenames = { "crops:corn_top_2" },
neighbors = { "crops:corn_base_2" },
- 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
minetest.set_node(pos, { name = "crops:corn_top_3" })