summaryrefslogtreecommitdiff
path: root/melon.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 /melon.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 'melon.lua')
-rw-r--r--melon.lua17
1 files changed, 7 insertions, 10 deletions
diff --git a/melon.lua b/melon.lua
index b5cdecc..1473b7c 100644
--- a/melon.lua
+++ b/melon.lua
@@ -17,9 +17,6 @@ local faces = {
[4] = { x = 0, z = 1, r = 0, o = 2, m = 11 }
}
-local interval = crops_interval
-local chance = crops_chance
-
minetest.register_node("crops:melon_seed", {
description = "melon seed",
inventory_image = "crops_melon_seed.png",
@@ -141,10 +138,10 @@ minetest.register_node("crops:melon", {
minetest.register_abm({
nodenames = { "crops:melon_plant_1", "crops:melon_plant_2", "crops:melon_plant_3","crops:melon_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 n = string.gsub(node.name, "4", "5")
@@ -161,10 +158,10 @@ minetest.register_abm({
minetest.register_abm({
nodenames = { "crops:melon_plant_5" },
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
for face = 1, 4 do
@@ -199,7 +196,7 @@ minetest.register_abm({
--
minetest.register_abm({
nodenames = { "crops:melon_plant_5_attached" },
- interval = interval,
+ interval = crops.interval,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for face = 1, 4 do