1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-12-28 07:30:17 +01:00

Hide papyrus in snow.

This commit is contained in:
Splizard 2012-12-18 11:36:19 +13:00
parent 5c8e2d306e
commit 895f9c3e9e
2 changed files with 25 additions and 0 deletions

View File

@ -246,12 +246,30 @@ minetest.register_on_dignode(unsnowify)
minetest.register_node("snow:snow_block", {
description = "Snow",
tiles = {"snow_snow.png"},
--param2 is reserved for what vegetation is hiding inside.
--mapgen defines the vegetation.
--1 = Moss
--2 = Papyrus
is_ground_content = true,
groups = {crumbly=3,melts=2,falling_node=1},
drop = 'snow:snow_block',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
--Update dirt node underneath snow.
after_destruct = function(pos, node, digger)
if node.param2 == 1 then
local n = minetest.env:get_node(pos).name
if n == "air" or n == "default:water_flowing" or n == "default:water_source" then
minetest.env:add_node(pos,{name="snow:moss",param2=1})
end
elseif node.param2 == 2 then
local n = minetest.env:get_node(pos).name
if n == "air" or n == "default:water_flowing" or n == "default:water_source" then
minetest.env:add_node(pos,{name="default:papyrus"})
end
end
end,
})
--Snow brick.

View File

@ -192,6 +192,13 @@ if maxp.y >= -10 then
end
elseif ground_y and env:get_node({x=x,y=ground_y,z=z}).name == "default:leaves" then
env:add_node({x=x,y=ground_y+1,z=z}, {name="snow:snow"})
elseif ground_y and env:get_node({x=x,y=ground_y,z=z}).name == "default:papyrus" then
for i=ground_y, ground_y-4, -1 do
if env:get_node({x=x,y=i,z=z}).name == "default:papyrus" then
env:add_node({x=x,y=ground_y+1,z=z}, {name="snow:snow"})
env:add_node({x=x,y=i,z=z}, {name="snow:snow_block", param2=2})
end
end
elseif ground_y and node.name == "default:water_source" then
if not icesheet and not icecave and not icehole then
--Coastal ice.