mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Fix beds #798 attempt 5
This commit is contained in:
parent
50fa36aa2c
commit
92385364e5
1 changed files with 16 additions and 4 deletions
|
@ -202,8 +202,13 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
return true
|
||||
end
|
||||
|
||||
local function update_formspecs(finished)
|
||||
local ges = #minetest.get_connected_players()
|
||||
local function update_formspecs(finished, players)
|
||||
local ges
|
||||
if players then
|
||||
ges = #players
|
||||
else
|
||||
ges = #minetest.get_connected_players()
|
||||
end
|
||||
local form_n = "size[6,5;true]"
|
||||
local all_in_bed = ges == player_in_bed
|
||||
local night_skip = is_night_skip_enabled()
|
||||
|
@ -364,7 +369,14 @@ end)
|
|||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
lay_down(player, nil, nil, false, true)
|
||||
if check_in_beds() then
|
||||
players = minetest.get_connected_players()
|
||||
for n, player in ipairs(players) do
|
||||
if player:get_player_name() == name then
|
||||
players[n] = nil
|
||||
break
|
||||
end
|
||||
end
|
||||
if check_in_beds(players) then
|
||||
minetest.after(5, function()
|
||||
if check_in_beds() then
|
||||
update_formspecs(is_night_skip_enabled())
|
||||
|
@ -372,7 +384,7 @@ minetest.register_on_leaveplayer(function(player)
|
|||
end
|
||||
end)
|
||||
end
|
||||
update_formspecs(false)
|
||||
update_formspecs(false, players)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
|
Loading…
Reference in a new issue