Fix floating saplings
[minetest_hades/hades_revisited.git] / mods / hades_trees / birch.lua
blobd8c92b45f3abd1af5da18d3ac14a1e615892e2a0
1 local S = minetest.get_translator("hades_trees")
3 minetest.register_node("hades_trees:birch_sapling", {
4 description = S("Birch Sapling"),
5 _tt_help = S("Needs Dirt and light to grow"),
6 drawtype = "plantlike",
7 tiles = {"default_sapling_birch.png"},
8 inventory_image = "default_sapling_birch.png",
9 wield_image = "default_sapling_birch.png",
10 paramtype = "light",
11 walkable = false,
12 selection_box = {
13 type = "fixed",
14 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
16 groups = {dig_immediate=3,flammable=2,attached_node=1, sapling=1},
17 sounds = hades_sounds.node_sound_defaults(),
20 minetest.register_node("hades_trees:birch_tree", {
21 description = S("Birch Tree Trunk"),
22 paramtype = "light",
23 tiles = {"default_tree_birch_top.png", "default_tree_birch_top.png", "default_tree_birch.png"},
24 is_ground_content = false,
25 drawtype = "nodebox",
26 node_box = {
27 type = "fixed",
28 fixed = {
29 {-0.35,-0.5,-0.4,0.35,0.5,0.4},
30 {-0.4,-0.5,-0.35, 0.4,0.5,0.35},
31 {-0.25,-0.5,-0.45,0.25,0.5,0.45},
32 {-0.45,-0.5,-0.25, 0.45,0.5,0.25},
33 {-0.15,-0.5,-0.5,0.15,0.5,0.5},
34 {-0.5,-0.5,-0.15, 0.5,0.5,0.15},
37 groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
38 sounds = hades_sounds.node_sound_wood_defaults(),
41 minetest.register_node("hades_trees:birch_leaves", {
42 description = S("Birch Leaves"),
43 drawtype = "allfaces_optional",
44 tiles = {"default_leaves_birch.png"},
45 paramtype = "light",
46 waving = 1,
47 is_ground_content = false,
48 place_param2 = 1,
49 groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, porous=1},
50 drop = {
51 max_items = 1,
52 items = {
54 -- player will get sapling with 1/20 chance
55 items = {'hades_trees:birch_sapling'},
56 rarity = 30,
59 -- player will get leaves only if he get no saplings,
60 -- this is because max_items is 1
61 items = {'hades_trees:birch_leaves'},
65 sounds = hades_sounds.node_sound_leaves_defaults(),
68 minetest.register_node("hades_trees:birch_bark", {
69 description = S("Birch Bark"),
70 paramtype2 = "facedir",
71 tiles = { "default_tree_birch.png" },
72 is_ground_content = false,
73 groups = { choppy = 3, oddly_breakable_by_hand = 1, flammable = 2 },
74 sounds = hades_sounds.node_sound_wood_defaults(),
77 minetest.register_abm({
78 nodenames = {"hades_trees:birch_sapling"},
79 interval = 60,
80 chance = 20,
81 action = function(pos, node)
82 hades_trees:generate_birchtree(pos, "hades_trees:birch_tree", "hades_trees:birch_leaves", {"hades_core:dirt", "hades_core:dirt_with_grass"})
83 end