@@ -240,7 +240,7 @@ public void UpdateMapStatus(eMapStatus status)
240240 _currentMapStatus = status ;
241241 }
242242
243- public void SetupMatch ( MatchData match )
243+ public void SetupMatch ( MatchData match , eMapStatus ? forceState = null )
244244 {
245245 _matchData = match ;
246246
@@ -259,6 +259,11 @@ public void SetupMatch(MatchData match)
259259 return ;
260260 }
261261
262+ if ( forceState != null )
263+ {
264+ _currentMap . status = forceState . Value . ToString ( ) ;
265+ }
266+
262267 _logger . LogInformation (
263268 $ "Game State { _currentMap . status } on ({ _currentMap . map . name } ) / { Server . MapName } "
264269 ) ;
@@ -286,16 +291,19 @@ public void SetupMatch(MatchData match)
286291
287292 SetupTeamNames ( ) ;
288293
289- if ( MatchUtility . MapStatusStringToEnum ( _currentMap . status ) != _currentMapStatus )
290- {
291- UpdateMapStatus ( MatchUtility . MapStatusStringToEnum ( _currentMap . status ) ) ;
292- }
293-
294294 foreach ( var player in MatchUtility . Players ( ) )
295295 {
296296 EnforceMemberTeam ( player ) ;
297297 }
298298
299+ Server . NextFrame ( ( ) =>
300+ {
301+ if ( MatchUtility . MapStatusStringToEnum ( _currentMap . status ) != _currentMapStatus )
302+ {
303+ UpdateMapStatus ( MatchUtility . MapStatusStringToEnum ( _currentMap . status ) ) ;
304+ }
305+ } ) ;
306+
299307 if ( IsWarmup ( ) )
300308 {
301309 _gameServer . Message ( HudDestination . Alert , "Received Match Data" ) ;
@@ -490,6 +498,13 @@ public async void EnforceMemberTeam(CCSPlayerController player, CsTeam? currentT
490498 MatchData ? matchData = GetMatchData ( ) ;
491499 MatchMap ? currentMap = GetCurrentMap ( ) ;
492500
501+ CsTeam lineup1StartingSide = TeamUtility . TeamStringToCsTeam (
502+ currentMap ? . lineup_1_side ?? CsTeam . CounterTerrorist . ToString ( )
503+ ) ;
504+ CsTeam lineup2StartingSide = TeamUtility . TeamStringToCsTeam (
505+ currentMap ? . lineup_2_side ?? CsTeam . Terrorist . ToString ( )
506+ ) ;
507+
493508 if ( matchData == null || currentMap == null )
494509 {
495510 return ;
@@ -536,20 +551,8 @@ public async void EnforceMemberTeam(CCSPlayerController player, CsTeam? currentT
536551 currentTeam = player . Team ;
537552 }
538553
539- CsTeam expectedTeam = CsTeam . None ;
540-
541- string lineupName =
542- matchData . lineup_1_id == lineup_id
543- ? matchData . lineup_1 . name
544- : matchData . lineup_2 . name ;
545-
546- foreach ( var team in MatchUtility . Teams ( ) )
547- {
548- if ( team . ClanTeamname == lineupName )
549- {
550- expectedTeam = TeamUtility . TeamNumToCSTeam ( team . TeamNum ) ;
551- }
552- }
554+ CsTeam expectedTeam =
555+ matchData . lineup_1_id == lineup_id ? lineup1StartingSide : lineup2StartingSide ;
553556
554557 if ( expectedTeam == CsTeam . None )
555558 {
0 commit comments