From e15fb67afb873cc249492d0ba0b792fcc6b23586 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Thu, 16 Mar 2017 15:26:14 -0600 Subject: [PATCH] consolidate plant abms --- init.lua | 19 ------------------- plants.lua | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/init.lua b/init.lua index 8365e78..846ed0e 100644 --- a/init.lua +++ b/init.lua @@ -31,25 +31,6 @@ dofile(modpath.."/trees/nether_cap.lua") dofile(modpath.."/trees/goblin_cap.lua") dofile(modpath.."/trees/tower_cap.lua") -if dfcaverns.config.light_kills_fungus then - minetest.register_abm({ - label = "dfcaverns:kill_light_sensitive_fungus", - nodenames = {"group:light_sensitive_fungus"}, - catch_up = true, - interval = 30, - chance = 5, - action = function(pos, node) - local node_def = minetest.registered_nodes[node.name] - local dead_node = node_def._dfcaverns_dead_node or "dfcaverns:dead_fungus" - -- 11 is the value adjacent to a torch - local light_level = minetest.get_node_light(pos) - if light_level and light_level > node_def.groups.light_sensitive_fungus then - minetest.set_node(pos, {name=dead_node, param2 = node.param2}) - end - end - }) -end - minetest.register_ore({ ore_type = "vein", ore = "default:lava_source", diff --git a/plants.lua b/plants.lua index 24371d2..2a61668 100644 --- a/plants.lua +++ b/plants.lua @@ -99,3 +99,22 @@ dfcaverns.register_grow_abm = function(names, interval, chance) end }) end + +if dfcaverns.config.light_kills_fungus then + minetest.register_abm({ + label = "dfcaverns:kill_light_sensitive_fungus", + nodenames = {"group:light_sensitive_fungus"}, + catch_up = true, + interval = 30, + chance = 5, + action = function(pos, node) + local node_def = minetest.registered_nodes[node.name] + local dead_node = node_def._dfcaverns_dead_node or "dfcaverns:dead_fungus" + -- 11 is the value adjacent to a torch + local light_level = minetest.get_node_light(pos) + if light_level and light_level > node_def.groups.light_sensitive_fungus then + minetest.set_node(pos, {name=dead_node, param2 = node.param2}) + end + end + }) +end