made stats params flag-modifiable

This commit is contained in:
Stephen McQuay 2013-09-07 19:26:21 -07:00
parent db1afada10
commit eb9fa775b0
1 changed files with 9 additions and 5 deletions

14
main.go
View File

@ -11,6 +11,11 @@ import (
"net/http" "net/http"
) )
var hp = flag.Int("hp", 100, "")
var speed = flag.Float64("speed", 100, "")
var weaponRadius = flag.Int("wrad", 100, "weapon radius")
var scannerRadius = flag.Int("srad", 100, "scanner radius")
func connect() (*websocket.Conn, error) { func connect() (*websocket.Conn, error) {
origin := "http://localhost/" origin := "http://localhost/"
url := "ws://localhost:8666/ws/" url := "ws://localhost:8666/ws/"
@ -69,11 +74,10 @@ func negociate(ws *websocket.Conn, gameid string) (err error) {
err = websocket.JSON.Send(ws, &bot.Config{ err = websocket.JSON.Send(ws, &bot.Config{
gameid, gameid,
bot.Stats{ bot.Stats{
// TODO: make these flags Hp: *hp,
Hp: 200, Speed: *speed,
Speed: 100, WeaponRadius: *weaponRadius,
WeaponRadius: 50, ScannerRadius: *scannerRadius,
ScannerRadius: 50,
}, },
}) })