Page 1 of 1

Generating Apple like fruit

PostPosted: Sun Aug 12, 2012 21:28
by rubenwardy
Can someone point me in the direction on how to use the map generator to register orange trees.

I am making a server-safe, low cpu food mod.

PostPosted: Sun Aug 12, 2012 23:40
by cornernote
i think apples only grow from planted saplings.

PostPosted: Mon Aug 13, 2012 16:51
by rubenwardy
This almost looks like it, but it is on drop

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("default:leaves", {
    description = "Leaves",
    drawtype = "allfaces_optional",
    visual_scale = 1.3,
    tiles = {"default_leaves.png"},
    paramtype = "light",
    groups = {snappy=3, leafdecay=3, flammable=2},
    drop = {
        max_items = 1,
        items = {
            {
                -- player will get sapling with 1/20 chance
                items = {'default:sapling'},
                rarity = 20,
            },
            {
                -- player will get leaves only if he get no saplings,
                -- this is because max_items is 1
                items = {'default:leaves'},
            }
        }
    },
    sounds = default.node_sound_leaves_defaults(),
})

PostPosted: Tue Aug 14, 2012 00:03
by cornernote
no, thats for normal leaves (you get a chance at getting a sapling).

I had a look through the LUA code and I cant see where it generates an apple tree. I know it happens with a % chance after planting a sapling when it turns into a tree.

PostPosted: Tue Aug 14, 2012 00:07
by cornernote