Skip to content

Commit 1df758d

Browse files
committed
[feature] Add a hint to the game event table, if no auto placement
1 parent 276b223 commit 1df758d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

internal/app/controller/engine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ func (e *Engine) placeBall(event *GameEvent) {
770770
if e.State.PlacementPos == nil || e.State.noTeamCanPlaceBall() {
771771
// placement not possible, human ref must help out
772772
e.SendCommand(CommandHalt, "")
773+
e.LogHint("manualPlacement", "placement pos unknown", TeamUnknown)
773774
return
774775
}
775776

@@ -792,6 +793,7 @@ func (e *Engine) placeBall(event *GameEvent) {
792793
} else {
793794
// If team can not place ball, human ref has to help out
794795
e.SendCommand(CommandHalt, "")
796+
e.LogHint("manualPlacement", "team can not place ball", teamInFavor)
795797
return
796798
}
797799
}

internal/app/controller/uiProtocol.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const (
2525
UiProtocolModify UiProtocolType = "modify"
2626
// UiProtocolTeamAction represents an action from a team
2727
UiProtocolTeamAction UiProtocolType = "teamAction"
28+
// UiProtocolHint represents a hint to the human game-controller operator
29+
UiProtocolHint UiProtocolType = "hint"
2830
)
2931

3032
// UiProtocolEntry represents a single protocol entry as should be displayed in the UI table
@@ -155,3 +157,16 @@ func (e *Engine) LogTeamBotSubstitutionChange(forTeam Team, substituteBot bool)
155157
}
156158
e.UiProtocol = append(e.UiProtocol, entry)
157159
}
160+
161+
// LogHint adds a hint for the game-controller operator to the protocol
162+
func (e *Engine) LogHint(hint string, description string, team Team) {
163+
entry := UiProtocolEntry{
164+
Timestamp: e.TimeProvider().UnixNano(),
165+
StageTime: e.State.StageTimeElapsed,
166+
Type: UiProtocolHint,
167+
Team: team,
168+
Name: hint,
169+
Description: description,
170+
}
171+
e.UiProtocol = append(e.UiProtocol, entry)
172+
}

0 commit comments

Comments
 (0)