Generating Apple like fruit

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Generating Apple like fruit

by rubenwardy » Sun Aug 12, 2012 21:28

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.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Sun Aug 12, 2012 23:40

i think apples only grow from planted saplings.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Mon Aug 13, 2012 16:51

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(),
})
Last edited by rubenwardy on Mon Aug 13, 2012 17:08, edited 1 time in total.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Aug 14, 2012 00:03

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.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Aug 14, 2012 00:07

 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 54 guests

cron