home · contact · privacy
Add escape key "panic button" to return to play mode, whatever.
[plomrogue2] / rogue_chat.html
index 9740fff34c7b251509d4e7b40d341fdf98282481..ebe64f2041fe4a4f755da1bea1a670185c23cdc2 100644 (file)
@@ -19,7 +19,7 @@ terminal rows: <input id="n_rows" type="number" step=4 min=24 value=24 />
 <div>
 keyboard input/control: <span id="keyboard_control"></span>
 </div>
-<h3>button controls for mouse players</h3>
+<h3>button controls for hard-to-remember keybindings</h3>
 <table id="move_table" style="float: left">
   <tr>
     <td style="text-align: right"><button id="hex_move_upleft"></button></td>
@@ -1472,11 +1472,12 @@ tui.inputEl.addEventListener('keydown', (event) => {
     if (event.key == 'Enter') {
         event.preventDefault();
     }
-    if (tui.mode.has_input_prompt && event.key == 'Enter'
-        && tui.inputEl.value.length == 0
-        && ['chat', 'command_thing', 'take_thing', 'drop_thing',
-            'admin_enter'].includes(tui.mode.name)) {
-        if (tui.mode.name != 'chat') {
+    if ((!tui.mode.is_intro && event.key == 'Escape')
+        || (tui.mode.has_input_prompt && event.key == 'Enter'
+            && tui.inputEl.value.length == 0
+            && ['chat', 'command_thing', 'take_thing', 'drop_thing',
+                'admin_enter'].includes(tui.mode.name))) {
+        if (!['chat', 'play', 'study', 'edit'].includes(tui.mode.name)) {
             tui.log_msg('@ aborted');
         }
         tui.switch_mode('play');