Skip to content

Commit 8b81e5d

Browse files
committed
Keep robot substitution request flag active
This allows the remote-control to unset it, indicating the GCO that the team is ready.
1 parent 199df3b commit 8b81e5d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

internal/app/rcon/server_remotecontrol.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ func (c *RemoteControlClient) checkStopTimeout() error {
271271

272272
func (c *RemoteControlClient) checkRequestRobotSubstitution() error {
273273
gameStateType := *c.gcEngine.CurrentState().GameState.Type
274-
if gameStateType == state.GameState_HALT {
274+
teamState := c.gcEngine.CurrentState().TeamState[c.team.String()]
275+
if gameStateType == state.GameState_HALT && teamState.RequestsBotSubstitutionSince == nil {
275276
return errors.New("Game is halted")
276277
}
277278
return nil

internal/app/statemachine/change_command.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ func (s *StateMachine) processChangeNewCommand(newState *state.State, newCommand
2727
if *newState.GameState.Type == state.GameState_STOP {
2828
if prevGameState.IsHalted() {
2929
newState.ReadyContinueTime = timestamppb.New(s.timeProvider().Add(s.gameConfig.PreparationTimeAfterHalt))
30+
// reset robot substitution flags
31+
for _, team := range state.BothTeams() {
32+
newState.TeamInfo(team).RequestsBotSubstitutionSince = nil
33+
}
3034
} else if newState.ReadyContinueTime == nil {
3135
newState.ReadyContinueTime = timestamppb.New(s.timeProvider().Add(s.gameConfig.PreparationTimeBeforeResume))
3236
}

internal/app/statemachine/change_gameevent.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ func (s *StateMachine) processChangeAddGameEvent(newState *state.State, change *
118118

119119
// bot substitution
120120
if *gameEvent.Type == state.GameEvent_BOT_SUBSTITUTION {
121-
// reset robot substitution flags
122-
for _, team := range state.BothTeams() {
123-
newState.TeamInfo(team).RequestsBotSubstitutionSince = nil
124-
}
125121
// halt the game to allow teams to substitute robots
126122
changes = append(changes, createCommandChange(state.NewCommandNeutral(state.Command_HALT)))
127123
}

0 commit comments

Comments
 (0)