From 8cbea205fd1dd2f7f67e9baee84e7f7f9e24f407 Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:56:25 +0200 Subject: [PATCH] Adjust sc/sc2 parsing of team player variables (#3362) * Update match_group_input_starcraft.lua * white space --- .../match_group_input_starcraft.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua index 57b3761c932..dd9b9ed6f8f 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua @@ -622,16 +622,20 @@ end function StarcraftMatchGroupInput._getPlayersFromVariables(teamName) local players = {} for playerIndex = 1, _MAX_NUM_PLAYERS do - local name = Variables.varDefault(teamName .. '_p' .. playerIndex) + local prefix = teamName .. '_p' .. playerIndex + local name = Variables.varDefault(prefix) if Logic.isNotEmpty(name) then ---@cast name -nil - local flag = Variables.varDefault(teamName .. '_p' .. playerIndex .. 'flag') - players[playerIndex] = { + local player = { name = name:gsub(' ', '_'), - displayname = Variables.varDefault(teamName .. '_p' .. playerIndex .. 'display'), - flag = Flags.CountryName(flag), - extradata = {faction = Variables.varDefault(teamName .. '_p' .. playerIndex .. 'race')} + displayname = Variables.varDefault(prefix .. 'dn'), + flag = Flags.CountryName(Variables.varDefault(prefix .. 'flag')), + extradata = {faction = Variables.varDefault(prefix .. 'race')} } + if player.displayname then + Variables.varDefine(player.displayname .. '_page', player.name) + end + table.insert(players, player) else break end