Skip to content

Commit e3fb87e

Browse files
committed
Bugfix: Reset to correct timeout after defender interference
1 parent d7c4370 commit e3fb87e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

internal/app/statemachine/change_gameevent.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,17 @@ func (s *StateMachine) processChangeAddGameEvent(newState *state.State, change *
174174
// defender too close to kick point
175175
if *gameEvent.Type == state.GameEvent_DEFENDER_TOO_CLOSE_TO_KICK_POINT {
176176
log.Printf("Reset current action time because defender of team %v was too close to kick point", byTeam)
177-
newState.CurrentActionTimeRemaining = ptypes.DurationProto(s.gameConfig.PrepareTimeout)
177+
178+
switch *newState.Command.Type {
179+
case state.Command_DIRECT, state.Command_INDIRECT:
180+
newState.CurrentActionTimeRemaining = ptypes.DurationProto(s.gameConfig.FreeKickTimeout[newState.Division.Div()])
181+
case state.Command_NORMAL_START:
182+
newState.CurrentActionTimeRemaining = ptypes.DurationProto(s.gameConfig.PrepareTimeout)
183+
case state.Command_FORCE_START:
184+
newState.CurrentActionTimeRemaining = ptypes.DurationProto(s.gameConfig.NoProgressTimeout[newState.Division.Div()])
185+
default:
186+
log.Printf("Unexpected command while handling defender too close to kick point: %v", *newState.Command.Type)
187+
}
178188
}
179189

180190
if *newState.GameState.Type == state.GameState_PENALTY &&

0 commit comments

Comments
 (0)