Tweak spawning algorithm

This commit is contained in:
Wuzzy 2019-03-08 05:12:31 +01:00
parent daed3059bf
commit 9057743eb8
1 changed files with 7 additions and 0 deletions

View File

@ -20,10 +20,17 @@ mcl_spawn.get_spawn_pos = function(player)
spawn = minetest.setting_get_pos("static_spawnpoint") spawn = minetest.setting_get_pos("static_spawnpoint")
custom_spawn = false custom_spawn = false
end end
-- We are getting desperate ...
-- Use the first spawn point of the player
if not spawn or spawn == "" then if not spawn or spawn == "" then
local attr = player:get_meta():get_string("mcl_spawn:first_spawn") local attr = player:get_meta():get_string("mcl_spawn:first_spawn")
if attr ~= nil and attr ~= "" then if attr ~= nil and attr ~= "" then
-- Adjust Y
spawn = minetest.string_to_pos(attr) spawn = minetest.string_to_pos(attr)
local y = minetest.get_spawn_level(spawn.x, spawn.z)
if y then
spawn.y = y
end
custom_spawn = false custom_spawn = false
end end
end end