From: Christian Heller <c.heller@plomlompom.de> Date: Wed, 25 Nov 2020 04:52:39 +0000 (+0100) Subject: More responsive mode leaving. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/static/bar%20baz.html?a=commitdiff_plain;h=85992bcb503cbe2a7bf7cd2d7ff54ca0ad7032d7;p=plomrogue2 More responsive mode leaving. --- diff --git a/rogue_chat.html b/rogue_chat.html index c10f7ca..02fb9a6 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -11,8 +11,8 @@ </head><body> <div> terminal rows: <input id="n_rows" type="number" step=4 min=24 value=24 /> -· terminal columns: <input id="n_cols" type="number" step=4 min=80 value=80 /> -· <a href="https://plomlompom.com/repos/?p=plomrogue2;a=summary">source code</a> (includes proper terminal/ncurses client) +/ terminal columns: <input id="n_cols" type="number" step=4 min=80 value=80 /> +/ <a href="https://plomlompom.com/repos/?p=plomrogue2;a=summary">source code</a> (includes proper terminal/ncurses client) </div> <pre id="terminal"></pre> <textarea id="input" style="opacity: 0; width: 0px;"></textarea> @@ -134,15 +134,15 @@ let mode_helps = { 'long': 'This mode is the first of two steps to change the password for a tile protection character. First enter the tile protection character for which you want to change the password.' }, 'control_pw_pw': { - 'short': 'change tiles control password', + 'short': 'change tiles protection password', 'long': 'This mode is the second of two steps to change the password for a tile protection character. Enter the new password for the tile protection character you chose.' }, 'control_tile_type': { - 'short': 'change tiles control', + 'short': 'change tiles protection', 'long': 'This mode is the first of two steps to change tile protection areas on the map. First enter the tile tile protection character you want to write.' }, 'control_tile_draw': { - 'short': 'change tiles control', + 'short': 'change tiles protection', 'long': 'This mode is the second of two steps to change tile protection areas on the map. Toggle tile protection drawing on/off and move the ?? cursor around the map to draw the selected tile protection character.' }, 'annotate': { @@ -610,6 +610,9 @@ let tui = { }; }, switch_mode: function(mode_name) { + if (this.mode.name == 'control_tile_draw') { + tui.log_msg('@ finished tile protection drawing.') + } this.inputEl.focus(); this.map_mode = 'terrain + things'; this.tile_draw = false; @@ -683,14 +686,14 @@ let tui = { } else if (this.mode.name == 'admin_enter') { this.log_msg('@ enter admin password:') } else if (this.mode.name == 'control_pw_type') { - this.log_msg('@ enter tile control character for which you want to change the password:') + this.log_msg('@ enter tile protection character for which you want to change the password:') } else if (this.mode.name == 'control_tile_type') { - this.log_msg('@ enter tile control character which you want to draw:') + this.log_msg('@ enter tile protection character which you want to draw:') } else if (this.mode.name == 'control_pw_pw') { - this.log_msg('@ enter tile control password for "' + this.tile_control_char + '":'); + this.log_msg('@ enter tile protection password for "' + this.tile_control_char + '":'); } else if (this.mode.name == 'control_tile_draw') { document.getElementById("toggle_tile_draw").disabled = false; - this.log_msg('@ can draw tile control character "' + this.tile_control_char + '", turn drawing on/off with [' + this.keys.toggle_tile_draw + '], finish with [' + this.keys.switch_to_admin_enter + '].') + this.log_msg('@ can draw tile protection character "' + this.tile_control_char + '", turn drawing on/off with [' + this.keys.toggle_tile_draw + '], finish with [' + this.keys.switch_to_admin_enter + '].') } this.full_refresh(); }, @@ -1238,6 +1241,7 @@ tui.inputEl.addEventListener('keydown', (event) => { } else { server.send(['SET_MAP_CONTROL_PASSWORD', tui.tile_control_char, tui.inputEl.value]); + tui.log_msg('@ sent new password for protection character "' + tui.tile_control_char + '".'); } tui.switch_mode('admin'); } else if (tui.mode.name == 'portal' && event.key == 'Enter') { @@ -1324,7 +1328,7 @@ tui.inputEl.addEventListener('keydown', (event) => { }; } else if (tui.mode.name == 'control_tile_draw') { if (tui.mode.mode_switch_on_key(event)) { - null; + null; } else if (event.key in tui.movement_keys) { explorer.move(tui.movement_keys[event.key]); } else if (event.key === tui.keys.toggle_tile_draw) { diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 49eb01a..6151301 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -32,15 +32,15 @@ mode_helps = { 'long': 'This mode is the first of two steps to change the password for a tile protection character. First enter the tile protection character for which you want to change the password.' }, 'control_pw_pw': { - 'short': 'change tiles control password', + 'short': 'change protection character password', 'long': 'This mode is the second of two steps to change the password for a tile protection character. Enter the new password for the tile protection character you chose.' }, 'control_tile_type': { - 'short': 'change tiles control', + 'short': 'change tiles protection', 'long': 'This mode is the first of two steps to change tile protection areas on the map. First enter the tile tile protection character you want to write.' }, 'control_tile_draw': { - 'short': 'change tiles control', + 'short': 'change tiles protection', 'long': 'This mode is the second of two steps to change tile protection areas on the map. Toggle tile protection drawing on/off and move the ?? cursor around the map to draw the selected tile protection character.' }, 'annotate': { @@ -379,6 +379,7 @@ class TUI: self.mode_edit.available_modes = ["write", "annotate", "portal", "password", "chat", "study", "play", "admin_enter"] + self.mode = None self.host = host self.game = Game() self.game.tui = self @@ -504,6 +505,8 @@ class TUI: (self.explorer, quote(self.tile_control_char))) def switch_mode(self, mode_name): + if self.mode and self.mode.name == 'control_tile_draw': + self.log_msg('@ finished tile protection drawing.') self.map_mode = 'terrain + things' self.tile_draw = False if mode_name == 'admin_enter' and self.is_admin: @@ -526,13 +529,13 @@ class TUI: elif self.mode.name == 'admin_enter': self.log_msg('@ enter admin password:') elif self.mode.name == 'control_pw_type': - self.log_msg('@ enter tile control character for which you want to change the password:') + self.log_msg('@ enter tile protection character for which you want to change the password:') elif self.mode.name == 'control_tile_type': - self.log_msg('@ enter tile control character which you want to draw:') + self.log_msg('@ enter tile protection character which you want to draw:') elif self.mode.name == 'control_pw_pw': - self.log_msg('@ enter tile control password for "%s":' % self.tile_control_char) + self.log_msg('@ enter tile protection password for "%s":' % self.tile_control_char) elif self.mode.name == 'control_tile_draw': - self.log_msg('@ can draw tile control character "%s", turn drawing on/off with [%s], finish with [%s].' % (self.tile_control_char, self.keys['toggle_tile_draw'], self.keys['switch_to_admin_enter'])) + self.log_msg('@ can draw tile protection character "%s", turn drawing on/off with [%s], finish with [%s].' % (self.tile_control_char, self.keys['toggle_tile_draw'], self.keys['switch_to_admin_enter'])) self.input_ = "" self.restore_input_values() @@ -757,7 +760,7 @@ class TUI: content += '\n' elif self.mode.name == 'control_tile_draw': content += "Available actions:\n" - content += "[%s] â toggle tile control drawing\n" % self.keys['toggle_tile_draw'] + content += "[%s] â toggle tile protection drawing\n" % self.keys['toggle_tile_draw'] content += '\n' elif self.mode.name == 'chat': content += '/nick NAME â re-name yourself to NAME\n' @@ -858,6 +861,7 @@ class TUI: self.log_msg('@ aborted') else: self.send('SET_MAP_CONTROL_PASSWORD ' + quote(self.tile_control_char) + ' ' + quote(self.input_)) + self.log_msg('@ sent new password for protection character "%s"' % self.tile_control_char) self.switch_mode('admin') elif self.mode.name == 'password' and key == '\n': if self.input_ == '':