1
0
Fork 0

Only allow multiplayer bed skip if everyone's in bed

This commit is contained in:
Wuzzy 2017-02-13 00:03:34 +01:00
parent 1eb89599bf
commit 2c282830b6
1 changed files with 2 additions and 2 deletions

View File

@ -101,14 +101,14 @@ end
local function update_formspecs(finished) local function update_formspecs(finished)
local ges = #minetest.get_connected_players() local ges = #minetest.get_connected_players()
local form_n local form_n
local is_majority = (ges / 2) < player_in_bed local all_in_bed = ges == player_in_bed
if finished then if finished then
form_n = beds.formspec .. "label[2.7,11; Good morning.]" form_n = beds.formspec .. "label[2.7,11; Good morning.]"
else else
form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) .. form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) ..
" of " .. tostring(ges) .. " players are in bed]" " of " .. tostring(ges) .. " players are in bed]"
if is_majority and is_night_skip_enabled() then if all_in_bed and is_night_skip_enabled() then
form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]" form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]"
end end
end end