minetest.register_node("palmtree:palm_sapling", { description = "Palm Tree Sapling", drawtype = "plantlike", tiles = {"palm_sapling.png"}, inventory_image = "palm_sapling.png", wield_image = "palm_sapling.png", paramtype = "light", walkable = false, groups = {dig_immediate=3,flammable=2}, sounds = default.node_sound_defaults(), }) minetest.register_node("palmtree:palm_leaves", { drawtype = "allfaces_optional", tiles = {"palm_leaves.png"}, paramtype = "light", groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, drop = { max_items = 1, items = { { items = {'palmtree:palm_sapling'}, rarity = 20, }, } }, sounds = default.node_sound_leaves_defaults(), }) minetest.register_abm({ nodenames = {"palmtree:palm_sapling"}, interval = 60, chance = 20, action = function(pos, node) palmtree:palm_trunk(pos, "palmtree:palm_trunk", "palmtree:palm_leaves", {"default:sand"}, {["palmtree:palm_coconut"]=20}) end }) minetest.register_on_generated(function(minp, maxp, blockseed) if math.random(1, 100) > 5 then return end local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z} local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:sand"}) if pos ~= nil then palmtree:palm_trunk({x=pos.x, y=pos.y+1, z=pos.z}, "palmtree:palm_trunk", "palmtree:palm_leaves", {"default:sand"}, {["palmtree:palm_coconut"]=20}) end end) minetest.register_node("palmtree:palm_coconut", { description = "Coconut", tiles = {"palm_coconut.png"}, visual_scale = 0.5, inventory_image = "palm_coconut.png", wield_image = "palm_coconut.png", drawtype = "torchlike", paramtype = "light", sunlight_propagates = true, walkable = false, groups = {fleshy=3,dig_immediate=3,flammable=2}, sounds = default.node_sound_defaults(), })