From: Christian Heller Date: Wed, 18 Nov 2020 04:35:33 +0000 (+0100) Subject: dd annotation hints view. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_id%7D%7D?a=commitdiff_plain;h=687f032b63ef13e98a8e71ef59c6ef0cd032149f;p=plomrogue2 dd annotation hints view. --- diff --git a/plomrogue/game.py b/plomrogue/game.py index ccd51dc..84bebb9 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -146,6 +146,12 @@ class Game(GameBase): target_yx = player.fov_stencil.target_yx(big_yx, little_yx) portal = self.portals[big_yx][little_yx] self.io.send('PORTAL %s %s' % (target_yx, quote(portal)), c_id) + for big_yx in self.annotations: + for little_yx in [little_yx for little_yx in self.annotations[big_yx] + if player.fov_test(big_yx, little_yx)]: + target_yx = player.fov_stencil.target_yx(big_yx, little_yx) + annotation = self.annotations[big_yx][little_yx] + self.io.send('ANNOTATION_HINT %s' % (target_yx,), c_id) self.io.send('GAME_STATE_COMPLETE') def run_tick(self): diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 15f4cd2..54499da 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -51,6 +51,8 @@ class PlomSocketClient(PlomSocket): pass # we assume socket will be known as dead by now def cmd_TURN(game, n): + game.info_db = {} + game.info_hints = [] game.turn = n game.things = [] game.portals = {} @@ -124,7 +126,6 @@ def cmd_MAP_CONTROL(game, content): cmd_MAP_CONTROL.argtypes = 'string' def cmd_GAME_STATE_COMPLETE(game): - game.info_db = {} if game.tui.mode.name == 'post_login_wait': game.tui.switch_mode('play') if game.tui.mode.shows_info: @@ -153,6 +154,10 @@ def cmd_ARGUMENT_ERROR(game, msg): game.tui.do_refresh = True cmd_ARGUMENT_ERROR.argtypes = 'string' +def cmd_ANNOTATION_HINT(game, position): + game.info_hints += [position] +cmd_ANNOTATION_HINT.argtypes = 'yx_tuple:nonneg' + def cmd_ANNOTATION(game, position, msg): game.info_db[position] = msg game.tui.restore_input_values() @@ -197,6 +202,7 @@ class Game(GameBase): self.register_command(cmd_MAP_CONTROL) self.register_command(cmd_PORTAL) self.register_command(cmd_ANNOTATION) + self.register_command(cmd_ANNOTATION_HINT) self.register_command(cmd_GAME_STATE_COMPLETE) self.register_command(cmd_ARGUMENT_ERROR) self.register_command(cmd_GAME_ERROR) @@ -206,6 +212,7 @@ class Game(GameBase): self.map_content = '' self.player_id = -1 self.info_db = {} + self.info_hints = [] self.portals = {} self.terrains = {} @@ -509,7 +516,10 @@ class TUI: start = self.game.map_geometry.size.x * y end = start + self.game.map_geometry.size.x map_lines_split += [[c + ' ' for c in map_content[start:end]]] - if self.map_mode == 'terrain': + if self.map_mode == 'annotations': + for p in self.game.info_hints: + map_lines_split[p.y][p.x] = 'A ' + elif self.map_mode == 'terrain': for p in self.game.portals.keys(): map_lines_split[p.y][p.x] = 'P ' used_positions = [] @@ -577,13 +587,12 @@ class TUI: elif self.mode == self.mode_study: content += 'Available actions:\n' content += '[%s] – move question mark\n' % ','.join(self.movement_keys) - content += '[%s] – toggle view between terrain, and password protection areas\n' % self.keys['toggle_map_mode'] + content += '[%s] – toggle view between terrain, annotations, and password protection areas\n' % self.keys['toggle_map_mode'] content += '\n\nOther modes available from here:' content += '[%s] – chat mode\n' % self.keys['switch_to_chat'] content += '[%s] – play mode\n' % self.keys['switch_to_play'] elif self.mode == self.mode_chat: content += '/nick NAME – re-name yourself to NAME\n' - #content += '/msg USER TEXT – send TEXT to USER\n' content += '/%s or /play – switch to play mode\n' % self.keys['switch_to_play'] content += '/%s or /study – switch to study mode\n' % self.keys['switch_to_study'] for i in range(self.size.y): @@ -719,6 +728,8 @@ class TUI: self.switch_mode('play') elif key == self.keys['toggle_map_mode']: if self.map_mode == 'terrain': + self.map_mode = 'annotations' + elif self.map_mode == 'annotations': self.map_mode = 'control' else: self.map_mode = 'terrain' diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index a5b2d69..88b6672 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -29,7 +29,7 @@ terminal columns: - +

edit keybindings

(see here for non-obvious available values):