Ore generation
Ore generation
I wonder if doing this is possible as me and a friend modded diamonds, chisels and diamonds tools
It is somewhat doable, but not very fancily. Off the top of my head without any testing:
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
- IPushButton2653
- Member
- Posts: 666
- Joined: Wed Nov 16, 2011 22:47
- Location: Mississippi
- Contact:
Darn, I should've looked before I posted anything earlierceleron55 wrote:It is somewhat doable, but not very fancily. Off the top of my head without any testing:
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
Who is online
Users browsing this forum: No registered users and 36 guests