diff --git a/components/match2/wikis/ageofempires/match_group_input_custom.lua b/components/match2/wikis/ageofempires/match_group_input_custom.lua index a66ba7ccf8..1a64ae5caa 100644 --- a/components/match2/wikis/ageofempires/match_group_input_custom.lua +++ b/components/match2/wikis/ageofempires/match_group_input_custom.lua @@ -303,7 +303,7 @@ function CustomMatchGroupInput.getPlayersOfMapOpponent(map, opponent, opponentIn end local civs = Array.parseCommaSeparatedString(map['civs' .. opponentIndex]) - local participants, unattachedParticipants = MatchGroupInputUtil.parseParticipants( + return MatchGroupInputUtil.parseMapPlayers( opponent.match2players, players, function(playerIndex) @@ -322,11 +322,7 @@ function CustomMatchGroupInput.getPlayersOfMapOpponent(map, opponent, opponentIn } end ) - Array.forEach(unattachedParticipants, function(participant) - table.insert(participants, participant) - end) - return participants end ---@param winnerInput string|integer|nil diff --git a/components/match2/wikis/ageofempires/match_legacy.lua b/components/match2/wikis/ageofempires/match_legacy.lua index d60f5225dd..73a3cf225c 100644 --- a/components/match2/wikis/ageofempires/match_legacy.lua +++ b/components/match2/wikis/ageofempires/match_legacy.lua @@ -44,6 +44,7 @@ function MatchLegacy.storeGames(match, match2) Array.forEach(opponents, function(opponent, opponentIndex) -- opponent.players can have gaps for _, player in pairs(opponent.players) do + if Table.isEmpty(player) then return end local prefix = 'o' .. opponentIndex .. 'p' .. player.index game.extradata[prefix] = player.pageName game.extradata[prefix .. 'faction'] = player.civ diff --git a/components/match2/wikis/ageofempires/match_summary.lua b/components/match2/wikis/ageofempires/match_summary.lua index bd9a1475e8..9c518db174 100644 --- a/components/match2/wikis/ageofempires/match_summary.lua +++ b/components/match2/wikis/ageofempires/match_summary.lua @@ -14,6 +14,7 @@ local Lua = require('Module:Lua') local MapMode = require('Module:MapMode') local Operator = require('Module:Operator') local String = require('Module:StringUtils') +local Table = require('Module:Table') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -112,7 +113,10 @@ function CustomMatchSummary._createGame(game, props) :css('flex-direction', 'column') :css('overflow', 'hidden') Array.forEach( - Array.sortBy(game.opponents[opponentId].players, Operator.property('index')), + Array.sortBy( + Array.filter(game.opponents[opponentId].players, Table.isNotEmpty), + Operator.property('index') + ), function(player) display:node(createParticipant(player, opponentId == 1)) end