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:
commit
d12956ce63
34
init.lua
34
init.lua
@ -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", {
|
||||||
|
Loading…
Reference in New Issue
Block a user