2022-09-18 01:24:54 +02:00
|
|
|
|
|
|
|
if minetest.get_mapgen_params().mgname == "singlenode" then
|
|
|
|
local ground_level = tonumber(minetest.settings:get("water_level") or 1)
|
2022-09-18 11:29:29 +02:00
|
|
|
local air = minetest.get_content_id("air")
|
|
|
|
local stone = minetest.get_content_id("minecraft:stone")
|
|
|
|
local grass = minetest.get_content_id("minecraft:grass")
|
2022-09-18 01:24:54 +02:00
|
|
|
|
|
|
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
|
|
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
|
|
|
local va = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
|
|
|
|
|
|
|
local nodes = vm:get_data()
|
|
|
|
|
|
|
|
for i, _ in pairs(nodes) do
|
|
|
|
local y = va:position(i).y
|
|
|
|
if y < ground_level then
|
|
|
|
nodes[i] = stone
|
|
|
|
elseif y == ground_level then
|
|
|
|
nodes[i] = grass
|
|
|
|
else
|
|
|
|
nodes[i] = air
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
vm:set_data(nodes)
|
|
|
|
vm:write_to_map()
|
|
|
|
end)
|
2022-09-18 21:26:49 +02:00
|
|
|
|
|
|
|
-- see https://github.com/minetest/minetest/issues/12782
|
|
|
|
if not minetest.settings:get("static_spawnpoint") then
|
|
|
|
local spawnpos = vector.new(0, ground_level+1, 0)
|
|
|
|
minetest.register_on_joinplayer(function(player, lastlogin)
|
|
|
|
if not lastlogin then
|
|
|
|
player:set_pos(spawnpos)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
minetest.register_on_respawnplayer(function(player)
|
|
|
|
player:set_pos(spawnpos)
|
|
|
|
return true
|
|
|
|
end)
|
|
|
|
end
|
2022-09-18 01:24:54 +02:00
|
|
|
else
|
2022-09-18 11:29:29 +02:00
|
|
|
-- FIXME: Why dosen't node_top work properly?
|
2022-09-18 01:24:54 +02:00
|
|
|
minetest.register_biome({
|
|
|
|
name = "cavegame",
|
2022-09-18 11:29:29 +02:00
|
|
|
node_dust = "minecraft:grass",
|
|
|
|
-- node_top = "minecraft:grass",
|
|
|
|
-- depth_top = 1,
|
2022-09-18 01:24:54 +02:00
|
|
|
node_stone = "minecraft:stone",
|
|
|
|
heat_point = 50,
|
|
|
|
humidity_point = 50,
|
|
|
|
y_min = -3100, y_max = 3100,
|
|
|
|
})
|
|
|
|
end
|