mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Don't show bed msg if player respawns w/o bed
This commit is contained in:
parent
cfdcd63f3c
commit
5897d07435
1 changed files with 9 additions and 4 deletions
|
@ -2,21 +2,26 @@ mcl_spawn = {}
|
||||||
|
|
||||||
-- Returns current spawn position of player.
|
-- Returns current spawn position of player.
|
||||||
-- If player is nil or not a player, the default spawn point is returned.
|
-- If player is nil or not a player, the default spawn point is returned.
|
||||||
|
-- The second return value is true if spawn point is player-chosen,
|
||||||
|
-- false otherwise.
|
||||||
mcl_spawn.get_spawn_pos = function(player)
|
mcl_spawn.get_spawn_pos = function(player)
|
||||||
local spawn
|
local spawn, custom_spawn
|
||||||
if player ~= nil and player:is_player() then
|
if player ~= nil and player:is_player() then
|
||||||
spawn = minetest.string_to_pos(player:get_attribute("mcl_beds:spawn"))
|
spawn = minetest.string_to_pos(player:get_attribute("mcl_beds:spawn"))
|
||||||
|
custom_spawn = true
|
||||||
end
|
end
|
||||||
if not spawn or spawn == "" then
|
if not spawn or spawn == "" then
|
||||||
spawn = minetest.setting_get_pos("static_spawnpoint")
|
spawn = minetest.setting_get_pos("static_spawnpoint")
|
||||||
|
custom_spawn = false
|
||||||
end
|
end
|
||||||
if not spawn then
|
if not spawn then
|
||||||
spawn = { x=0, y=0, z=0 }
|
spawn = { x=0, y=0, z=0 }
|
||||||
if mg_name == "flat" then
|
if mg_name == "flat" then
|
||||||
spawn.y = mcl_vars.mg_bedrock_overworld_max + 5
|
spawn.y = mcl_vars.mg_bedrock_overworld_max + 5
|
||||||
end
|
end
|
||||||
|
custom_spawn = false
|
||||||
end
|
end
|
||||||
return spawn
|
return spawn, custom_spawn
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sets the player's spawn position to pos.
|
-- Sets the player's spawn position to pos.
|
||||||
|
@ -31,8 +36,8 @@ end
|
||||||
|
|
||||||
-- Respawn player at specified respawn position
|
-- Respawn player at specified respawn position
|
||||||
minetest.register_on_respawnplayer(function(player)
|
minetest.register_on_respawnplayer(function(player)
|
||||||
local pos = mcl_spawn.get_spawn_pos(player)
|
local pos, custom_spawn = mcl_spawn.get_spawn_pos(player)
|
||||||
if pos then
|
if custom_spawn then
|
||||||
-- Check if bed is still there
|
-- Check if bed is still there
|
||||||
-- and the spawning position is free of solid or damaging blocks.
|
-- and the spawning position is free of solid or damaging blocks.
|
||||||
local node_bed = minetest.get_node(pos)
|
local node_bed = minetest.get_node(pos)
|
||||||
|
|
Loading…
Reference in a new issue