diff --git a/commands.go b/commands.go index ed1ddd1..813b124 100644 --- a/commands.go +++ b/commands.go @@ -193,5 +193,6 @@ func init() { registerCommand(nearbyCommand) registerCommand(scanCommand) registerCommand(gotoCommand) + registerCommand(broadcastCommand) // registerCommand(bombCommand) } diff --git a/main.go b/main.go index 348e01c..47ceb83 100644 --- a/main.go +++ b/main.go @@ -70,24 +70,6 @@ func handleConnection(conn *Connection) { } switch parts[0] { - case "broadcast": - msg := strings.Join(parts[1:], " ") - log_info("player %s is broadcasting message %s", conn.PlayerName(), msg) - for _, otherSystem := range index { - if otherSystem.name == system.name { - log_info("skpping duplicate system %s", system.name) - continue - } - go func(s *System) { - log_info("message reached system %s with %d inhabitants", s.name, s.NumInhabitants()) - dist := system.DistanceTo(s) * 0.5 - delay := time.Duration(int64(dist * 100000000)) - time.Sleep(delay) - s.EachConn(func(conn *Connection) { - fmt.Fprintln(conn, msg) - }) - }(otherSystem) - } case "quit": return default: diff --git a/work.go b/work.go index bf1ce9f..942c1f8 100644 --- a/work.go +++ b/work.go @@ -56,7 +56,7 @@ func RunQueue() { heap.Init(&queue) for { if len(queue) == 0 { - time.Sleep(100 * time.Microsecond) + time.Sleep(10 * time.Microsecond) continue } future, ok := heap.Pop(&queue).(*Future) @@ -64,7 +64,6 @@ func RunQueue() { log_error("there's shit on the work heap") continue } - log_info("we have a work item with delay %v", time.Since(future.ts)) if future.ts.After(time.Now()) { time.Sleep(future.ts.Sub(time.Now())) }