Codebase list minetest-mod-nether / d6d388b
Move luavoxelmanip generation to master branch paramat authored 7 years ago Auke Kok committed 7 years ago
1 changed file(s) with 67 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
419419 },
420420 })
421421
422 local function replace(old, new)
423 for i=1,8 do
424 minetest.register_ore({
425 ore_type = "scatter",
426 ore = new,
427 wherein = old,
428 clust_scarcity = 1,
429 clust_num_ores = 1,
430 clust_size = 1,
431 y_min = -31000,
432 y_max = NETHER_DEPTH,
433 })
434 end
435 end
436
437 replace("default:stone", "nether:rack")
438 replace("default:stone_with_coal", "air")
439 replace("default:stone_with_iron", "air")
440 replace("default:stone_with_mese", "default:lava_source")
441 replace("default:stone_with_diamond", "default:lava_source")
442 replace("default:stone_with_gold", "nether:glowstone")
443 replace("default:stone_with_copper", "nether:sand")
444 replace("default:gravel", "nether:sand")
445 replace("default:dirt", "nether:sand")
446 replace("default:sand", "nether:sand")
447 replace("default:cobble", "nether:brick")
448 replace("default:mossycobble", "nether:brick")
449 replace("stairs:stair_cobble", "nether:brick")
422
423 -- Mapgen
424
425 local air = minetest.get_content_id("air")
426 local stone_with_coal = minetest.get_content_id("default:stone_with_coal")
427 local stone_with_iron = minetest.get_content_id("default:stone_with_iron")
428 local stone_with_mese = minetest.get_content_id("default:stone_with_mese")
429 local stone_with_diamond = minetest.get_content_id("default:stone_with_diamond")
430 local stone_with_gold = minetest.get_content_id("default:stone_with_gold")
431 local stone_with_copper = minetest.get_content_id("default:stone_with_copper")
432 local gravel = minetest.get_content_id("default:gravel")
433 local dirt = minetest.get_content_id("default:dirt")
434 local sand = minetest.get_content_id("default:sand")
435 local cobble = minetest.get_content_id("default:cobble")
436 local mossycobble = minetest.get_content_id("default:mossycobble")
437 local stair_cobble = minetest.get_content_id("stairs:stair_cobble")
438 local lava_source = minetest.get_content_id("default:lava_source")
439 local lava_flowing = minetest.get_content_id("default:lava_flowing")
440
441 local glowstone = minetest.get_content_id("nether:glowstone")
442 local nethersand = minetest.get_content_id("nether:sand")
443 local netherbrick = minetest.get_content_id("nether:brick")
444 local netherrack = minetest.get_content_id("nether:rack")
445
446 minetest.register_on_generated(function(minp, maxp, seed)
447 if maxp.y > NETHER_DEPTH then
448 return
449 end
450
451 local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
452 local data = vm:get_data()
453 local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
454
455 for vi in area:iterp(minp, maxp) do
456 local id = data[vi]
457 if id == air or
458 id == stone_with_coal or
459 id == stone_with_iron then
460 data[vi] = air
461 elseif id == stone_with_mese or
462 id == stone_with_diamond or
463 id == lava_source then
464 data[vi] = lava_source
465 elseif id == lava_flowing then
466 -- nothing
467 elseif id == stone_with_gold then
468 data[vi] = glowstone
469 elseif id == stone_with_copper or
470 id == gravel or
471 id == dirt or
472 id == sand then
473 data[vi] = nethersand
474 elseif id == cobble or
475 id == mossycobble or
476 id == stair_cobble then
477 data[vi] = netherbrick
478 else
479 data[vi] = netherrack
480 end
481 end
482
483 vm:set_data(data)
484 vm:set_lighting({day = 0, night = 0})
485 vm:calc_lighting()
486 vm:update_liquids()
487 vm:write_to_map()
488 end)