Don't skip night if not all players are asleep
This commit is contained in:
parent
8982e368ec
commit
3b8fe6039e
|
@ -161,6 +161,9 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update_formspecs(finished)
|
local function update_formspecs(finished)
|
||||||
|
if is_sp then
|
||||||
|
return
|
||||||
|
end
|
||||||
local ges = #minetest.get_connected_players()
|
local ges = #minetest.get_connected_players()
|
||||||
local form_n
|
local form_n
|
||||||
local all_in_bed = ges == player_in_bed
|
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
|
-- skip the night and let all players stand up
|
||||||
if check_in_beds() then
|
if check_in_beds() then
|
||||||
minetest.after(5, function()
|
minetest.after(5, function()
|
||||||
if not is_sp then
|
if check_in_beds() then
|
||||||
update_formspecs(is_night_skip_enabled())
|
update_formspecs(is_night_skip_enabled())
|
||||||
end
|
|
||||||
mcl_beds.sleep()
|
mcl_beds.sleep()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -294,8 +297,10 @@ minetest.register_on_leaveplayer(function(player)
|
||||||
mcl_beds.player[name] = nil
|
mcl_beds.player[name] = nil
|
||||||
if check_in_beds() then
|
if check_in_beds() then
|
||||||
minetest.after(5, function()
|
minetest.after(5, function()
|
||||||
|
if check_in_beds() then
|
||||||
update_formspecs(is_night_skip_enabled())
|
update_formspecs(is_night_skip_enabled())
|
||||||
mcl_beds.sleep()
|
mcl_beds.sleep()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue