1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2025-06-30 07:10:21 +02:00

Add christmas trees.

This commit is contained in:
Splizard
2012-12-19 11:34:58 +13:00
parent 290f817878
commit 2ae3e27248
5 changed files with 92 additions and 10 deletions

View File

@ -46,6 +46,11 @@ minetest.register_node("snow:needles", {
drop = {
max_items = 1,
items = {
{
-- player will get xmas tree with 1/50 chance
items = {'snow:xmas_tree'},
rarity = 50,
},
{
-- player will get sapling with 1/20 chance
items = {'snow:sapling_pine'},
@ -69,6 +74,57 @@ minetest.register_node("snow:needles", {
sounds = default.node_sound_leaves_defaults(),
})
--Decorated Pine leaves.
minetest.register_node("snow:needles_decorated", {
description = "Decorated Pine Needles",
drawtype = "allfaces_optional",
tiles = {"snow_needles_decorated.png"},
paramtype = "light",
groups = {snappy=3, leafdecay=3, flammable=2},
drop = {
max_items = 1,
items = {
{
-- player will get xmas tree with 1/20 chance
items = {'snow:xmas_tree'},
rarity = 50,
},
{
-- player will get sapling with 1/20 chance
items = {'snow:sapling_pine'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'snow:needles_decorated'},
}
}
},
--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(),
})
minetest.register_node("snow:xmas_tree", {
description = "Christmas Tree",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"snow_xmas_tree.png"},
inventory_image = "snow_xmas_tree.png",
wield_image = "snow_xmas_tree.png",
paramtype = "light",
walkable = false,
groups = {snappy=2,dig_immediate=3,flammable=2},
sounds = default.node_sound_defaults(),
})
minetest.register_node("snow:sapling_pine", {
description = "Pine Sapling",
drawtype = "plantlike",
@ -82,6 +138,18 @@ minetest.register_node("snow:sapling_pine", {
sounds = default.node_sound_defaults(),
})
minetest.register_node("snow:star", {
description = "Star",
drawtype = "torchlike",
tiles = {"snow_star.png"},
inventory_image = "snow_star.png",
wield_image = "snow_star.png",
paramtype = "light",
walkable = false,
groups = {snappy=2,dig_immediate=3},
sounds = default.node_sound_defaults(),
})
minetest.register_craft({
type = "fuel",
recipe = "snow:needles",
@ -401,6 +469,16 @@ minetest.register_abm({
end,
})
--Grow saplings
minetest.register_abm({
nodenames = {"snow:xmas_tree"},
interval = 10,
chance = 50,
action = function(pos, node, active_object_count, active_object_count_wider)
snow.make_pine(pos,false,true)
end,
})
if snow.enable_snowfall then
--Snowing