88 GameMode ,
99 GameType ,
1010 HumansVsNations ,
11- PublicGameModifier ,
1211 Quads ,
1312 Trios ,
1413} from "../core/game/Game" ;
@@ -93,41 +92,31 @@ export class MapPlaylist {
9392 const playerTeams =
9493 mode === GameMode . Team ? this . getTeamCount ( ) : undefined ;
9594
96- let publicGameModifiers = config . getRandomPublicGameModifiers ( ) ;
95+ let { isCompact , isRandomSpawn } = config . getRandomPublicGameModifiers ( ) ;
9796
9897 // Duos, Trios, and Quads should not get random spawn (as it defeats the purpose)
99- const disallowRandomSpawn =
100- playerTeams === Duos || playerTeams === Trios || playerTeams === Quads ;
101- if ( disallowRandomSpawn ) {
102- publicGameModifiers = publicGameModifiers . filter (
103- ( m ) => m !== PublicGameModifier . RandomSpawn ,
104- ) ;
98+ if (
99+ playerTeams === Duos ||
100+ playerTeams === Trios ||
101+ playerTeams === Quads
102+ ) {
103+ isRandomSpawn = false ;
105104 }
106105
107106 // Small maps (3rd player count < 50) don't get compact map in team games
108107 if ( mode === GameMode . Team && ! config . supportsCompactMapForTeams ( map ) ) {
109- publicGameModifiers = publicGameModifiers . filter (
110- ( m ) => m !== PublicGameModifier . CompactMap ,
111- ) ;
108+ isCompact = false ;
112109 }
113110
114- const isCompactMap = publicGameModifiers . includes (
115- PublicGameModifier . CompactMap ,
116- ) ;
117- const isRandomSpawn = publicGameModifiers . includes (
118- PublicGameModifier . RandomSpawn ,
119- ) ;
120-
121111 // Create the default public game config (from your GameManager)
122112 return {
123113 donateGold : mode === GameMode . Team ,
124114 donateTroops : mode === GameMode . Team ,
125115 gameMap : map ,
126- maxPlayers : config . lobbyMaxPlayers ( map , mode , playerTeams , isCompactMap ) ,
116+ maxPlayers : config . lobbyMaxPlayers ( map , mode , playerTeams , isCompact ) ,
127117 gameType : GameType . Public ,
128- gameMapSize : isCompactMap ? GameMapSize . Compact : GameMapSize . Normal ,
129- publicGameModifiers :
130- publicGameModifiers . length > 0 ? publicGameModifiers : undefined ,
118+ gameMapSize : isCompact ? GameMapSize . Compact : GameMapSize . Normal ,
119+ publicGameModifiers : { isCompact, isRandomSpawn } ,
131120 difficulty :
132121 playerTeams === HumansVsNations ? Difficulty . Hard : Difficulty . Easy ,
133122 infiniteGold : false ,
@@ -138,7 +127,7 @@ export class MapPlaylist {
138127 disableNations : mode === GameMode . Team && playerTeams !== HumansVsNations ,
139128 gameMode : mode ,
140129 playerTeams,
141- bots : isCompactMap ? 100 : 400 ,
130+ bots : isCompact ? 100 : 400 ,
142131 spawnImmunityDuration : 5 * 10 ,
143132 disabledUnits : [ ] ,
144133 } satisfies GameConfig ;
0 commit comments