From: Christian Heller Date: Fri, 6 Nov 2020 00:51:26 +0000 (+0100) Subject: Improve teleportation handling. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/git-logo.png?a=commitdiff_plain;h=4eb281718a289961da0737570ceceee069fa681a;p=plomrogue2-experiments Improve teleportation handling. --- diff --git a/new2/rogue_chat_curses.py b/new2/rogue_chat_curses.py index 643023b..8bd45af 100755 --- a/new2/rogue_chat_curses.py +++ b/new2/rogue_chat_curses.py @@ -204,7 +204,7 @@ class TUI: elif self.mode.name == 'teleport': self.log_msg("@ May teleport to %s:%s" % (self.teleport_target_host, self.teleport_target_port)); - self.log_msg("@ Enter 'YES!' to affirm."); + self.log_msg("@ Enter 'YES!' to enthusiastically affirm."); elif self.mode.name == 'annotate' and self.explorer in self.game.info_db: info = self.game.info_db[self.explorer] if info != '(none)': diff --git a/new2/rogue_chat_nocanvas_monochrome.html b/new2/rogue_chat_nocanvas_monochrome.html index bb4c771..2d60619 100644 --- a/new2/rogue_chat_nocanvas_monochrome.html +++ b/new2/rogue_chat_nocanvas_monochrome.html @@ -271,7 +271,7 @@ let mode_annotate = new Mode('add message to map tile', true, true); let mode_play = new Mode('play / move around', false, false); let mode_study = new Mode('check map tiles for messages', false, true); let mode_edit = new Mode('write ASCII char to map tile', false, false); -let mode_teleport = new Mode('teleport away?'); +let mode_teleport = new Mode('teleport away?', true); let mode_portal = new Mode('add portal to map tile', true, true); let tui = { @@ -358,7 +358,7 @@ let tui = { this.recalc_input_lines(); } else if (mode == mode_teleport) { tui.log_msg("@ May teleport to: " + tui.teleport_target); - tui.log_msg("@ Type Y or y to affirm, other keys to abort."); + tui.log_msg("@ Enter 'YES!' to entusiastically affirm."); } this.full_refresh(); }, @@ -693,6 +693,13 @@ tui.inputEl.addEventListener('keydown', (event) => { } else if (tui.mode == mode_annotate && event.key == 'Enter') { explorer.annotate(tui.inputEl.value); tui.switch_mode(mode_study, true); + } else if (tui.mode == mode_teleport && event.key == 'Enter') { + if (tui.inputEl.value == 'YES!') { + server.reconnect_to(tui.teleport_target); + } else { + tui.log_msg('@ teleport aborted'); + tui.switch_mode(mode_play); + }; } else if (tui.mode == mode_chat && event.key == 'Enter') { let [tokens, token_starts] = parser.tokenize(tui.inputEl.value); if (tokens.length > 0 && tokens[0].length > 0) {