Skip to content

Commit 4e48e6e

Browse files
committed
[feature] Publish the ball placement position
1 parent d57999e commit 4e48e6e

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
@@ -127,8 +127,9 @@ func (e *Engine) Continue() error {
127127
}
128128
case
129129
GameEventPlacementFailedByTeamInFavor:
130-
// TODO placement pos
131-
e.SendCommand(CommandBallPlacement, e.State.GameEvent.ByTeam().Opposite())
130+
if e.State.PlacementPos != nil {
131+
e.SendCommand(CommandBallPlacement, e.State.GameEvent.ByTeam().Opposite())
132+
}
132133
case
133134
GameEventBotTooFastInStop,
134135
GameEventUnsportiveBehaviorMinor,

internal/app/controller/publisher.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func updateMessage(r *refproto.Referee, state *State) (republish bool) {
114114

115115
r.CurrentGameEvent = state.GameEvent.ToProto()
116116
r.CurrentGameEventSecondary = state.GameEventSecondary.ToProto()
117+
r.DesignatedPosition = mapLocation(state.PlacementPos)
117118

118119
*r.PacketTimestamp = uint64(time.Now().UnixNano() / 1000)
119120
*r.Stage = mapStage(state.Stage)
@@ -218,3 +219,10 @@ func mapStage(stage Stage) refproto.Referee_Stage {
218219
}
219220
return -1
220221
}
222+
223+
func mapLocation(location *Location) *refproto.Referee_Point {
224+
if location == nil {
225+
return nil
226+
}
227+
return &refproto.Referee_Point{X: &location.X, Y: &location.Y}
228+
}

0 commit comments

Comments
 (0)