I had the sapling working to a point I planted one only to chuckle seeing an apple tree appear. I commented that out and I also dug around plant_lib and moretrees. New code makes the sapling disappear after a while. May the growtree function work but I am using the wrong options?
plant_lib and moretrees are somewhat complex mods I don't see any examples that show how individual functions work together.
The last alternative I think might be trying to fork moretrees and replace or add the one I want. The problem doing that is I want my mod to be somewhat independent being able to interact with everything and mods that's already loaded. Also not really interested in a biome for this tree since I want my particular imaging of the blossom to go with the theme of my mod.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node("mochathicket:mocha_blossom_leaves", {
description = "Mocha Blossom Leaves",
drawtype = "allfaces_optional",
waving = moretrees_new_leaves_waving,
visual_scale = moretrees_plantlike_leaves_visual_scale,
tiles = { "mocha_blossom_leaves.png" },
inventory_image = "mocha_blossom_leaves.png",
paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1},
sounds = default.node_sound_leaves_defaults(),
drop = {
max_items = 1,
items = {
{items = {"mochathicket:mocha_blossom_sapling"}, 20 },
{items = {"mochathicket:mocha_blossom_leaves"} }
}
},
})
minetest.register_node("mochathicket:mocha_blossom_trunk", {
description = "Mocha Blossom Trunk",
tiles = {
"mocha_blossom_trunk_top.png",
"mocha_blossom_trunk_top.png",
"mocha_blossom_trunk.png"
},
paramtype2 = "facedir",
is_ground_content = true,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
})
minetest.register_node("mochathicket:mocha_blossom_planks", {
description = "Mocha Blossom Planks",
tiles = {"mocha_blossom_wood.png"},
is_ground_content = true,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("mochathicket:mocha_blossom_sapling", {
description = "Mocha Blossom Sapling",
drawtype = "plantlike",
tiles = {"mocha_blossom_sapling.png"},
inventory_image = "mocha_blossom_sapling.png",
paramtype = "light",
paramtype2 = "waving",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
sounds = default.node_sound_defaults(),
})
mocha_blossom_model={
axiom="FFFFFdddccA/FFFFFFcA/FFFFFFcB",
rules_a="[&&&dddd^^ddddddd][&&&---dddd^^ddddddd][&&&+++dddd^^ddddddd][&&&++++++dddd^^ddddddd]",
rules_b="[&&&ddd^^ddddd][&&&---ddd^^ddddd][&&&+++ddd^^ddddd][&&&++++++ddd^^ddddd]",
rules_c="/",
rules_d="F",
trunk="mocha_blossom_trunk",
leaves="mocha_blossom_leaves",
angle=30,
iterations=2,
random_level=0,
trunk_type="single",
thin_branches=true
}
function grow_mocha_blossom(pos)
minetest.remove_node(pos)
if math.random(1,2) == 1 then
minetest.spawn_tree(pos, mocha_blossom_model)
else
minetest.spawn_tree(pos, mocha_blossom_model)
end
end
plantslib:grow_plants({
grow_delay = 2,
grow_chance = 4,
grow_plant = "mochathicket:mocha_blossom_sapling",
grow_nodes = "default:dirt_with_grass",
grow_function = "grow_mocha_blossom"
})
--[=====[
minetest.register_abm({
nodenames = {"mochathicket:mocha_blossom_sapling"},
interval = 10,
chance = 50,
action = function(pos, node)
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
if is_soil == nil or is_soil == 0 then return end
print("A mocha blossom sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
local data = vm:get_data()
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
})
--]=====]