Skip to content

Commit 6a4080c

Browse files
committed
Add free kick to continue actions when no next command
1 parent d4c1d14 commit 6a4080c

File tree

8 files changed

+100
-74
lines changed

8 files changed

+100
-74
lines changed

frontend/src/components/match/ContinueActionButton.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ const label = computed(() => {
4242
return 'Resume'
4343
case ContinueAction_Type.STOP_GAME:
4444
return 'Stop'
45-
case ContinueAction_Type.RESUME_FROM_STOP:
45+
case ContinueAction_Type.FORCE_START:
4646
return 'Force Start (no next command)'
47+
case ContinueAction_Type.FREE_KICK:
48+
return 'Free Kick (no next command)'
4749
case ContinueAction_Type.NEXT_COMMAND:
4850
return commandName(store.matchState.nextCommand?.type!)
4951
case ContinueAction_Type.BALL_PLACEMENT_START:

frontend/src/proto/ssl_gc_engine.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ export enum ContinueAction_Type {
138138
HALT = "HALT",
139139
RESUME_FROM_HALT = "RESUME_FROM_HALT",
140140
STOP_GAME = "STOP_GAME",
141-
RESUME_FROM_STOP = "RESUME_FROM_STOP",
141+
FORCE_START = "FORCE_START",
142+
FREE_KICK = "FREE_KICK",
142143
NEXT_COMMAND = "NEXT_COMMAND",
143144
BALL_PLACEMENT_START = "BALL_PLACEMENT_START",
144145
BALL_PLACEMENT_CANCEL = "BALL_PLACEMENT_CANCEL",
@@ -169,8 +170,11 @@ export function continueAction_TypeFromJSON(object: any): ContinueAction_Type {
169170
case "STOP_GAME":
170171
return ContinueAction_Type.STOP_GAME;
171172
case 11:
172-
case "RESUME_FROM_STOP":
173-
return ContinueAction_Type.RESUME_FROM_STOP;
173+
case "FORCE_START":
174+
return ContinueAction_Type.FORCE_START;
175+
case 17:
176+
case "FREE_KICK":
177+
return ContinueAction_Type.FREE_KICK;
174178
case 3:
175179
case "NEXT_COMMAND":
176180
return ContinueAction_Type.NEXT_COMMAND;
@@ -224,8 +228,10 @@ export function continueAction_TypeToJSON(object: ContinueAction_Type): string {
224228
return "RESUME_FROM_HALT";
225229
case ContinueAction_Type.STOP_GAME:
226230
return "STOP_GAME";
227-
case ContinueAction_Type.RESUME_FROM_STOP:
228-
return "RESUME_FROM_STOP";
231+
case ContinueAction_Type.FORCE_START:
232+
return "FORCE_START";
233+
case ContinueAction_Type.FREE_KICK:
234+
return "FREE_KICK";
229235
case ContinueAction_Type.NEXT_COMMAND:
230236
return "NEXT_COMMAND";
231237
case ContinueAction_Type.BALL_PLACEMENT_START:

internal/app/engine/process_continue_next_action.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,17 @@ func (e *Engine) nextActions() (actions []*ContinueAction) {
119119
))
120120
}
121121
} else if e.currentState.NextCommand != nil {
122-
actions = append(actions, e.createNextCommandContinueAction(ContinueAction_NEXT_COMMAND))
122+
var forTeam state.Team
123+
if e.currentState.NextCommand != nil && e.currentState.NextCommand.ForTeam != nil {
124+
forTeam = *e.currentState.NextCommand.ForTeam
125+
} else {
126+
forTeam = state.Team_UNKNOWN
127+
}
128+
actions = append(actions, e.createNextCommandContinueAction(ContinueAction_NEXT_COMMAND, forTeam))
123129
} else {
124-
actions = append(actions, e.createNextCommandContinueAction(ContinueAction_RESUME_FROM_STOP))
130+
actions = append(actions, e.createNextCommandContinueAction(ContinueAction_FORCE_START, state.Team_UNKNOWN))
131+
actions = append(actions, e.createNextCommandContinueAction(ContinueAction_FREE_KICK, state.Team_YELLOW))
132+
actions = append(actions, e.createNextCommandContinueAction(ContinueAction_FREE_KICK, state.Team_BLUE))
125133
}
126134
}
127135

internal/app/engine/process_continue_next_command.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ import (
99

1010
const distanceToBallDuringPenalty = 1.0
1111

12-
func (e *Engine) createNextCommandContinueAction(actionType ContinueAction_Type) *ContinueAction {
12+
func (e *Engine) createNextCommandContinueAction(
13+
actionType ContinueAction_Type,
14+
forTeam state.Team,
15+
) *ContinueAction {
1316
var actionState ContinueAction_State
14-
var continuationIssues = e.findIssuesForContinuation(*e.currentState.Command.Type)
17+
var continuationIssues = e.findIssuesForContinuation()
1518

1619
var lastReadyAt *timestamppb.Timestamp
1720
var lastContinueAction = e.LastContinueAction(actionType)
@@ -41,16 +44,9 @@ func (e *Engine) createNextCommandContinueAction(actionType ContinueAction_Type)
4144
}
4245
}
4346

44-
var forTeam *state.Team
45-
if e.currentState.NextCommand != nil {
46-
forTeam = e.currentState.NextCommand.ForTeam
47-
} else {
48-
forTeam = state.NewTeam(state.Team_UNKNOWN)
49-
}
50-
5147
return &ContinueAction{
5248
Type: &actionType,
53-
ForTeam: forTeam,
49+
ForTeam: &forTeam,
5450
State: &actionState,
5551
ContinuationIssues: continuationIssues,
5652
ReadyAt: readyAt,
@@ -73,13 +69,14 @@ func maxTime(t1, t2 *timestamppb.Timestamp) *timestamppb.Timestamp {
7369
return t2
7470
}
7571

76-
func (e *Engine) findIssuesForContinuation(command state.Command_Type) []string {
72+
func (e *Engine) findIssuesForContinuation() []string {
7773

7874
if e.trackerStateGc.Ball == nil {
7975
// No tracking data, can not check for issues
8076
return []string{}
8177
}
8278

79+
command := *e.currentState.Command.Type
8380
switch command {
8481
case state.Command_KICKOFF:
8582
return e.readyToContinueKickoff()

internal/app/engine/process_continue_perform.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ func (e *Engine) performContinueAction(action *ContinueAction) {
1515
ContinueAction_STOP_GAME,
1616
ContinueAction_BALL_PLACEMENT_CANCEL:
1717
e.Enqueue(createCommandChange(state.NewCommandNeutral(state.Command_STOP)))
18-
case ContinueAction_RESUME_FROM_STOP:
18+
case ContinueAction_FORCE_START:
1919
e.Enqueue(createCommandChange(state.NewCommandNeutral(state.Command_FORCE_START)))
20+
case ContinueAction_FREE_KICK:
21+
e.Enqueue(createCommandChange(state.NewCommand(state.Command_DIRECT, *action.ForTeam)))
2022
case ContinueAction_NEXT_COMMAND:
2123
e.Enqueue(createCommandChange(e.currentState.NextCommand))
2224
case ContinueAction_BALL_PLACEMENT_START:

internal/app/engine/ssl_gc_engine.pb.go

Lines changed: 36 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/ssl_gc_engine.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ message ContinueAction {
114114
HALT = 1;
115115
RESUME_FROM_HALT = 10;
116116
STOP_GAME = 2;
117-
RESUME_FROM_STOP = 11;
117+
FORCE_START = 11;
118+
FREE_KICK = 17;
118119
NEXT_COMMAND = 3;
119120
BALL_PLACEMENT_START = 4;
120121
BALL_PLACEMENT_CANCEL = 9;

src/proto.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19610,7 +19610,7 @@ export const Change = $root.Change = (() => {
1961019610
break;
1961119611
}
1961219612
case 2: {
19613-
message.teamName = $root.google.protobuf.StringValue.decode(reader, reader.uint32());
19613+
message.teamName = $root.google.protobuf.StringValue.decode(reader, reader.uint32());
1961419614
break;
1961519615
}
1961619616
case 3: {
@@ -19840,10 +19840,10 @@ export const Change = $root.Change = (() => {
1984019840
return object;
1984119841
let message = new $root.Change.UpdateTeamState();
1984219842
switch (object.forTeam) {
19843-
case "UNKNOWN":
19844-
case 0:
19845-
message.forTeam = 0;
19846-
break;
19843+
case "UNKNOWN":
19844+
case 0:
19845+
message.forTeam = 0;
19846+
break;
1984719847
case "YELLOW":
1984819848
case 1:
1984919849
message.forTeam = 1;
@@ -29624,6 +29624,7 @@ export const ContinueAction = $root.ContinueAction = (() => {
2962429624
case 10:
2962529625
case 2:
2962629626
case 11:
29627+
case 17:
2962729628
case 3:
2962829629
case 4:
2962929630
case 9:
@@ -29685,14 +29686,14 @@ export const ContinueAction = $root.ContinueAction = (() => {
2968529686
return object;
2968629687
let message = new $root.ContinueAction();
2968729688
switch (object.type) {
29688-
case "TYPE_UNKNOWN":
29689-
case 0:
29690-
message.type = 0;
29691-
break;
29692-
case "HALT":
29693-
case 1:
29694-
message.type = 1;
29695-
break;
29689+
case "TYPE_UNKNOWN":
29690+
case 0:
29691+
message.type = 0;
29692+
break;
29693+
case "HALT":
29694+
case 1:
29695+
message.type = 1;
29696+
break;
2969629697
case "RESUME_FROM_HALT":
2969729698
case 10:
2969829699
message.type = 10;
@@ -29701,10 +29702,14 @@ export const ContinueAction = $root.ContinueAction = (() => {
2970129702
case 2:
2970229703
message.type = 2;
2970329704
break;
29704-
case "RESUME_FROM_STOP":
29705+
case "FORCE_START":
2970529706
case 11:
2970629707
message.type = 11;
2970729708
break;
29709+
case "FREE_KICK":
29710+
case 17:
29711+
message.type = 17;
29712+
break;
2970829713
case "NEXT_COMMAND":
2970929714
case 3:
2971029715
message.type = 3;
@@ -29763,10 +29768,10 @@ export const ContinueAction = $root.ContinueAction = (() => {
2976329768
case 1:
2976429769
message.forTeam = 1;
2976529770
break;
29766-
case "BLUE":
29767-
case 2:
29768-
message.forTeam = 2;
29769-
break;
29771+
case "BLUE":
29772+
case 2:
29773+
message.forTeam = 2;
29774+
break;
2977029775
}
2977129776
if (object.continuationIssues) {
2977229777
if (!Array.isArray(object.continuationIssues))
@@ -29876,7 +29881,8 @@ export const ContinueAction = $root.ContinueAction = (() => {
2987629881
* @property {number} HALT=1 HALT value
2987729882
* @property {number} RESUME_FROM_HALT=10 RESUME_FROM_HALT value
2987829883
* @property {number} STOP_GAME=2 STOP_GAME value
29879-
* @property {number} RESUME_FROM_STOP=11 RESUME_FROM_STOP value
29884+
* @property {number} FORCE_START=11 FORCE_START value
29885+
* @property {number} FREE_KICK=17 FREE_KICK value
2988029886
* @property {number} NEXT_COMMAND=3 NEXT_COMMAND value
2988129887
* @property {number} BALL_PLACEMENT_START=4 BALL_PLACEMENT_START value
2988229888
* @property {number} BALL_PLACEMENT_CANCEL=9 BALL_PLACEMENT_CANCEL value
@@ -29896,7 +29902,8 @@ export const ContinueAction = $root.ContinueAction = (() => {
2989629902
values[valuesById[1] = "HALT"] = 1;
2989729903
values[valuesById[10] = "RESUME_FROM_HALT"] = 10;
2989829904
values[valuesById[2] = "STOP_GAME"] = 2;
29899-
values[valuesById[11] = "RESUME_FROM_STOP"] = 11;
29905+
values[valuesById[11] = "FORCE_START"] = 11;
29906+
values[valuesById[17] = "FREE_KICK"] = 17;
2990029907
values[valuesById[3] = "NEXT_COMMAND"] = 3;
2990129908
values[valuesById[4] = "BALL_PLACEMENT_START"] = 4;
2990229909
values[valuesById[9] = "BALL_PLACEMENT_CANCEL"] = 9;

0 commit comments

Comments
 (0)