def cmd_THING_TYPE(game, thing_type, symbol_hint):
game.thing_types[thing_type] = symbol_hint
+ game.train_parser()
cmd_THING_TYPE.argtypes = 'string char'
def cmd_THING_INSTALLED(game, thing_id):
self.portals_new = {}
self.terrains = {}
self.player = None
+ self.parser = Parser(self)
+ self.train_parser()
- def get_string_options(self, string_option_type):
- if string_option_type == 'map_geometry':
- return ['Hex', 'Square']
- elif string_option_type == 'thing_type':
- return self.thing_types.keys()
- return None
+ def train_parser(self):
+ self.parser.string_options = {
+ 'map_geometry': {'Hex', 'Square'},
+ 'thing_type': self.thing_types.keys()
+ }
def get_command(self, command_name):
from functools import partial
self.socket = ClientSocket(host, self.socket_log)
self.game = Game()
self.game.tui = self
- self.parser = Parser(self.game)
self.login_name = None
self.map_mode = 'terrain + things'
self.password = 'foo'
super().__init__(*args, **kwargs)
def update_on_connect(self):
+ self.game.thing_types = {}
+ self.game.terrains = {}
+ self.game.train_parser()
+ self.is_admin = False
self.socket.send('TASKS')
self.socket.send('TERRAINS')
self.socket.send('THING_TYPES')
lines[i])
def draw_screen(self):
- super().draw_screen()
self.stdscr.bkgd(' ', curses.color_pair(1))
self.recalc_input_lines()
if self.mode.has_input_prompt:
self.draw_face_popup()
def handle_server_message(self, msg):
- command, args = self.parser.parse(msg)
+ command, args = self.game.parser.parse(msg)
command(*args)
def on_each_loop_start(self):