diff --git a/saplings/depends.txt b/saplings/depends.txt deleted file mode 100644 index 331d858..0000000 --- a/saplings/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default \ No newline at end of file diff --git a/saplings/init.lua b/saplings/init.lua deleted file mode 100644 index 6eeee04..0000000 --- a/saplings/init.lua +++ /dev/null @@ -1,55 +0,0 @@ - -minetest.register_node("saplings:sapling_top", { - description = "SaplingTop", - drawtype = "plantlike", - tiles = {"sapling16xa.png"}, - inventory_image = "sapling16xa.png", - wield_image = "sapling16xa.png", - paramtype = "light", - walkable = false, - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} - }, - groups = {snappy=3,flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - - -minetest.register_node("saplings:sapling_middle", { - description = "SaplingMiddle", - drawtype = "plantlike", - tiles = {"sapling16xb.png"}, - inventory_image = "sapling16xb.png", - wield_image = "sapling16xb.png", - paramtype = "light", - walkable = false, - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} - }, - groups = {snappy=3,flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - - - -minetest.register_node("saplings:sapling_bottom", { - description = "SaplingBottom", - drawtype = "plantlike", - tiles = {"sapling16xc.png"}, - inventory_image = "sapling16xc.png", - wield_image = "sapling16xc.png", - paramtype = "light", - walkable = false, - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} - }, - groups = {snappy=3,flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - \ No newline at end of file diff --git a/youngtrees/depends.txt b/youngtrees/depends.txt new file mode 100644 index 0000000..bde0bdf --- /dev/null +++ b/youngtrees/depends.txt @@ -0,0 +1,2 @@ +default +plants_lib \ No newline at end of file diff --git a/youngtrees/init.lua b/youngtrees/init.lua new file mode 100644 index 0000000..d1033f4 --- /dev/null +++ b/youngtrees/init.lua @@ -0,0 +1,101 @@ + abstract_youngtrees = {} +minetest.register_node("youngtrees:youngtree_top", { + description = "youngtreeTop", + drawtype = "plantlike", + tiles = {"youngtree16xa.png"}, + inventory_image = "youngtree16xa.png", + wield_image = "youngtree16xa.png", + paramtype = "light", + walkable = false, + is_ground_content = true, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + }, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + + +minetest.register_node("youngtrees:youngtree_middle", { + description = "youngtreeMiddle", + drawtype = "plantlike", + tiles = {"youngtree16xb.png"}, + inventory_image = "youngtree16xb.png", + wield_image = "youngtree16xb.png", + paramtype = "light", + walkable = false, + is_ground_content = true, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + }, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + + + +minetest.register_node("youngtrees:youngtree_bottom", { + description = "youngtreeBottom", + drawtype = "plantlike", + tiles = {"youngtree16xc.png"}, + inventory_image = "youngtree16xc.png", + wield_image = "youngtree16xc.png", + paramtype = "light", + walkable = false, + is_ground_content = true, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + }, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + + + abstract_youngtrees.grow_youngtree = function(pos) + local height = math.random(1,3) + abstract_youngtrees.grow_youngtree_node(pos,height) +end + +abstract_youngtrees.grow_youngtree_node = function(pos, height) + + + local right_here = {x=pos.x, y=pos.y+1, z=pos.z} + local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z} + + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + or minetest.get_node(right_here).name == "default:junglegrass" then + if height == 1 then + minetest.add_node(right_here, {name="youngtrees:youngtree_top"}) + end + if height == 2 then + minetest.add_node(right_here, {name="youngtrees:youngtree_bottom"}) + minetest.add_node(above_right_here, {name="youngtrees:youngtree_top"}) + end + if height == 3 then + local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} + minetest.add_node(right_here, {name="youngtrees:youngtree_bottom"}) + minetest.add_node(above_right_here, {name="youngtrees:youngtree_middle"}) + minetest.add_node(two_above_right_here, {name="youngtrees:youngtree_top"}) + end + end +end + + +plantslib:register_generate_plant({ + surface = { + "default:dirt_with_grass", + "stoneage:grass_with_silex", + "sumpf:peat", + "sumpf:sumpf" + }, + max_count = 15, --10,15 + rarity = 101 - 4, --3,4 + min_elevation = 1, -- above sea level + plantlife_limit = -0.9, + check_air = false, + }, + "abstract_youngtrees.grow_youngtree" +) diff --git a/saplings/textures/unused/sapling.png b/youngtrees/textures/unused/sapling.png similarity index 100% rename from saplings/textures/unused/sapling.png rename to youngtrees/textures/unused/sapling.png diff --git a/saplings/textures/unused/sapling16x.png b/youngtrees/textures/unused/sapling16x.png similarity index 100% rename from saplings/textures/unused/sapling16x.png rename to youngtrees/textures/unused/sapling16x.png diff --git a/saplings/textures/sapling16xa.png b/youngtrees/textures/youngtree16xa.png similarity index 100% rename from saplings/textures/sapling16xa.png rename to youngtrees/textures/youngtree16xa.png diff --git a/saplings/textures/sapling16xb.png b/youngtrees/textures/youngtree16xb.png similarity index 100% rename from saplings/textures/sapling16xb.png rename to youngtrees/textures/youngtree16xb.png diff --git a/saplings/textures/sapling16xc.png b/youngtrees/textures/youngtree16xc.png similarity index 100% rename from saplings/textures/sapling16xc.png rename to youngtrees/textures/youngtree16xc.png