Manual spawn positioning in custom mapgen

This commit is contained in:
Olive 2022-09-18 20:26:49 +01:00
parent d86f07bb65
commit 79885681f6
1 changed files with 14 additions and 0 deletions

View File

@ -25,6 +25,20 @@ if minetest.get_mapgen_params().mgname == "singlenode" then
vm:set_data(nodes)
vm:write_to_map()
end)
-- 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
else
-- FIXME: Why dosen't node_top work properly?
minetest.register_biome({