home · contact · privacy
Only send out new gamestate every 1/25 second.
[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_GOD_THING_NAME, cmd_THING_DOOR_CLOSED,
11                                 cmd_GOD_THING_PROTECTION, cmd_THING_PROTECTION,
12                                 cmd_SET_MAP_CONTROL_PASSWORD, cmd_SPAWN_POINT)
13 from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_PICK_UP,
14                              Task_DROP, Task_FLATTEN_SURROUNDINGS, Task_DOOR,
15                              Task_INTOXICATE)
16 from plomrogue.things import (Thing_Player, Thing_Item, Thing_ItemSpawner,
17                               Thing_SpawnPoint, Thing_SpawnPointSpawner,
18                               Thing_Door, Thing_DoorSpawner, Thing_Consumable,
19                               Thing_ConsumableSpawner)
20
21 from plomrogue.config import config
22 game = Game(config['savefile'])
23 game.register_command(cmd_PING)
24 game.register_command(cmd_ALL)
25 game.register_command(cmd_LOGIN)
26 game.register_command(cmd_NICK)
27 game.register_command(cmd_TURN)
28 game.register_command(cmd_MAP)
29 game.register_command(cmd_MAP_LINE)
30 game.register_command(cmd_MAP_CONTROL_LINE)
31 game.register_command(cmd_MAP_CONTROL_PW)
32 game.register_command(cmd_GET_ANNOTATION)
33 game.register_command(cmd_ANNOTATE)
34 game.register_command(cmd_PORTAL)
35 game.register_command(cmd_GOD_ANNOTATE)
36 game.register_command(cmd_GOD_PORTAL)
37 game.register_command(cmd_GET_GAMESTATE)
38 game.register_command(cmd_TASKS)
39 game.register_command(cmd_THING_TYPES)
40 game.register_command(cmd_TERRAINS)
41 game.register_command(cmd_THING)
42 game.register_command(cmd_THING_PROTECTION)
43 game.register_command(cmd_GOD_THING_PROTECTION)
44 game.register_command(cmd_THING_NAME)
45 game.register_command(cmd_THING_DOOR_CLOSED)
46 game.register_command(cmd_GOD_THING_NAME)
47 game.register_command(cmd_ADMIN_PASSWORD)
48 game.register_command(cmd_SET_TILE_CONTROL)
49 game.register_command(cmd_SET_MAP_CONTROL_PASSWORD)
50 game.register_command(cmd_BECOME_ADMIN)
51 game.register_command(cmd_SPAWN_POINT)
52 game.register_task(Task_WAIT)
53 game.register_task(Task_MOVE)
54 game.register_task(Task_WRITE)
55 game.register_task(Task_FLATTEN_SURROUNDINGS)
56 game.register_task(Task_PICK_UP)
57 game.register_task(Task_DROP)
58 game.register_task(Task_DOOR)
59 game.register_task(Task_INTOXICATE)
60 game.register_thing_type(Thing_Player)
61 game.register_thing_type(Thing_Item)
62 game.register_thing_type(Thing_ItemSpawner)
63 game.register_thing_type(Thing_SpawnPoint)
64 game.register_thing_type(Thing_SpawnPointSpawner)
65 game.register_thing_type(Thing_Door)
66 game.register_thing_type(Thing_DoorSpawner)
67 game.register_thing_type(Thing_Consumable)
68 game.register_thing_type(Thing_ConsumableSpawner)
69 game.read_savefile()
70 game.io.start_loop()
71 for port in config['servers']:
72     game.io.start_server(port, config['servers'][port],
73                          config['certfile'], config['keyfile'])