Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The player's kick fails when there are several teams in the lobby. #6219

Closed
GodFuper opened this issue May 29, 2024 · 2 comments · Fixed by #6222
Closed

The player's kick fails when there are several teams in the lobby. #6219

GodFuper opened this issue May 29, 2024 · 2 comments · Fixed by #6222
Assignees
Labels
area: lobby related to lobby: options, chat, etc type: bug

Comments

@GodFuper
Copy link
Contributor

if obsIndex > 0 and gameInfo.Observers[obsIndex].OwnerID != localPlayerID then

Describe the bug
The kick observer with index 0 fails.

To Reproduce
Put multiple players in Observers. And try to kick it at the top one.

Expected behavior
A window with "Are you sure?" should appear. So that you can kick.

Screenshots
Анимация6

@GodFuper
Copy link
Contributor Author

изображение
If there are 2 teams in lobby, then you will not be able to kick the first 2 Observers.
The whole function needs to be reviewed, as it does not work correctly.

fa/lua/ui/lobby/lobby.lua

Lines 4351 to 4364 in 6625471

local teams = {}
local numTeams = 0
for i, player in gameInfo.PlayerOptions:pairs() do
if not teams[player.Team] and player.Team != 1 then
teams[player.Team] = 1
numTeams = numTeams + 1
end
end
-- adjust index by 1 because base 0 vs 1, and adjust index by 0-2 to account for team rating rows
-- (if there's fewer than 3 teams, the team rating rows are listed before observers instead of after)
local obsIndex = row + 1
if numTeams < 3 then
obsIndex = obsIndex - numTeams
end

@GodFuper GodFuper changed the title The kick observer with index 0 fails. The player's kick fails when there are several teams in the lobby. May 29, 2024
@Garanas Garanas added type: bug area: lobby related to lobby: options, chat, etc labels May 30, 2024
@Garanas
Copy link
Member

Garanas commented May 30, 2024

Best bug report of the season 👍 , @4z0t or @lL1l1 would either of you have time to look into it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: lobby related to lobby: options, chat, etc type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants