1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-12-29 16:00:16 +01:00

Merge pull request #2 from cornernote/patch-1

do not overwrite everything about leaves
This commit is contained in:
Splizard 2012-10-01 22:19:42 -07:00
commit d12956ce63

View File

@ -22,38 +22,18 @@ dofile(minetest.get_modpath("snow").."/mapgen.lua")
dofile(minetest.get_modpath("snow").."/config.lua") dofile(minetest.get_modpath("snow").."/config.lua")
--Replace leaves so snow gets removed on decay. --Replace leaves so snow gets removed on decay.
minetest.register_node(":default:leaves", { local leaves = {}
description = "Leaves", for k,v in pairs(minetest.registered_nodes["default:leaves"]) do
drawtype = "allfaces_optional", leaves[k] = v
visual_scale = 1.3, end
tiles = {"default_leaves.png"}, leaves.after_destruct = function(pos, node, digger)
paramtype = "light", pos.y = pos.y + 1
groups = {snappy=3, leafdecay=3, flammable=2}, local nodename = minetest.env:get_node(pos).name
drop = { if nodename == "snow:snow" then
max_items = 1, minetest.env:remove_node(pos)
items = { end
{ end
-- player will get sapling with 1/20 chance minetest.register_node(":default:leaves", leaves)
items = {'default:sapling'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'default:leaves'},
}
}
},
--Remove snow above leaves after decay.
after_destruct = function(pos, node, digger)
pos.y = pos.y + 1
local nodename = minetest.env:get_node(pos).name
if nodename == "snow:snow" then
minetest.env:remove_node(pos)
end
end,
sounds = default.node_sound_leaves_defaults(),
})
--Pine leaves. --Pine leaves.
minetest.register_node("snow:needles", { minetest.register_node("snow:needles", {