home · contact · privacy
Mention movement ability in edit mode help.
[plomrogue2] / rogue_chat.html
index 636773d9b8bbc672b76db1dec71b4920544ced02..49fdda0bc8480e7ef0bd2577d63dd6effa031625 100644 (file)
 </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 />
+/ 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>
 <div>
-<a href="https://plomlompom.com/repos/?p=plomrogue2;a=summary">source code</a> (includes proper terminal / curses client)
+keyboard input/control: <span id="keyboard_control"></span>
+</div>
 <h3>button controls for mouse players</h3>
 <table style="float: left">
   <tr>
@@ -132,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': {
@@ -608,13 +610,18 @@ let tui = {
     };
   },
   switch_mode: function(mode_name) {
-    this.inputEl.focus();
+    if (this.mode.name == 'control_tile_draw') {
+        tui.log_msg('@ finished tile protection drawing.')
+    }
     this.map_mode = 'terrain + things';
     this.tile_draw = false;
     if (mode_name == 'admin_enter' && this.is_admin) {
         mode_name = 'admin';
     };
     this.mode = this['mode_' + mode_name];
+    if (this.mode.has_input_prompt || this.mode.is_single_char_entry) {
+        this.inputEl.focus();
+    }
     if (game.player_id in game.things && (this.mode.shows_info || this.mode.name == 'control_tile_draw')) {
         explorer.position = game.things[game.player_id].position;
         if (this.mode.shows_info) {
@@ -681,14 +688,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();
   },
@@ -961,6 +968,9 @@ let tui = {
           content += '\n';
       } else if (this.mode.name == 'edit') {
           content += "Available actions:\n";
+          if (game.tasks.includes('MOVE')) {
+              content += "[" + movement_keys_desc + "] – move player\n";
+          }
           if (game.tasks.includes('FLATTEN_SURROUNDINGS')) {
               content += "[" + tui.keys.flatten + "] – flatten surroundings\n";
           }
@@ -1236,6 +1246,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') {
@@ -1322,7 +1333,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) {
@@ -1377,6 +1388,15 @@ window.setInterval(function() {
         tui.log_msg('@ attempting reconnect …')
     }
 }, 5000);
+window.setInterval(function() {
+    let val = "?";
+    if (document.activeElement == tui.inputEl) {
+        val = "on (click outside terminal to change)";
+    } else {
+        val = "off (click into terminal to change)";
+    };
+    document.getElementById("keyboard_control").textContent = val;
+}, 100);
 document.getElementById("terminal").onclick = function() {
     tui.inputEl.focus();
 };