add acacia and palm trees, refactor saplings.lua

This commit is contained in:
wsor 2021-07-29 22:51:14 -04:00
parent 1429fd32f4
commit ddbd92e627
13 changed files with 37 additions and 91 deletions

View File

@ -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}}
})
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})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B