X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=rogue_chat_curses.py;h=acd6fa1719fb05a6329aeda2b81924419f65beb4;hb=a1372680754a527409c039152d2e65399b601e35;hp=203f3eaefec758c879b3b7bc9edc451f2e385113;hpb=43d0cd09dd33ce5452ee449c7e62f064098cced2;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 203f3ea..acd6fa1 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -104,6 +104,10 @@ def cmd_MAP(game, geometry, size, content): } cmd_MAP.argtypes = 'string:map_geometry yx_tuple:pos string' +def cmd_FOV(game, content): + game.fov = content +cmd_FOV.argtypes = 'string' + def cmd_MAP_CONTROL(game, content): game.map_control_content = content cmd_MAP_CONTROL.argtypes = 'string' @@ -178,6 +182,7 @@ class Game(GameBase): self.register_command(cmd_GAME_ERROR) self.register_command(cmd_PLAY_ERROR) self.register_command(cmd_TASKS) + self.register_command(cmd_FOV) self.map_content = '' self.player_id = -1 self.info_db = {} @@ -261,6 +266,7 @@ class TUI: self.disconnected = True self.force_instant_connect = True self.input_lines = [] + self.fov = '' curses.wrapper(self.loop) def flash(self): @@ -418,18 +424,20 @@ class TUI: if not self.game.turn_complete: return pos_i = self.explorer.y * self.game.map_geometry.size.x + self.explorer.x - info = 'TERRAIN: %s\n' % self.game.map_content[pos_i] - for t in self.game.things: - if t.position == self.explorer: - info += 'PLAYER @: %s\n' % t.name - if self.explorer in self.game.portals: - info += 'PORTAL: ' + self.game.portals[self.explorer] + '\n' - else: - info += 'PORTAL: (none)\n' - if self.explorer in self.game.info_db: - info += 'ANNOTATION: ' + self.game.info_db[self.explorer] - else: - info += 'ANNOTATION: waiting …' + info = 'outside field of view' + if self.game.fov[pos_i] == '.': + info = 'TERRAIN: %s\n' % self.game.map_content[pos_i] + for t in self.game.things: + if t.position == self.explorer: + info += 'PLAYER @: %s\n' % t.name + if self.explorer in self.game.portals: + info += 'PORTAL: ' + self.game.portals[self.explorer] + '\n' + else: + info += 'PORTAL: (none)\n' + if self.explorer in self.game.info_db: + info += 'ANNOTATION: ' + self.game.info_db[self.explorer] + else: + info += 'ANNOTATION: waiting …' lines = msg_into_lines_of_width(info, self.window_width) height_header = 2 for i in range(len(lines)): @@ -619,7 +627,9 @@ class TUI: self.input_ = "" self.switch_mode('play') elif self.mode == self.mode_chat and key == '\n': - if self.input_[0] == '/': + if self.input_ == '': + continue + if self.input_[0] == '/': # FIXME fails on empty input if self.input_ in {'/' + self.keys['switch_to_play'], '/play'}: self.switch_mode('play') elif self.input_ in {'/' + self.keys['switch_to_study'], '/study'}: