added players command

slack
Jordan Orelli 10 years ago
parent 1f94135775
commit 0ad3aeca17

@ -239,6 +239,16 @@ var mkBombCommand = &Command{
}, },
} }
var playersCommand = &Command{
name: "players",
help: "lists the connected players",
handler: func(conn *Connection, args ...string) {
for other, _ := range currentGame.connections {
fmt.Fprintf(conn, "%v\n", other.PlayerName())
}
},
}
func isCommand(name string) bool { func isCommand(name string) bool {
_, ok := commandRegistry[name] _, ok := commandRegistry[name]
return ok return ok
@ -285,8 +295,9 @@ func setupCommands() {
registerCommand(helpCommand) registerCommand(helpCommand)
registerCommand(infoCommand) registerCommand(infoCommand)
registerCommand(mineCommand) registerCommand(mineCommand)
registerCommand(mkBombCommand)
registerCommand(nearbyCommand) registerCommand(nearbyCommand)
registerCommand(scanCommand) registerCommand(scanCommand)
registerCommand(mkBombCommand)
registerCommand(winCommand) registerCommand(winCommand)
registerCommand(playersCommand)
} }

Loading…
Cancel
Save