forked from VoxeLibre/VoxeLibre
change mcl_spawn to support respawn anchor respawning
This commit is contained in:
parent
a52a669277
commit
6e8a826e59
|
@ -452,10 +452,33 @@ function mcl_spawn.get_player_spawn_pos(player)
|
||||||
if bgroup ~= 1 and bgroup ~= 2 then
|
if bgroup ~= 1 and bgroup ~= 2 then
|
||||||
-- Bed is destroyed:
|
-- Bed is destroyed:
|
||||||
if player and player:is_player() then
|
if player and player:is_player() then
|
||||||
player:get_meta():set_string("mcl_beds:spawn", "")
|
|
||||||
|
checkblock = minetest.string_to_pos(player:get_meta():get_string("mcl_beds:spawn"))
|
||||||
|
|
||||||
|
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_1" then
|
||||||
|
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor"})
|
||||||
|
player:set_pos(checkblock)
|
||||||
|
else
|
||||||
|
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_2" then
|
||||||
|
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor_charged_1"})
|
||||||
|
player:set_pos(checkblock)
|
||||||
|
else
|
||||||
|
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_3" then
|
||||||
|
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor_charged_2"})
|
||||||
|
player:set_pos(checkblock)
|
||||||
|
else
|
||||||
|
if minetest.get_node(checkblock).name == "mcl_beds:respawn_anchor_charged_4" then
|
||||||
|
minetest.set_node(checkblock, {name="mcl_beds:respawn_anchor_charged_3"})
|
||||||
|
player:set_pos(checkblock)
|
||||||
|
else
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Your spawn bed was missing or blocked."))
|
|
||||||
return mcl_spawn.get_world_spawn_pos(), false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Find spawning position on/near the bed free of solid or damaging blocks iterating a square spiral 15x15:
|
-- Find spawning position on/near the bed free of solid or damaging blocks iterating a square spiral 15x15:
|
||||||
|
|
Loading…
Reference in New Issue