Skip to content

Commit b0ab4fb

Browse files
committedJun 18, 2013
Generate clay with register_ore()
1 parent d7784c0 commit b0ab4fb

File tree

1 file changed

+11
-35
lines changed

1 file changed

+11
-35
lines changed
 

‎mods/default/mapgen.lua

+11-35
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,17 @@ if minetest.setting_get("mg_name") == "indev" then
270270
})
271271
end
272272

273+
minetest.register_ore({
274+
ore_type = "scatter",
275+
ore = "default:clay",
276+
wherein = "default:sand",
277+
clust_scarcity = 15*15*15,
278+
clust_num_ores = 64,
279+
clust_size = 5,
280+
height_max = 0,
281+
height_min = -10,
282+
})
283+
273284
function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
274285
minetest.log('action', "WARNING: default.generate_ore is deprecated")
275286

@@ -388,41 +399,6 @@ end
388399

389400
minetest.register_on_generated(function(minp, maxp, seed)
390401
if maxp.y >= 2 and minp.y <= 0 then
391-
-- Generate clay
392-
-- Assume X and Z lengths are equal
393-
local divlen = 4
394-
local divs = (maxp.x-minp.x)/divlen+1;
395-
for divx=0+1,divs-1-1 do
396-
for divz=0+1,divs-1-1 do
397-
local cx = minp.x + math.floor((divx+0.5)*divlen)
398-
local cz = minp.z + math.floor((divz+0.5)*divlen)
399-
if minetest.get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
400-
minetest.get_node({x=cx,y=0,z=cz}).name == "default:sand" then
401-
local is_shallow = true
402-
local num_water_around = 0
403-
if minetest.get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
404-
num_water_around = num_water_around + 1 end
405-
if minetest.get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
406-
num_water_around = num_water_around + 1 end
407-
if minetest.get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
408-
num_water_around = num_water_around + 1 end
409-
if minetest.get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
410-
num_water_around = num_water_around + 1 end
411-
if num_water_around >= 2 then
412-
is_shallow = false
413-
end
414-
if is_shallow then
415-
for x1=-divlen,divlen do
416-
for z1=-divlen,divlen do
417-
if minetest.get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
418-
minetest.set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
419-
end
420-
end
421-
end
422-
end
423-
end
424-
end
425-
end
426402
-- Generate papyrus
427403
local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
428404
-- Assume X and Z lengths are equal

0 commit comments

Comments
 (0)
Please sign in to comment.