From eb658a49962a699ebd7dd10f9b34ede39bb88a66 Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Mon, 11 Sep 2023 19:38:33 +0000 Subject: [PATCH 1/2] Update mods/PLAYER/mcl_spawn/init.lua Add if then condition for no bed/anchor respawn settings --- mods/PLAYER/mcl_spawn/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/mcl_spawn/init.lua b/mods/PLAYER/mcl_spawn/init.lua index eb0208dcb..89ededeed 100644 --- a/mods/PLAYER/mcl_spawn/init.lua +++ b/mods/PLAYER/mcl_spawn/init.lua @@ -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 From 2d9bffaa43fb2f805edf7039767a3156b9abdd4e Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Mon, 11 Sep 2023 19:42:04 +0000 Subject: [PATCH 2/2] Update settingtypes.txt Add the no bed respawn in settings --- settingtypes.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/settingtypes.txt b/settingtypes.txt index c5d5d32c1..8123ca9d9 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -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.