home · contact · privacy
Move socket configuration into command line options.
[plomrogue2] / rogue_chat.py
1 #!/usr/bin/env python3
2 from plomrogue.game import Game
3 from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_NICK, cmd_PING, cmd_THING,
4                                 cmd_MAP, cmd_TURN, cmd_MAP_LINE, cmd_GET_ANNOTATION,
5                                 cmd_ANNOTATE, cmd_PORTAL, cmd_GET_GAMESTATE,
6                                 cmd_TASKS, cmd_MAP_CONTROL_LINE, cmd_MAP_CONTROL_PW,
7                                 cmd_GOD_ANNOTATE, cmd_GOD_PORTAL, cmd_THING_TYPES,
8                                 cmd_THING_NAME, cmd_TERRAINS, cmd_ADMIN_PASSWORD,
9                                 cmd_BECOME_ADMIN, cmd_SET_TILE_CONTROL,
10                                 cmd_SET_MAP_CONTROL_PASSWORD, cmd_SPAWN_POINT)
11 from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_PICK_UP,
12                              Task_DROP, Task_FLATTEN_SURROUNDINGS)
13 from plomrogue.things import Thing_Player, Thing_Item, Thing_Furniture
14
15 from plomrogue.config import config
16 game = Game(config['savefile'])
17 game.register_command(cmd_PING)
18 game.register_command(cmd_ALL)
19 game.register_command(cmd_LOGIN)
20 game.register_command(cmd_NICK)
21 game.register_command(cmd_TURN)
22 game.register_command(cmd_MAP)
23 game.register_command(cmd_MAP_LINE)
24 game.register_command(cmd_MAP_CONTROL_LINE)
25 game.register_command(cmd_MAP_CONTROL_PW)
26 game.register_command(cmd_GET_ANNOTATION)
27 game.register_command(cmd_ANNOTATE)
28 game.register_command(cmd_PORTAL)
29 game.register_command(cmd_GOD_ANNOTATE)
30 game.register_command(cmd_GOD_PORTAL)
31 game.register_command(cmd_GET_GAMESTATE)
32 game.register_command(cmd_TASKS)
33 game.register_command(cmd_THING_TYPES)
34 game.register_command(cmd_TERRAINS)
35 game.register_command(cmd_THING)
36 game.register_command(cmd_THING_NAME)
37 game.register_command(cmd_ADMIN_PASSWORD)
38 game.register_command(cmd_SET_TILE_CONTROL)
39 game.register_command(cmd_SET_MAP_CONTROL_PASSWORD)
40 game.register_command(cmd_BECOME_ADMIN)
41 game.register_command(cmd_SPAWN_POINT)
42 game.register_task(Task_WAIT)
43 game.register_task(Task_MOVE)
44 game.register_task(Task_WRITE)
45 game.register_task(Task_FLATTEN_SURROUNDINGS)
46 game.register_task(Task_PICK_UP)
47 game.register_task(Task_DROP)
48 game.register_thing_type(Thing_Player)
49 game.register_thing_type(Thing_Item)
50 game.register_thing_type(Thing_Furniture)
51 game.read_savefile()
52 game.io.start_loop()
53 for port in config['servers']:
54     game.io.start_server(port, config['servers'][port],
55                          config['certfile'], config['keyfile'])