diff --git a/lua/ui/lobby/autolobby/AutolobbyController.lua b/lua/ui/lobby/autolobby/AutolobbyController.lua index 364fc8df4a..bde40e8b14 100644 --- a/lua/ui/lobby/autolobby/AutolobbyController.lua +++ b/lua/ui/lobby/autolobby/AutolobbyController.lua @@ -294,6 +294,44 @@ AutolobbyCommunications = Class(MohoLobbyMethods, AutolobbyServerCommunicationsC return 'Ready' end, + ---@param self UIAutolobbyCommunications + ---@param playerOptions UIAutolobbyPlayer[] + ---@return table + CreateRatingsTable = function(self, playerOptions) + ---@type table + local allRatings = {} + + for slot, options in pairs(playerOptions) do + if options.Human and options.PL then + allRatings[options.PlayerName] = options.PL + end + end + + return allRatings + end, + + ---@param self UIAutolobbyCommunications + ---@param playerOptions UIAutolobbyPlayer[] + ---@return table + CreateDivisionsTable = function(self, playerOptions) + ---@type table + local allDivisions = {} + + for slot, options in pairs(playerOptions) do + if options.Human and options.PL then + if options.DIV ~= "unlisted" then + local division = options.DIV + if options.SUBDIV and options.SUBDIV ~="" then + division = division .. ' ' .. options.SUBDIV + end + allDivisions[options.PlayerName]= division + end + end + end + + return allDivisions + end, + --- Verifies whether we can launch the game. ---@param self UIAutolobbyCommunications ---@param peerStatus UIAutolobbyStatus @@ -488,6 +526,11 @@ AutolobbyCommunications = Class(MohoLobbyMethods, AutolobbyServerCommunicationsC self:SendPlayerOptionToServer(ownerId, 'Faction', playerOptions.Faction) end + -- tuck them into the game options. By all means a hack, but + -- this way they are available in both the sim and the UI + self.GameOptions.Ratings = self:CreateRatingsTable(self.PlayerOptions) + self.GameOptions.Divisions = self:CreateDivisionsTable(self.PlayerOptions) + -- create game configuration local gameConfiguration = { GameMods = self.GameMods, @@ -496,7 +539,7 @@ AutolobbyCommunications = Class(MohoLobbyMethods, AutolobbyServerCommunicationsC Observers = {}, } - -- send it to all players and tell them to launch + -- send it to all players and tell them to launch with the configuration self:BroadcastData({ Type = "Launch", GameConfig = gameConfiguration }) self:LaunchGame(gameConfiguration) end diff --git a/scripts/LaunchFAInstances.ps1 b/scripts/LaunchFAInstances.ps1 index 8a22fca4a6..4bbf86f207 100644 --- a/scripts/LaunchFAInstances.ps1 +++ b/scripts/LaunchFAInstances.ps1 @@ -91,7 +91,7 @@ if ($players -eq 1) { $hostLogFile = "host_dev_1.log" $hostFaction = $factions | Get-Random $hostTeamArgument = Get-TeamArgument -instanceNumber 0 - $hostArguments = "/log $hostLogFile /showlog /hostgame $hostProtocol $port $hostPlayerName $gameName $map /startspot 1 /players $players /$hostFaction $hostTeamArgument $baseArguments" + $hostArguments = "/log $hostLogFile /showlog /hostgame $hostProtocol $port $hostPlayerName $gameName $map /startspot 1 /players $players /$hostFaction $hostTeamArgument $baseArguments /division HostDivision /subdivision 1" # Launch host game instance Launch-GameInstance -instanceNumber 1 -xPos 0 -yPos 0 -arguments $hostArguments @@ -107,7 +107,7 @@ if ($players -eq 1) { $clientPlayerName = "ClientPlayer_$($i + 1)" $clientFaction = $factions | Get-Random $clientTeamArgument = Get-TeamArgument -instanceNumber $i - $clientArguments = "/log $clientLogFile /joingame $hostProtocol localhost:$port $clientPlayerName /startspot $($i + 1) /players $players /$clientFaction $clientTeamArgument $baseArguments" + $clientArguments = "/log $clientLogFile /joingame $hostProtocol localhost:$port $clientPlayerName /startspot $($i + 1) /players $players /$clientFaction $clientTeamArgument $baseArguments /division Diamond /subdivision $($i + 1)" Launch-GameInstance -instanceNumber ($i + 1) -xPos $xPos -yPos $yPos -arguments $clientArguments }