do not overwrite everything about leaves

using this code means that any other mods that change leaves will still work
This commit is contained in:
cornernote 2012-10-02 11:09:34 +09:30
parent c9c2d5d583
commit d734bdba35

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",
groups = {snappy=3, leafdecay=3, flammable=2},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
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 pos.y = pos.y + 1
local nodename = minetest.env:get_node(pos).name local nodename = minetest.env:get_node(pos).name
if nodename == "snow:snow" then if nodename == "snow:snow" then
minetest.env:remove_node(pos) minetest.env:remove_node(pos)
end end
end, end
sounds = default.node_sound_leaves_defaults(), minetest.register_node(":default:leaves", leaves)
})
--Pine leaves. --Pine leaves.
minetest.register_node("snow:needles", { minetest.register_node("snow:needles", {