home · contact · privacy
Server: Split in many files, reorganize code slightly to fit change.
[plomrogue] / server / config / commands.py
1 from server.commands import command_plugin, command_quit, command_ping, \
2     command_thingshere, command_makeworld, command_seedrandomness, setter, \
3     command_maplength, command_worldactive, setter_map, command_taid, \
4     command_taname, command_ttid, command_ttname, command_tttool, \
5     command_ttsymbol, command_ttcorpseid, command_tid, command_tcommand, \
6     command_ttype, command_tcarries, command_tmemthing, setter_tpos, \
7     play_wait, play_move, play_pickup, play_drop, play_use, command_ai
8
9
10 """Commands database.
11
12 Map command start tokens to ([0]) number of expected command arguments, ([1])
13 the command's meta-ness (i.e. is it to be written to the record file, is it to
14 be ignored in replay mode if read from server input file), and ([2]) a function
15 to be called on it.
16 """
17 commands_db = {
18     "PLUGIN": (1, True, command_plugin),
19     "QUIT": (0, True, command_quit),
20     "PING": (0, True, command_ping),
21     "THINGS_HERE": (2, True, command_thingshere),
22     "MAKE_WORLD": (1, False, command_makeworld),
23     "SEED_RANDOMNESS": (1, False, command_seedrandomness),
24     "TURN": (1, False, setter(None, "TURN", 0, 65535)),
25     "PLAYER_TYPE": (1, False, setter(None, "PLAYER_TYPE", 0)),
26     "MAP_LENGTH": (1, False, command_maplength),
27     "WORLD_ACTIVE": (1, False, command_worldactive),
28     "MAP": (2, False, setter_map("MAP")),
29     "TA_ID": (1, False, command_taid),
30     "TA_EFFORT": (1, False, setter("ThingAction", "TA_EFFORT", 0, 255)),
31     "TA_NAME": (1, False, command_taname),
32     "TT_ID": (1, False, command_ttid),
33     "TT_NAME": (1, False, command_ttname),
34     "TT_TOOL": (1, False, command_tttool),
35     "TT_SYMBOL": (1, False, command_ttsymbol),
36     "TT_CORPSE_ID": (1, False, command_ttcorpseid),
37     "TT_TOOLPOWER": (1, False, setter("ThingType", "TT_TOOLPOWER", 0, 65535)),
38     "TT_START_NUMBER": (1, False, setter("ThingType", "TT_START_NUMBER",
39                                          0, 255)),
40     "TT_PROLIFERATE": (1, False, setter("ThingType", "TT_PROLIFERATE",
41                                         0, 65535)),
42     "TT_LIFEPOINTS": (1, False, setter("ThingType", "TT_LIFEPOINTS", 0, 255)),
43     "T_ID": (1, False, command_tid),
44     "T_ARGUMENT": (1, False, setter("Thing", "T_ARGUMENT", 0, 255)),
45     "T_PROGRESS": (1, False, setter("Thing", "T_PROGRESS", 0, 255)),
46     "T_LIFEPOINTS": (1, False, setter("Thing", "T_LIFEPOINTS", 0, 255)),
47     "T_SATIATION": (1, False, setter("Thing", "T_SATIATION", -32768, 32767)),
48     "T_COMMAND": (1, False, command_tcommand),
49     "T_TYPE": (1, False, command_ttype),
50     "T_CARRIES": (1, False, command_tcarries),
51     "T_MEMMAP": (2, False, setter_map("T_MEMMAP")),
52     "T_MEMDEPTHMAP": (2, False, setter_map("T_MEMDEPTHMAP")),
53     "T_MEMTHING": (3, False, command_tmemthing),
54     "T_POSY": (1, False, setter_tpos("Y")),
55     "T_POSX": (1, False, setter_tpos("X")),
56     "wait": (0, False, play_wait),
57     "move": (1, False, play_move),
58     "pick_up": (0, False, play_pickup),
59     "drop": (1, False, play_drop),
60     "use": (1, False, play_use),
61     "ai": (0, False, command_ai)
62 }
63 # TODO: Unhandled cases: (Un-)killing animates (esp. player!) with T_LIFEPOINTS.