update to allow flatland
This commit is contained in:
parent
d4c9cc79bb
commit
e76850dd1a
@ -8,6 +8,9 @@ License: GPLv3
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
|
||||||
|
-- alias mapgen_* to air
|
||||||
|
if minetest.setting_getbool("mapgen_disabled") then
|
||||||
minetest.register_alias("mapgen_air", "air")
|
minetest.register_alias("mapgen_air", "air")
|
||||||
minetest.register_alias("mapgen_stone", "air")
|
minetest.register_alias("mapgen_stone", "air")
|
||||||
minetest.register_alias("mapgen_tree", "air")
|
minetest.register_alias("mapgen_tree", "air")
|
||||||
@ -33,6 +36,37 @@ minetest.register_alias("mapgen_cactus", "air")
|
|||||||
minetest.register_alias("mapgen_torch", "air")
|
minetest.register_alias("mapgen_torch", "air")
|
||||||
minetest.register_alias("mapgen_nyancat", "air")
|
minetest.register_alias("mapgen_nyancat", "air")
|
||||||
minetest.register_alias("mapgen_nyancat_rainbow", "air")
|
minetest.register_alias("mapgen_nyancat_rainbow", "air")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- after generated, make the world flat
|
||||||
|
if minetest.setting_getbool("mapgen_flat") then
|
||||||
|
minetest.register_on_generated(function(minp, maxp)
|
||||||
|
for x = minp.x, maxp.x do
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
for ly = minp.y, maxp.y do
|
||||||
|
local y = maxp.y + minp.y - ly
|
||||||
|
local p = {x = x, y = y, z = z}
|
||||||
|
-- set middle node to dirt_with_grass
|
||||||
|
if y == 0 then
|
||||||
|
minetest.env:add_node(p, {name="default:default:dirt_with_grass"})
|
||||||
|
end
|
||||||
|
-- set bottom nodes to stone
|
||||||
|
if y < 0 then
|
||||||
|
minetest.env:add_node(p, {name="default:stone"})
|
||||||
|
end
|
||||||
|
-- if mapgen is enabled, remove top nodes
|
||||||
|
if not minetest.setting_getbool("mapgen_disabled") then
|
||||||
|
if y > 0 then
|
||||||
|
minetest.env:remove_node(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- log that we started
|
-- log that we started
|
||||||
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded from "..minetest.get_modpath(minetest.get_current_modname()))
|
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded from "..minetest.get_modpath(minetest.get_current_modname()))
|
Loading…
x
Reference in New Issue
Block a user