Skip to content

Commit 461eedd

Browse files
committed
[bugfix] Set current action deadline for all ball placement commands
1 parent ec505b7 commit 461eedd

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

internal/app/controller/engine.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ func (e *Engine) SendCommand(command RefCommand, forTeam Team) {
125125
e.State.CommandFor = forTeam
126126

127127
switch command {
128-
case CommandHalt, CommandStop, CommandBallPlacement, CommandTimeout, CommandUnknown:
128+
case CommandBallPlacement:
129+
e.setCurrentActionTimeout(e.config.BallPlacementTime)
130+
case CommandHalt, CommandStop, CommandTimeout, CommandUnknown:
129131
// nothing to do
130132
default:
131133
// reset placement pos
@@ -730,7 +732,6 @@ func (e *Engine) placeBall(event *GameEvent) {
730732
e.SendCommand(CommandHalt, "")
731733
return
732734
}
733-
e.setCurrentActionTimeout(e.config.BallPlacementTime)
734735
}
735736

736737
func (e *Engine) allTeamsFailedPlacement() bool {

internal/app/controller/testdata/engine_test_command_placement.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,13 @@ transitions:
1717
placementPos:
1818
x: 4.2
1919
y: -1.5
20+
currentActionDeadline: "2010-01-01T00:00:30Z"
21+
currentActionTimeRemaining: 30s
2022
- tick: 1s # make sure that the stage time is not proceeded
23+
expectedStateDiff:
24+
currentActionDeadline: "2010-01-01T00:00:30Z"
25+
currentActionTimeRemaining: 29s
26+
placementPos:
27+
x: 4.2
28+
y: -1.5
2129

0 commit comments

Comments
 (0)