Changed the collision response from boolean to Collision
This commit is contained in:
parent
29b078e637
commit
e02dc2f348
@ -58,12 +58,13 @@ type Robot struct {
|
||||
FireAt *govector.Point2d `json:"-"`
|
||||
Scanners []Scanner `json:"scanners"`
|
||||
LastFired int `json:"-"`
|
||||
Collision bool `json:"collision"`
|
||||
Collision *Collision `json:"collision"`
|
||||
Hit bool `json:"hit"`
|
||||
Probe *govector.Point2d `json:"probe"`
|
||||
ProbeResult *ProbeResult `json:"probe_result"`
|
||||
ProbeResult *Collision `json:"probe_result"`
|
||||
}
|
||||
type ProbeResult struct {
|
||||
|
||||
type Collision struct {
|
||||
govector.Point2d
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
4
robot.go
4
robot.go
@ -274,10 +274,10 @@ func (r *robot) navigate() {
|
||||
return
|
||||
}
|
||||
}
|
||||
if r.me.Collision {
|
||||
if r.me.Collision != nil {
|
||||
// XXX: I am being told I am here ...
|
||||
if *verbose {
|
||||
log.Printf("%s apparent collision", r.name)
|
||||
log.Printf("%s apparent collision: %#v", r.name, r.me.Collision)
|
||||
}
|
||||
r.moveto = r.randomDirection()
|
||||
r.speed = 0
|
||||
|
Loading…
Reference in New Issue
Block a user