Merge pull request 'Fix "sleeping player hud" sometimes showing decimal numbers' (#4038) from player_sleeping_hudfix into master

Reviewed-on: MineClone2/MineClone2#4038
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
chmodsayshello 2023-12-02 19:37:05 +00:00
commit 4b63ff1c2a
1 changed files with 1 additions and 1 deletions

View File

@ -385,7 +385,7 @@ function mcl_beds.on_rightclick(pos, player, is_top)
mcl_title.set(player, "actionbar", {text=message, color="white", stay=60}) mcl_title.set(player, "actionbar", {text=message, color="white", stay=60})
else -- someone just successfully entered a bed else -- someone just successfully entered a bed
local connected_players = minetest.get_connected_players() local connected_players = minetest.get_connected_players()
local sleep_hud_message = S("@1/@2 players currently in bed.", player_in_bed, players_in_bed_setting() * #connected_players / 100) local sleep_hud_message = S("@1/@2 players currently in bed.", player_in_bed, math.ceil(players_in_bed_setting() * #connected_players / 100))
for _, player in pairs(connected_players) do for _, player in pairs(connected_players) do
if not mcl_beds.player[player:get_player_name()] then -- only send message to players not sleeping. if not mcl_beds.player[player:get_player_name()] then -- only send message to players not sleeping.
if mcl_title.params_get(player) then mcl_title.clear(player) end -- clear, old message is still being displayed if mcl_title.params_get(player) then mcl_title.clear(player) end -- clear, old message is still being displayed