Ore generation

Evrim
Member
 
Posts: 42
Joined: Fri May 06, 2011 16:45

Ore generation

by Evrim » Sun Dec 04, 2011 08:11

I wonder if doing this is possible as me and a friend modded diamonds, chisels and diamonds tools
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Sun Dec 04, 2011 12:28

I hope it is, otherwise I wont be able to add emeralds
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

Evrim
Member
 
Posts: 42
Joined: Fri May 06, 2011 16:45

by Evrim » Sun Dec 04, 2011 16:43

The thing is that everything is ready and if we can't find a way to do it all the work will be nothing
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sun Dec 04, 2011 17:39

It is somewhat doable, but not very fancily. Off the top of my head without any testing:

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_on_generated(function(minp, maxp))
    local amount = math.random(0, 50)
    for a=0,amount do
        local pos = {
            x = math.random(minp.x, maxp.x),
            y = math.random(minp.y, maxp.y),
            z = math.random(minp.z, maxp.z),
        }
        for i=-1,1 do
            for j=-1,1 do
                for k=-1,1 do
                    if math.random() > 0.2 then
                        continue
                    end
                    local p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
                    local n = minetest.env:get_node(p)
                    if n.name == "default:stone" then
                        minetest.env:add_node(p, {name="yourmod:stone_with_yourmineral"})
                    end
                end
            end
        end
    end
end
 

Evrim
Member
 
Posts: 42
Joined: Fri May 06, 2011 16:45

by Evrim » Sun Dec 04, 2011 19:05

I got some unexpected paranthesis error...
 

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

by IPushButton2653 » Sun Feb 19, 2012 03:51

celeron55 wrote:It is somewhat doable, but not very fancily. Off the top of my head without any testing:

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_on_generated(function(minp, maxp))
    local amount = math.random(0, 50)
    for a=0,amount do
        local pos = {
            x = math.random(minp.x, maxp.x),
            y = math.random(minp.y, maxp.y),
            z = math.random(minp.z, maxp.z),
        }
        for i=-1,1 do
            for j=-1,1 do
                for k=-1,1 do
                    if math.random() > 0.2 then
                        continue
                    end
                    local p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
                    local n = minetest.env:get_node(p)
                    if n.name == "default:stone" then
                        minetest.env:add_node(p, {name="yourmod:stone_with_yourmineral"})
                    end
                end
            end
        end
    end
end

Darn, I should've looked before I posted anything earlier
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 21 guests

cron