home · contact · privacy
Shrink sound Dijkstra map, reach; refactor lots of mapping code.
[plomrogue2] / rogue_chat.py
1 #!/usr/bin/env python3
2 from plomrogue.game import Game
3 from plomrogue.io_websocket import PlomWebSocketServer
4 from plomrogue.io_tcp import PlomTCPServer
5 from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_NICK, cmd_PING, cmd_THING,
6                                 cmd_MAP, cmd_TURN, cmd_MAP_LINE, cmd_GET_ANNOTATION,
7                                 cmd_ANNOTATE, cmd_PORTAL, cmd_GET_GAMESTATE,
8                                 cmd_TASKS, cmd_MAP_CONTROL_LINE, cmd_MAP_CONTROL_PW,
9                                 cmd_GOD_ANNOTATE, cmd_GOD_PORTAL, cmd_THING_TYPES,
10                                 cmd_THING_NAME, cmd_TERRAINS)
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 import sys
15
16 if len(sys.argv) != 2:
17     print('wrong number of arguments, expected one (save file)')
18     exit(1)
19 savefile = sys.argv[1]
20 game = Game(savefile)
21 game.register_command(cmd_PING)
22 game.register_command(cmd_ALL)
23 game.register_command(cmd_LOGIN)
24 game.register_command(cmd_NICK)
25 game.register_command(cmd_TURN)
26 game.register_command(cmd_MAP)
27 game.register_command(cmd_MAP_LINE)
28 game.register_command(cmd_MAP_CONTROL_LINE)
29 game.register_command(cmd_MAP_CONTROL_PW)
30 game.register_command(cmd_GET_ANNOTATION)
31 game.register_command(cmd_ANNOTATE)
32 game.register_command(cmd_PORTAL)
33 game.register_command(cmd_GOD_ANNOTATE)
34 game.register_command(cmd_GOD_PORTAL)
35 game.register_command(cmd_GET_GAMESTATE)
36 game.register_command(cmd_TASKS)
37 game.register_command(cmd_THING_TYPES)
38 game.register_command(cmd_TERRAINS)
39 game.register_command(cmd_THING)
40 game.register_command(cmd_THING_NAME)
41 game.register_task(Task_WAIT)
42 game.register_task(Task_MOVE)
43 game.register_task(Task_WRITE)
44 game.register_task(Task_FLATTEN_SURROUNDINGS)
45 game.register_task(Task_PICK_UP)
46 game.register_task(Task_DROP)
47 game.register_thing_type(Thing_Player)
48 game.register_thing_type(Thing_Item)
49 game.register_thing_type(Thing_Furniture)
50 game.read_savefile()
51 game.io.start_loop()
52 game.io.start_server(8000, PlomWebSocketServer)
53 game.io.start_server(5000, PlomTCPServer)