X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance2?a=blobdiff_plain;f=rogue_chat_curses.py;h=defc2724840ae41127b20748669288e8c5bbf73c;hb=0a25fa6dadb1560ed64c22fe12a6c3d8de567b84;hp=203f3eaefec758c879b3b7bc9edc451f2e385113;hpb=27c9f26f715fd388087beea4b2cfb7eb495b1cc3;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 203f3ea..defc272 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)):