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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user