diff --git a/mods/fl_trees/saplings.lua b/mods/fl_trees/saplings.lua index 7206360..8ea2126 100644 --- a/mods/fl_trees/saplings.lua +++ b/mods/fl_trees/saplings.lua @@ -1,94 +1,40 @@ local modpath = minetest.get_modpath("fl_trees") -minetest.register_node("fl_trees:aspen_sapling", { - description = "aspen sapling", - drawtype = "plantlike", - paramtype = "light", - sunlight_propagates = true, - walkable = true, - tiles = {"farlands_aspen_sapling.png"}, - groups = {oddly_breakable_by_hand = 3}, - on_timer = function(pos) - minetest.remove_node(pos) - minetest.place_schematic( - {x=pos.x-2, y=pos.y, z=pos.z-2}, - modpath .. "/schems/aspen_tree_" .. math.random(5) .. ".mts", - 0, - nil, - false - ) - end, - on_costruct = function(pos) - minetest.remove_node(pos) - minetest.get_node_timer(pos):start(20) - end, - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then return end - minetest.get_node_timer(pointed_thing.above):start(20) - return minetest.item_place(itemstack, placer, pointed_thing) - end, - selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}}, - collision_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}} -}) +local function register_sapling(name, offset) + minetest.register_node("fl_trees:" .. name .. "_sapling", { + description = name .. " sapling", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = true, + tiles = {"farlands_" .. name .. "_sapling.png"}, + groups = {oddly_breakable_by_hand = 3}, + on_timer = function(pos) + minetest.remove_node(pos) + minetest.place_schematic( + {x=pos.x-offset.x, y=pos.y, z=pos.z-offset.y}, + modpath .. "/schems/" .. name .. "_tree_" .. math.random(5) .. ".mts", + "random", + nil, + false + ) + end, + on_costruct = function(pos) + minetest.remove_node(pos) + minetest.get_node_timer(pos):start(20) + end, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then return end + minetest.get_node_timer(pointed_thing.above):start(20) + return minetest.item_place(itemstack, placer, pointed_thing) + end, + selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}}, + collision_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}} + }) +end -minetest.register_node("fl_trees:baobab_sapling", { - description = "baobab sapling", - drawtype = "plantlike", - paramtype = "light", - sunlight_propagates = true, - walkable = true, - tiles = {"farlands_baobab_sapling.png"}, - groups = {oddly_breakable_by_hand = 3}, - on_timer = function(pos) - minetest.remove_node(pos) - minetest.place_schematic( - {x=pos.x-3, y=pos.y, z=pos.z-3}, - modpath .. "/schems/baobab_tree_" .. math.random(5) .. ".mts", - 0, - nil, - false - ) - end, - on_costruct = function(pos) - minetest.remove_node(pos) - minetest.get_node_timer(pos):start(20) - end, - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then return end - minetest.get_node_timer(pointed_thing.above):start(20) - return minetest.item_place(itemstack, placer, pointed_thing) - end, - selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}}, - collision_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}} -}) - -minetest.register_node("fl_trees:apple_sapling", { - description = "apple sapling", - drawtype = "plantlike", - paramtype = "light", - sunlight_propagates = true, - walkable = true, - tiles = {"farlands_apple_sapling.png"}, - groups = {oddly_breakable_by_hand = 3}, - on_timer = function(pos) - minetest.remove_node(pos) - minetest.place_schematic( - {x=pos.x-2, y=pos.y, z=pos.z-2}, - modpath .. "/schems/apple_tree_" .. math.random(5) .. ".mts", - 0, - nil, - false - ) - end, - on_costruct = function(pos) - minetest.remove_node(pos) - minetest.get_node_timer(pos):start(20) - end, - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then return end - minetest.get_node_timer(pointed_thing.above):start(20) - return minetest.item_place(itemstack, placer, pointed_thing) - end, - selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}}, - collision_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}} -}) \ No newline at end of file +register_sapling("aspen", {x=2,y=2}) +register_sapling("baobab", {x=3,y=3}) +register_sapling("apple", {x=2,y=2}) +register_sapling("acacia", {x=3,y=3}) +register_sapling("palm", {x=3,y=3}) \ No newline at end of file diff --git a/mods/fl_trees/schems/acacia_tree_1.mts b/mods/fl_trees/schems/acacia_tree_1.mts new file mode 100644 index 0000000..bb70d74 Binary files /dev/null and b/mods/fl_trees/schems/acacia_tree_1.mts differ diff --git a/mods/fl_trees/schems/acacia_tree_2.mts b/mods/fl_trees/schems/acacia_tree_2.mts new file mode 100644 index 0000000..bb70d74 Binary files /dev/null and b/mods/fl_trees/schems/acacia_tree_2.mts differ diff --git a/mods/fl_trees/schems/acacia_tree_3.mts b/mods/fl_trees/schems/acacia_tree_3.mts new file mode 100644 index 0000000..bb70d74 Binary files /dev/null and b/mods/fl_trees/schems/acacia_tree_3.mts differ diff --git a/mods/fl_trees/schems/acacia_tree_4.mts b/mods/fl_trees/schems/acacia_tree_4.mts new file mode 100644 index 0000000..bb70d74 Binary files /dev/null and b/mods/fl_trees/schems/acacia_tree_4.mts differ diff --git a/mods/fl_trees/schems/acacia_tree_5.mts b/mods/fl_trees/schems/acacia_tree_5.mts new file mode 100644 index 0000000..bb70d74 Binary files /dev/null and b/mods/fl_trees/schems/acacia_tree_5.mts differ diff --git a/mods/fl_trees/schems/palm_tree_1.mts b/mods/fl_trees/schems/palm_tree_1.mts new file mode 100644 index 0000000..532745c Binary files /dev/null and b/mods/fl_trees/schems/palm_tree_1.mts differ diff --git a/mods/fl_trees/schems/palm_tree_2.mts b/mods/fl_trees/schems/palm_tree_2.mts new file mode 100644 index 0000000..532745c Binary files /dev/null and b/mods/fl_trees/schems/palm_tree_2.mts differ diff --git a/mods/fl_trees/schems/palm_tree_3.mts b/mods/fl_trees/schems/palm_tree_3.mts new file mode 100644 index 0000000..532745c Binary files /dev/null and b/mods/fl_trees/schems/palm_tree_3.mts differ diff --git a/mods/fl_trees/schems/palm_tree_4.mts b/mods/fl_trees/schems/palm_tree_4.mts new file mode 100644 index 0000000..532745c Binary files /dev/null and b/mods/fl_trees/schems/palm_tree_4.mts differ diff --git a/mods/fl_trees/schems/palm_tree_5.mts b/mods/fl_trees/schems/palm_tree_5.mts new file mode 100644 index 0000000..532745c Binary files /dev/null and b/mods/fl_trees/schems/palm_tree_5.mts differ diff --git a/mods/fl_trees/textures/farlands_acacia_sapling.png b/mods/fl_trees/textures/farlands_acacia_sapling.png new file mode 100644 index 0000000..47dd703 Binary files /dev/null and b/mods/fl_trees/textures/farlands_acacia_sapling.png differ diff --git a/mods/fl_trees/textures/farlands_palm_sapling.png b/mods/fl_trees/textures/farlands_palm_sapling.png new file mode 100644 index 0000000..cd76853 Binary files /dev/null and b/mods/fl_trees/textures/farlands_palm_sapling.png differ