Skip to content

Commit 225fea4

Browse files
committed
[bugfix] Fix substitution intent game event for both teams
1 parent 96c1d0f commit 225fea4

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

internal/app/controller/engine.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,28 @@ func (e *Engine) Continue() {
288288
log.Println("Continue")
289289
substitutionIntend := e.State.BotSubstitutionIntend()
290290
if substitutionIntend != TeamUnknown {
291-
teamProto := substitutionIntend.toProto()
292-
event := GameEvent{
293-
Type: GameEventBotSubstitution,
294-
Details: GameEventDetails{
295-
BotSubstitution: &refproto.GameEvent_BotSubstitution{ByTeam: &teamProto}}}
296-
e.AddGameEvent(&event)
291+
if substitutionIntend == TeamBoth {
292+
teamProto := TeamYellow.toProto()
293+
event := GameEvent{
294+
Type: GameEventBotSubstitution,
295+
Details: GameEventDetails{
296+
BotSubstitution: &refproto.GameEvent_BotSubstitution{ByTeam: &teamProto}}}
297+
e.AddGameEvent(&event)
298+
299+
teamProto = TeamBlue.toProto()
300+
event = GameEvent{
301+
Type: GameEventBotSubstitution,
302+
Details: GameEventDetails{
303+
BotSubstitution: &refproto.GameEvent_BotSubstitution{ByTeam: &teamProto}}}
304+
e.AddGameEvent(&event)
305+
} else {
306+
teamProto := substitutionIntend.toProto()
307+
event := GameEvent{
308+
Type: GameEventBotSubstitution,
309+
Details: GameEventDetails{
310+
BotSubstitution: &refproto.GameEvent_BotSubstitution{ByTeam: &teamProto}}}
311+
e.AddGameEvent(&event)
312+
}
297313
e.LogHint("botSubstitution", "game halted for bot substitution", substitutionIntend)
298314
e.State.TeamState[TeamBlue].BotSubstitutionIntend = false
299315
e.State.TeamState[TeamYellow].BotSubstitutionIntend = false

0 commit comments

Comments
 (0)