From a4a53ba854114ff2cafb0fd7f76d8d81f485a306 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 5 May 2015 22:44:22 -0700 Subject: No need to hardcode nodenames here. --- init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 0880299..e7982ed 100644 --- a/init.lua +++ b/init.lua @@ -214,13 +214,14 @@ dofile(modpath .. "/tomato.lua") dofile(modpath .. "/potato.lua") dofile(modpath .. "/polebean.lua") +local nodenames = {} +for i = 1,table.getn(crops.plants) do + table.insert(nodenames, crops.plants[i].name) +end + -- water handling code minetest.register_abm({ - nodenames = { - "crops:tomato_plant_1", "crops:tomato_plant_2", "crops:tomato_plant_3", "crops:tomato_plant_4", "crops:tomato_plant_5", - "crops:potato_plant_1", "crops:potato_plant_2", "crops:potato_plant_3", "crops:potato_plant_4", - "crops:melon_plant_1", "crops:melon_plant_2", "crops:melon_plant_3", "crops:melon_plant_4", "crops:melon_plant_5" - }, + nodenames = nodenames, interval = crops.interval, chance = crops.chance, action = function(pos, node, active_object_count, active_object_count_wider) -- cgit v1.2.3