can broadcast messages again

slack
Jordan Orelli 10 years ago
parent 634ca1301d
commit 4c688080b3

@ -54,7 +54,10 @@ type MakeBombState struct {
func MakeBomb(s *System) ConnectionState {
m := &MakeBombState{System: s}
m.CommandSuite = CommandSet{
BroadcastCommand(s),
balCommand,
helpCommand,
playersCommand,
}
return m
}

@ -112,17 +112,18 @@ var commandsCommand = Command{
},
}
// var broadcastCommand = &Command{
// name: "broadcast",
// help: "broadcast a message for all systems to hear",
// handler: func(conn *Connection, args ...string) {
// msg := strings.Join(args, " ")
// system := conn.System()
// b := NewBroadcast(system, msg)
// log_info("player %s send broadcast from system %s: %v\n", conn.Name(), system.Label(), msg)
// currentGame.Register(b)
// },
// }
func BroadcastCommand(sys *System) Command {
return Command{
name: "broadcast",
help: "broadcast a message for all systems to hear",
handler: func(c *Connection, args ...string) {
msg := strings.Join(args, " ")
b := NewBroadcast(sys, msg)
log_info("player %s send broadcast from system %v: %v\n", c.Name(), sys, msg)
currentGame.Register(b)
},
}
}
// var colonizeCommand = &Command{
// name: "colonize",

@ -17,6 +17,7 @@ func Idle(sys *System) ConnectionState {
balCommand,
helpCommand,
playersCommand,
BroadcastCommand(sys),
Command{
name: "goto",
help: "travel between star systems",

@ -16,6 +16,7 @@ func Mine(sys *System) ConnectionState {
balCommand,
helpCommand,
playersCommand,
BroadcastCommand(sys),
Command{
name: "stop",
help: "stops mining",

Loading…
Cancel
Save