Skip to content

Commit

Permalink
Use Nexus when pre-loading teams for the next match.
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed Oct 6, 2024
1 parent d6e8552 commit 4de9e43
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions field/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,19 @@ func (arena *Arena) preLoadNextMatch() {
return
}

teamIds := [6]int{nextMatch.Red1, nextMatch.Red2, nextMatch.Red3, nextMatch.Blue1, nextMatch.Blue2, nextMatch.Blue3}
if nextMatch.ShouldAllowNexusSubstitution() && arena.EventSettings.NexusEnabled {
// Attempt to get the match lineup from Nexus for FRC.
lineup, err := arena.NexusClient.GetLineup(nextMatch.TbaMatchKey)
if err != nil {
log.Printf("Failed to load lineup from Nexus: %s", err.Error())
} else {
teamIds = *lineup
}
}

var teams [6]*model.Team
for i, teamId := range []int{
nextMatch.Red1, nextMatch.Red2, nextMatch.Red3, nextMatch.Blue1, nextMatch.Blue2, nextMatch.Blue3,
} {
for i, teamId := range teamIds {
if teamId == 0 {
continue
}
Expand Down

0 comments on commit 4de9e43

Please sign in to comment.