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
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
Users browsing this forum: No registered users and 14 guests