Skip to content

Commit b90766d

Browse files
committed
Do not check for successful ball placement -> autoRefs
1 parent c4b06ea commit b90766d

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

internal/app/engine/process_ballplacement.go

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,7 @@ func (c *BallPlacementCoordinator) process() {
2828

2929
remainingDistance := c.remainingPlacementDistance()
3030

31-
if e.ballSteady() && e.teamInFavorKeepsSufficientDistance() &&
32-
float64(remainingDistance) <= e.gameConfig.BallPlacementTolerance {
33-
// if opponent does not yet keep sufficient distance, that's not the placing teams fold,
34-
// so just wait a bit more
35-
if e.opponentTeamKeepsSufficientDistance() {
36-
duration := float32(e.timeProvider().Sub(*c.ballPlacementStartTime).Seconds())
37-
var distance *float32
38-
if c.ballPlacementStartPos != nil && e.gcState.TrackerStateGc.Ball.Pos != nil {
39-
distance = new(float32)
40-
*distance = float32(c.ballPlacementStartPos.DistanceTo(e.gcState.TrackerStateGc.Ball.Pos.ToVector2()))
41-
}
42-
e.Enqueue(createGameEventChange(state.GameEvent_PLACEMENT_SUCCEEDED, state.GameEvent{
43-
Event: &state.GameEvent_PlacementSucceeded_{
44-
PlacementSucceeded: &state.GameEvent_PlacementSucceeded{
45-
ByTeam: e.currentState.Command.ForTeam,
46-
TimeTaken: &duration,
47-
Precision: &remainingDistance,
48-
Distance: distance,
49-
},
50-
},
51-
}))
52-
}
53-
} else if goDur(e.currentState.CurrentActionTimeRemaining) <= 0 {
31+
if goDur(e.currentState.CurrentActionTimeRemaining) <= 0 {
5432
e.Enqueue(createGameEventChange(state.GameEvent_PLACEMENT_FAILED, state.GameEvent{
5533
Event: &state.GameEvent_PlacementFailed_{
5634
PlacementFailed: &state.GameEvent_PlacementFailed{
@@ -70,32 +48,3 @@ func (c *BallPlacementCoordinator) remainingPlacementDistance() float32 {
7048
ballPos := c.gcEngine.gcState.TrackerStateGc.Ball.Pos.ToVector2()
7149
return float32(placementPos.DistanceTo(ballPos))
7250
}
73-
74-
func (e *Engine) teamInFavorKeepsSufficientDistance() bool {
75-
radius := e.gameConfig.BallPlacementMinRobotDistance + robotRadius + distanceThreshold
76-
if e.currentState.NextCommand != nil && e.currentState.NextCommand.ForTeam == nil {
77-
radius = e.gameConfig.DistanceToBallInStop + robotRadius + distanceThreshold
78-
}
79-
80-
var robots []*Robot
81-
for _, robot := range e.gcState.TrackerStateGc.Robots {
82-
if *robot.Id.Team == *e.currentState.Command.ForTeam {
83-
robots = append(robots, robot)
84-
}
85-
}
86-
87-
return !e.robotsInsideRadius(robots, e.gcState.TrackerStateGc.Ball.Pos.ToVector2(), radius)
88-
}
89-
90-
func (e *Engine) opponentTeamKeepsSufficientDistance() bool {
91-
radius := e.gameConfig.DistanceToBallInStop + robotRadius + distanceThreshold
92-
93-
var robots []*Robot
94-
for _, robot := range e.gcState.TrackerStateGc.Robots {
95-
if *robot.Id.Team != *e.currentState.Command.ForTeam {
96-
robots = append(robots, robot)
97-
}
98-
}
99-
100-
return !e.robotsInsideRadius(robots, e.gcState.TrackerStateGc.Ball.Pos.ToVector2(), radius)
101-
}

0 commit comments

Comments
 (0)