Change dirt snow surface when placing snow on top

This commit is contained in:
Wuzzy 2017-04-01 07:10:05 +02:00
parent 6eed06f7fc
commit 99d44f526c

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