From 1bca50e2e816eac39545a925d5b32af62a90f5c7 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 1 Apr 2017 07:24:56 +0200 Subject: [PATCH] Remove snow covers periodically --- mods/ITEMS/mcl_core/functions.lua | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index d852df19f..aa492b6ae 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -387,8 +387,8 @@ minetest.register_abm({ interval = 30, chance = 20, action = function(pos) - if pos == nil then - return + if pos == nil then + return end local can_change = 0 for i=1,4 do @@ -409,7 +409,30 @@ minetest.register_abm({ end, }) - +-- Occassionally remove the snow covers from the snowy variants of grass block, podzol and mycelium +minetest.register_abm({ + label = "Remove snow cover", + nodenames = {"mcl_core:dirt_with_grass_snow", "mcl_core:podzol_snow", "mcl_core:mycelium_snow"}, + neighbors = {"air"}, + interval = 68.1, + chance = 2, + action = function(pos, node) + if pos == nil then + return + end + local p = {x=pos.x, y=pos.y+1, z=pos.z} + local n = minetest.get_node(p) + if (n.name=="air") then + if node.name == "mcl_core:dirt_with_grass_snow" then + minetest.swap_node(pos, {name="mcl_core:dirt_with_grass"}) + elseif node.name == "mcl_core:podzol_snow" then + minetest.swap_node(pos, {name="mcl_core:podzol"}) + elseif node.name == "mcl_core:mycelium_snow" then + minetest.swap_node(pos, {name="mcl_core:mycelium"}) + end + end + end, +}) -------------------------- -- Try generate tree ---