From 99d44f526cda66fabc318dbe0e26c431325ca854 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 1 Apr 2017 07:10:05 +0200 Subject: [PATCH] Change dirt snow surface when placing snow on top --- mods/ITEMS/mcl_core/nodes.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mods/ITEMS/mcl_core/nodes.lua b/mods/ITEMS/mcl_core/nodes.lua index 28a434b5..b814d0c0 100644 --- a/mods/ITEMS/mcl_core/nodes.lua +++ b/mods/ITEMS/mcl_core/nodes.lua @@ -1907,6 +1907,29 @@ for i=0,3 do end end +local on_snow_construct = function(pos) + local npos = {x=pos.x, y=pos.y-1, z=pos.z} + local node = minetest.get_node(npos) + if node.name == "mcl_core:dirt_with_grass" then + minetest.swap_node(npos, {name="mcl_core:dirt_with_grass_snow"}) + elseif node.name == "mcl_core:podzol" then + minetest.swap_node(npos, {name="mcl_core:podzol_snow"}) + elseif node.name == "mcl_core:mycelium" then + minetest.swap_node(npos, {name="mcl_core:mycelium_snow"}) + end +end +local on_snow_destruct = function(pos) + local npos = {x=pos.x, y=pos.y-1, z=pos.z} + local node = minetest.get_node(npos) + if node.name == "mcl_core:dirt_with_grass_snow" then + minetest.swap_node(npos, {name="mcl_core:dirt_with_grass"}) + elseif node.name == "mcl_core:podzol_snow" then + minetest.swap_node(npos, {name="mcl_core:podzol"}) + elseif node.name == "mcl_core:mycelium_snow" then + minetest.swap_node(npos, {name="mcl_core:mycelium"}) + end +end + minetest.register_node("mcl_core:snow", { description = "Top Snow", _doc_items_longdesc = "Top snow is a thin layer of snow.", @@ -1929,6 +1952,8 @@ minetest.register_node("mcl_core:snow", { }, groups = {shovely=1, attached_node=1,deco_block=1, dig_by_piston=1}, sounds = mcl_sounds.node_sound_snow_defaults(), + on_construct = on_snow_construct, + on_destruct = on_snow_destruct, drop = "mcl_throwing:snowball 2", _mcl_blast_resistance = 0.5, _mcl_hardness = 0.1, @@ -1943,6 +1968,8 @@ minetest.register_node("mcl_core:snowblock", { stack_max = 64, groups = {shovely=1, building_block=1}, sounds = mcl_sounds.node_sound_snow_defaults(), + on_construct = on_snow_construct, + on_destruct = on_snow_destruct, drop = "mcl_throwing:snowball 4", _mcl_blast_resistance = 1, _mcl_hardness = 0.2,