don't show results for 1-player "games"

This commit is contained in:
whosit 2024-11-26 22:22:40 +03:00
parent 02583495f1
commit fd6e44e29c

View File

@ -47,7 +47,11 @@ yl_snowball.update_hud = function(player)
local game = games_by_player[player_name]
local text = ""
if game then
text = game:get_info_string(true)
if game.player_num > 1 then
text = game:get_info_string(true)
else
text = ""
end
else
game_hud:set_enabled(player, false)
end
@ -107,6 +111,7 @@ function Game:new()
self.time_started = current_time
self.time_last_action = current_time
self.players = {}
self.player_num = 0
active_games[self] = true
return self
end
@ -149,6 +154,7 @@ function Game:add_player(player_name, game_player)
end
self.players[player_name] = game_player
games_by_player[player_name] = self
self.player_num = self.player_num + 1
end
@ -202,9 +208,11 @@ function Game:stop()
self:get_info_string(),
}
for p_name, player in pairs(self.players) do
if get_player_participation(p_name) then
core.chat_send_player(p_name, table.concat(lines, "\n"))
if self.player_num > 1 then
for p_name, player in pairs(self.players) do
if get_player_participation(p_name) then
core.chat_send_player(p_name, table.concat(lines, "\n"))
end
end
end