From eb9fa775b0b9ce00bb4bb3d4879217ff77234d7f Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Sat, 7 Sep 2013 19:26:21 -0700 Subject: [PATCH] made stats params flag-modifiable --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 1ed7f35..88ce911 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,11 @@ import ( "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) { origin := "http://localhost/" 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{ gameid, bot.Stats{ - // TODO: make these flags - Hp: 200, - Speed: 100, - WeaponRadius: 50, - ScannerRadius: 50, + Hp: *hp, + Speed: *speed, + WeaponRadius: *weaponRadius, + ScannerRadius: *scannerRadius, }, })