mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Merge pull request 'Add Setting to keep respawn location set if bed is destroyed.' (#3933) from Eliy21/MineClone2:no_bed_respawn_setting into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3933 Reviewed-by: chmodsayshello <chmodsayshello@hotmail.com>
This commit is contained in:
commit
2c2f5595f3
2 changed files with 8 additions and 2 deletions
|
@ -76,6 +76,7 @@ local node_search_list =
|
|||
|
||||
local success = storage:get_int("mcl_spawn_success")==1
|
||||
local searched = (storage:get_int("mcl_spawn_searched")==1) or mg_name == "v6" or mg_name == "singlenode" or minetest.settings:get("static_spawnpoint")
|
||||
local return_spawn = minetest.settings:get_bool("mcl_return_spawn", true)
|
||||
local wsp = minetest.string_to_pos(storage:get_string("mcl_spawn_world_spawn_point")) or {} -- world spawn position
|
||||
local check = storage:get_int("mcl_spawn_check") or 0
|
||||
local cp = minetest.string_to_pos(storage:get_string("mcl_spawn_cp")) or {x=start_pos.x, y=start_pos.y, z=start_pos.z}
|
||||
|
@ -498,7 +499,7 @@ function mcl_spawn.get_player_spawn_pos(player)
|
|||
|
||||
if(string.match(checknode.name, "mcl_beds:respawn_anchor_charged_")) then
|
||||
local charge_level = tonumber(string.sub(checknode.name, -1))
|
||||
if not charge_level then
|
||||
if not charge_level and return_spawn then
|
||||
minetest.log("warning","could not get level of players respawn anchor, sending him back to spawn!")
|
||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||
minetest.chat_send_player(player:get_player_name(), S("Couldn't get level of your respawn anchor!"))
|
||||
|
@ -510,10 +511,12 @@ function mcl_spawn.get_player_spawn_pos(player)
|
|||
minetest.set_node(checkpos, {name="mcl_beds:respawn_anchor"})
|
||||
return checkpos, false
|
||||
end
|
||||
else
|
||||
elseif return_spawn then
|
||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
||||
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked, and you had no charged respawn anchor!"))
|
||||
return mcl_spawn.get_world_spawn_pos(), false
|
||||
else
|
||||
return checkpos, false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,6 +51,9 @@ mcl_disabled_events (Disabled events) string
|
|||
# This setting is only read at startup.
|
||||
enable_bed_respawn (Respawn at bed) bool true
|
||||
|
||||
#If enabled, players respawn at world spawn if bed is destroyed or respawn anchor has no charge.
|
||||
mcl_return_spawn (Return to spawn if no bed) bool true
|
||||
|
||||
# How many players have to sleep to skip the night, in percent.
|
||||
# Setting to 0 will mean 1 player is always enough to skip the night. Setting above 100 will prevent skipping the night.
|
||||
# 100 by default.
|
||||
|
|
Loading…
Reference in a new issue