Don't skip night if not all players are asleep

This commit is contained in:
Wuzzy 2019-02-20 16:18:13 +01:00
parent 8982e368ec
commit 3b8fe6039e

View File

@ -161,6 +161,9 @@ local function lay_down(player, pos, bed_pos, state, skip)
end
local function update_formspecs(finished)
if is_sp then
return
end
local ges = #minetest.get_connected_players()
local form_n
local all_in_bed = ges == player_in_bed
@ -272,10 +275,10 @@ function mcl_beds.on_rightclick(pos, player)
-- skip the night and let all players stand up
if check_in_beds() then
minetest.after(5, function()
if not is_sp then
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
end
mcl_beds.sleep()
end
end)
end
end
@ -294,8 +297,10 @@ minetest.register_on_leaveplayer(function(player)
mcl_beds.player[name] = nil
if check_in_beds() then
minetest.after(5, function()
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end
end)
end
end)