probe result
This commit is contained in:
parent
829ba83f41
commit
eabc1ebb41
@ -66,6 +66,7 @@ func (p *player) recv() {
|
|||||||
|
|
||||||
if msg.Probe != nil {
|
if msg.Probe != nil {
|
||||||
p.Robot.Probe = msg.Probe
|
p.Robot.Probe = msg.Probe
|
||||||
|
p.Robot.ProbeResult = nil
|
||||||
} else {
|
} else {
|
||||||
p.Robot.Probe = nil
|
p.Robot.Probe = nil
|
||||||
}
|
}
|
||||||
@ -204,11 +205,11 @@ func (p *player) Tick(g *game) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.Robot.Probe != nil {
|
if p.Robot.Probe != nil && p.Robot.ProbeResult == nil {
|
||||||
probe_vector := p.Robot.Probe.Sub(p.Robot.Position)
|
probe_vector := p.Robot.Probe.Sub(p.Robot.Position)
|
||||||
coll, pos, _ := p.checkCollisions(g, probe_vector)
|
coll, pos, _ := p.checkCollisions(g, probe_vector)
|
||||||
if coll {
|
if coll {
|
||||||
p.Robot.Probe = &pos
|
p.Robot.ProbeResult = &pos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
robot.go
1
robot.go
@ -21,6 +21,7 @@ type Robot struct {
|
|||||||
Collision bool `json:"collision"`
|
Collision bool `json:"collision"`
|
||||||
Hit bool `json:"hit"`
|
Hit bool `json:"hit"`
|
||||||
Probe *v.Point2d `json:"probe"`
|
Probe *v.Point2d `json:"probe"`
|
||||||
|
ProbeResult *v.Point2d `json:"probe_result"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the subset of data we send to players about robots
|
// This is the subset of data we send to players about robots
|
||||||
|
Loading…
Reference in New Issue
Block a user