File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public class SessionManager : CriticalBackgroundService
3535 public bool IsOpen => CurrentSession . Configuration . IsOpen switch
3636 {
3737 IsOpenMode . Open => true ,
38- IsOpenMode . CloseAtStart => ! CurrentSession . IsStarted ,
38+ IsOpenMode . CloseAtStart => ! CurrentSession . IsCutoffReached ,
3939 _ => false ,
4040 } ;
4141
@@ -286,25 +286,25 @@ private bool IsSessionOver()
286286
287287 if ( CurrentSession . Configuration . IsOpen == IsOpenMode . Closed && connectedCount < 2 )
288288 {
289+ Log . Information ( "Skipping race session: didn't reach minimum player count before cutoff ({PlayerCount}/2). Use 'IS_OPEN=1' to allow joining during the race" , connectedCount ) ;
289290 return true ;
290291 }
291292
292293 if ( CurrentSession . Configuration . IsOpen != IsOpenMode . CloseAtStart )
293294 {
294- return connectedCount == 0 ;
295+ if ( connectedCount > 0 ) return false ;
296+
297+ Log . Information ( "Skipping race session: no player connected" ) ;
298+ return true ;
295299 }
296300
297- switch ( CurrentSession . Configuration . Type )
301+ if ( connectedCount < 2 && CurrentSession . IsCutoffReached )
298302 {
299- case SessionType . Race when connectedCount > 0 && Program . IsDebugBuild :
300- return false ;
301- case SessionType . Race when connectedCount == 0 && Program . IsDebugBuild :
302- return true ;
303- case SessionType . Race when connectedCount <= 1 :
304- return true ;
305- default :
306- return false ;
303+ Log . Information ( "Skipping race session: didn't reach minimum player count before cutoff ({PlayerCount}/2). Use 'IS_OPEN=1' to allow joining during the race" , connectedCount ) ;
304+ return true ;
307305 }
306+
307+ return false ;
308308 }
309309
310310 private void CalcOverTime ( )
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public class SessionState
1616 public uint TargetLap { get ; set ; } = 0 ;
1717 public uint LeaderLapCount { get ; set ; } = 0 ;
1818 public bool LeaderHasCompletedLastLap { get ; set ; } = false ;
19- public bool IsStarted { get ; set ; } = false ;
19+ public bool IsCutoffReached => _timeSource . ServerTimeMilliseconds > StartTimeMilliseconds - 20_000 ;
2020
2121 public bool SessionOverFlag => Configuration switch
2222 {
You can’t perform that action at this time.
0 commit comments