From 78f9087c4f7d13687d3a609d06753a976995c296 Mon Sep 17 00:00:00 2001 From: Nathan Salapat Date: Mon, 2 May 2022 20:09:09 -0500 Subject: [PATCH] Ensure average players stat is never more than max player count. --- mods/lobby/stats.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/lobby/stats.lua b/mods/lobby/stats.lua index 207e257..05fb728 100644 --- a/mods/lobby/stats.lua +++ b/mods/lobby/stats.lua @@ -40,8 +40,11 @@ function lobby.retrieve_stats(map_id) local traitor = stats.winner_traitor local team = stats.winner_team local avg_players = stats.player_count - local avg = string.format("%.2f", avg_players) local max = stats.max_players or 0 + if avg_players > max then + avg_players = max + end + local avg = string.format("%.2f", avg_players) formspec = 'formspec_version[3]'.. 'size[16,9]'..