slighty optimize the code

This commit is contained in:
kay27 2020-07-30 03:59:30 +04:00 committed by Wuzzy
parent 92385364e5
commit 64f9e39ebd

@ -202,13 +202,8 @@ local function lay_down(player, pos, bed_pos, state, skip)
return true return true
end end
local function update_formspecs(finished, players) local function update_formspecs(finished, ges)
local ges local ges = ges or #minetest.get_connected_players()
if players then
ges = #players
else
ges = #minetest.get_connected_players()
end
local form_n = "size[6,5;true]" local form_n = "size[6,5;true]"
local all_in_bed = ges == player_in_bed local all_in_bed = ges == player_in_bed
local night_skip = is_night_skip_enabled() local night_skip = is_night_skip_enabled()
@ -384,7 +379,7 @@ minetest.register_on_leaveplayer(function(player)
end end
end) end)
end end
update_formspecs(false, players) update_formspecs(false, #players)
end) end)
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)