@@ -25,13 +25,15 @@ public record DistributeBallPrediction(BallPredictionT BallPrediction) : Session
25
25
26
26
public record DistributeGameState ( GamePacketT GameState ) : SessionMessage ;
27
27
28
- public record RendersAllowed ( DebugRendering Allowed ) : SessionMessage ;
28
+ public record RendersAllowed ( bool Allowed ) : SessionMessage ;
29
29
30
30
public record StateSettingAllowed ( bool Allowed ) : SessionMessage ;
31
31
32
32
public record MatchComm ( MatchCommT Message ) : SessionMessage ;
33
33
34
34
public record StopMatch ( bool Force ) : SessionMessage ;
35
+
36
+ public record UpdateRendering ( RenderingStatus Status ) : SessionMessage ;
35
37
}
36
38
37
39
class FlatBuffersSession
@@ -63,7 +65,6 @@ class FlatBuffersSession
63
65
64
66
private bool _stateSettingIsEnabled ;
65
67
private bool _renderingIsEnabled ;
66
- private DebugRendering _globalRenderingIsEnabled ;
67
68
68
69
private string _agentId = string . Empty ;
69
70
private uint _team = Team . Other ;
@@ -96,7 +97,6 @@ bool stateSettingIsEnabled
96
97
DebugRendering . OnByDefault => true ,
97
98
_ => false ,
98
99
} ;
99
- _globalRenderingIsEnabled = renderingIsEnabled ;
100
100
_stateSettingIsEnabled = stateSettingIsEnabled ;
101
101
102
102
NetworkStream stream = _client . GetStream ( ) ;
@@ -381,17 +381,7 @@ private async Task HandleInternalMessages()
381
381
382
382
break ;
383
383
case SessionMessage . RendersAllowed m :
384
- _globalRenderingIsEnabled = m . Allowed ;
385
- switch ( _globalRenderingIsEnabled )
386
- {
387
- case DebugRendering . OnByDefault :
388
- _renderingIsEnabled = true ;
389
- break ;
390
- case DebugRendering . OffByDefault :
391
- case DebugRendering . AlwaysOff :
392
- _renderingIsEnabled = false ;
393
- break ;
394
- }
384
+ _renderingIsEnabled = m . Allowed ;
395
385
break ;
396
386
case SessionMessage . StateSettingAllowed m :
397
387
_stateSettingIsEnabled = m . Allowed ;
@@ -418,6 +408,19 @@ private async Task HandleInternalMessages()
418
408
when m . Force || ( _connectionEstablished && _closeBetweenMatches ) :
419
409
_sessionForceClosed = m . Force ;
420
410
return ;
411
+ case SessionMessage . UpdateRendering m
412
+ when ( m . Status . IsBot && ( _team == Team . Blue || _team == Team . Orange ) )
413
+ || ( ! m . Status . IsBot && _team == Team . Scripts ) :
414
+
415
+ foreach ( var player in _playerIdPairs )
416
+ {
417
+ if ( player . Index == m . Status . Index )
418
+ {
419
+ _renderingIsEnabled = m . Status . Status ;
420
+ break ;
421
+ }
422
+ }
423
+ break ;
421
424
}
422
425
}
423
426
0 commit comments