Update beds formspecs when player joins or leaves the game

This commit is contained in:
Athozus 2024-08-07 15:55:44 +02:00
parent 88ecab34d9
commit 0177fa3a01
No known key found for this signature in database
GPG key ID: B50895022E8484BF

View file

@ -254,12 +254,18 @@ if enable_respawn then
end) end)
end end
minetest.register_on_joinplayer(function(player)
update_formspecs(false)
end)
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
lay_down(player, nil, nil, false, true) lay_down(player, nil, nil, false, true)
beds.player[name] = nil beds.player[name] = nil
if check_in_beds() then if check_in_beds() then
schedule_update() schedule_update()
else
update_formspecs(false)
end end
end) end)