planetoids/mapgen.lua

28 lines
576 B
Lua
Raw Normal View History

2018-10-31 02:47:44 -07:00
2019-05-08 12:16:23 -07:00
local has_vacuum_mod = minetest.get_modpath("vacuum")
2018-06-20 09:06:48 -07:00
minetest.register_on_generated(function(minp, maxp, seed)
2018-08-23 04:58:35 -07:00
-- default from 6k to 10k
if minp.y < planetoids.miny or minp.y > planetoids.maxy then
2018-06-20 09:06:48 -07:00
return
end
2019-05-08 12:16:23 -07:00
if has_vacuum_mod and not vacuum.is_mapgen_block_in_space(minp, maxp) then
-- no vacuum there, don't generate planetoids in non-vacuum
return
end
2018-06-20 09:06:48 -07:00
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
2019-05-08 10:06:25 -07:00
planetoids.mapgen_oreplanet(minp, maxp, vm, area)
2018-06-20 09:06:48 -07:00
vm:write_to_map()
end)