Create a stripped down version of the robot struct to represent all robots and break up the update into my_robots and robots.

Has dependent change on client
This commit is contained in:
Fraser Graham
2013-10-24 20:13:21 -07:00
parent cc248dc2fe
commit de68ec2e7b
3 changed files with 36 additions and 10 deletions
+19 -1
View File
@@ -19,8 +19,26 @@ type Robot struct {
LastFired int `json:"-"`
}
// This is the subset of data we send to players about robots
// that are not theirs.
type OtherRobot struct {
Id string `json:"id"`
Name string `json:"name"`
Position v.Point2d `json:"position"`
Health int `json:"health"`
}
func (r Robot) GetTruncatedDetails() OtherRobot {
return OtherRobot{
Id: r.Id,
Name: r.Name,
Position: r.Position,
Health: r.Health,
}
}
type RobotSorter struct {
Robots []Robot
Robots []OtherRobot
}
func (s RobotSorter) Len() int {