MESE Generation Code

Post Reply
stormrider2
Member
Posts: 83
Joined: Thu Jun 02, 2011 21:13

MESE Generation Code

by stormrider2 » Post

Can somebody show me the mese generation in lua please.

sfan5
Moderator
Posts: 4095
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

There is no Lua Code for MESE Generation.
C++ Code:

Code: Select all

PseudoRandom mineralrandom(blockseed);

        /*
            Add meseblocks
        */
        for(s16 i=0; i<approx_ground_depth/4; i++)
        {
            if(mineralrandom.next()%50 == 0)
            {
                s16 x = mineralrandom.range(node_min.X+1, node_max.X-1);
                s16 y = mineralrandom.range(node_min.Y+1, node_max.Y-1);
                s16 z = mineralrandom.range(node_min.Z+1, node_max.Z-1);
                for(u16 i=0; i<27; i++)
                {
                    v3s16 p = v3s16(x,y,z) + g_27dirs[i];
                    u32 vi = vmanip.m_area.index(p);
                    if(vmanip.m_data[vi].getContent() == c_stone)
                        if(mineralrandom.next()%8 == 0)
                            vmanip.m_data[vi] = MapNode(c_mese);
                }

            }
        }
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
IPushButton2653
Member
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi
Contact:

by IPushButton2653 » Post

There is a simple generation code in gemstones and a few other mods. It's quite easy to implement

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests