From 31fa759947ed742ca73e5ff7f9543aea0a511805 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 14 May 2017 02:23:46 +0200 Subject: [PATCH] Turn grass block and mycelium back to dirt in dark --- mods/ITEMS/mcl_core/functions.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 2ac6c0c962..27be189e24 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -426,6 +426,25 @@ minetest.register_abm({ end }) +-- Grass/mycelium death in darkness +minetest.register_abm({ + label = "Grass Block / Mycelium in darkness", + nodenames = {"group:spreading_dirt_type"}, + interval = 8, + chance = 50, + catch_up = false, + action = function(pos, node) + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local name = minetest.get_node(above).name + local nodedef = minetest.registered_nodes[name] + -- Kill grass/mycelium when below opaque block or liquid + if name ~= "ignore" and nodedef and ((nodedef.groups and nodedef.groups.opaque) or nodedef.liquidtype ~= "none") then + minetest.set_node(pos, {name = "mcl_core:dirt"}) + end + end +}) + + -------------------------- -- Try generate tree --- --------------------------