consolidate plant abms

This commit is contained in:
FaceDeer 2017-03-16 15:26:14 -06:00
parent 8a53d06e92
commit e15fb67afb
2 changed files with 19 additions and 19 deletions

View File

@ -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",

View File

@ -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