removed unecessary data from payload sent to the client and filter outgoing robot list by scanner contents for each player until they die
This commit is contained in:
@@ -7,16 +7,16 @@ import (
|
||||
type Robot struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Stats Stats `json:"stats"`
|
||||
TargetSpeed float32 `json:"target_speed"`
|
||||
Stats Stats `json:"-"`
|
||||
TargetSpeed float32 `json:"-"`
|
||||
Speed float32 `json:"speed"`
|
||||
Health int `json:"health"`
|
||||
Position v.Point2d `json:"position"`
|
||||
Heading v.Vector2d `json:"heading"`
|
||||
MoveTo *v.Point2d `json:"move_to,omitempty"`
|
||||
FireAt *v.Point2d `json:"fire_at,omitempty"`
|
||||
MoveTo *v.Point2d `json:"-"`
|
||||
FireAt *v.Point2d `json:"-"`
|
||||
Scanners []Scanner `json:"scanners"`
|
||||
LastFired int `json:"last_fired"`
|
||||
LastFired int `json:"-"`
|
||||
}
|
||||
|
||||
type RobotSorter struct {
|
||||
@@ -36,13 +36,13 @@ func (s RobotSorter) Less(i, j int) bool {
|
||||
}
|
||||
|
||||
type Stats struct {
|
||||
Hp int `json:"hp"`
|
||||
Speed float32 `json:"speed"`
|
||||
Acceleration float32 `json:"acceleration"`
|
||||
WeaponRadius int `json:"weapon_radius"`
|
||||
ScannerRadius int `json:"scanner_radius"`
|
||||
TurnSpeed int `json:"turn_speed"`
|
||||
FireRate int `json:"fire_rate"`
|
||||
Hp int `json:"-"`
|
||||
Speed float32 `json:"-"`
|
||||
Acceleration float32 `json:"-"`
|
||||
WeaponRadius int `json:"-"`
|
||||
ScannerRadius int `json:"-"`
|
||||
TurnSpeed int `json:"-"`
|
||||
FireRate int `json:"-"`
|
||||
}
|
||||
|
||||
// We request stats using an integer between 1 and 100, the
|
||||
@@ -106,19 +106,19 @@ func (s StatsRequest) Valid() bool {
|
||||
type Projectile struct {
|
||||
Id string `json:"id"`
|
||||
Position v.Point2d `json:"position"`
|
||||
MoveTo v.Point2d `json:"move_to"`
|
||||
MoveTo v.Point2d `json:"-"`
|
||||
Radius int `json:"radius"`
|
||||
Speed float32 `json:"speed"`
|
||||
Damage int `json:"damage"`
|
||||
Speed float32 `json:"-"`
|
||||
Damage int `json:"-"`
|
||||
}
|
||||
|
||||
type Splosion struct {
|
||||
Id string `json:"id"`
|
||||
Position v.Point2d `json:"position"`
|
||||
Radius int `json:"radius"`
|
||||
MaxDamage int `json:"damage"`
|
||||
MinDamage int `json:"damage"`
|
||||
Lifespan int `json:"lifespan"`
|
||||
MaxDamage int `json:"-"`
|
||||
MinDamage int `json:"-"`
|
||||
Lifespan int `json:"-"`
|
||||
}
|
||||
|
||||
func (s *Splosion) Tick() {
|
||||
|
||||
Reference in New Issue
Block a user