Changed the collision response from boolean to Collision

This commit is contained in:
Stephen McQuay 2014-01-27 20:39:08 -08:00
parent 29b078e637
commit e02dc2f348
2 changed files with 6 additions and 5 deletions

View File

@ -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"`
}

View File

@ -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