Skip to content

Commit 52cac2f

Browse files
Config for disabling runner live population
1 parent 7ac725e commit 52cac2f

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

client/src/client-config.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const DEFAULT_CONFIG = {
3636
focusRobotTurn: true,
3737
enableFancyPaint: true,
3838
streamRunnerGames: true,
39+
populateRunnerGames: true,
3940
profileGames: false,
4041
validateMaps: false,
4142
resolutionScale: 100,
@@ -68,6 +69,7 @@ const configDescription: Record<keyof ClientConfig, string> = {
6869
focusRobotTurn: 'Focus the robot when performing their turn during turn-stepping mode',
6970
enableFancyPaint: 'Enable fancy paint rendering',
7071
streamRunnerGames: 'Stream each round from the runner live as the game is being played',
72+
populateRunnerGames: 'Display the finished game immediately when the runner is finished running',
7173
profileGames: 'Enable saving profiling data when running games',
7274
validateMaps: 'Validate maps before running a game',
7375
resolutionScale: 'Resolution scale for the game area. Decrease to help performance.',

client/src/components/sidebar/runner/scaffold.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,16 @@ export const useScaffold = (): Scaffold => {
202202
}
203203

204204
const onGameComplete = (game: Game) => {
205-
appContext.setState((prevState) => ({
206-
...prevState,
207-
queue: prevState.queue.find((g) => g == game) ? prevState.queue : prevState.queue.concat([game])
208-
}))
209-
if (game.matches.length > 0) GameRunner.setMatch(game.matches[0])
205+
appContext.setState((prevState) => {
206+
if (prevState.config.populateRunnerGames && game.matches.length > 0) {
207+
GameRunner.setMatch(game.matches[0])
208+
}
209+
210+
return {
211+
...prevState,
212+
queue: prevState.queue.find((g) => g == game) ? prevState.queue : prevState.queue.concat([game])
213+
}
214+
})
210215
}
211216

212217
setWebSocketListener(

client/src/components/sidebar/runner/websocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class WebSocketListener {
6262
// Auto progress the round if the user hasn't done it themselves
6363
// We only want to do this if the currently selected match is the one being updated
6464
if (this.activeMatch && this.activeMatch === GameRunner.match) {
65-
const newRound = this.activeMatch.maxRound - 1
65+
const newRound = Math.max(this.activeMatch.maxRound - 2, 1)
6666
if (this.lastSetRound == this.activeMatch.currentRound.roundNumber) {
6767
GameRunner.jumpToRound(newRound)
6868
this.lastSetRound = newRound

client/src/playback/Match.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export default class Match {
313313
// Determine the maximum round we are allowed to jump to. If the game is
314314
// incomplete (still being updated with rounds), prevent jumping to the last
315315
// round to prevent issues (TODO: investigate why, but this seems to fix it)
316-
const maxRound = this.maxRound - (this.game.complete ? 0 : 1)
316+
const maxRound = this.maxRound - (this.game.complete ? 0 : 2)
317317

318318
roundNumber = Math.max(1, Math.min(roundNumber, maxRound))
319319
if (roundNumber == this.currentRound.roundNumber) return

0 commit comments

Comments
 (0)