home · contact · privacy
In ASCII art drawing mode, pad short lines with whitespace to tolerate them.
[plomrogue2] / rogue_chat.html
index 6497fa9a1832262b612abf203a9c06cdad0a7dfd..82bfbed97fd8902e48aca9e86bb8ec3e15c109eb 100644 (file)
@@ -745,7 +745,7 @@ let tui = {
       this.mode_admin.available_modes = ["admin_thing_protect", "control_pw_type",
                                          "control_tile_type", "chat",
                                          "study", "play", "edit"]
-      this.mode_admin.available_actions = ["move"];
+      this.mode_admin.available_actions = ["move", "toggle_map_mode"];
       this.mode_control_tile_draw.available_modes = ["admin_enter"]
       this.mode_control_tile_draw.available_actions = ["toggle_tile_draw"];
       this.mode_edit.available_modes = ["write", "annotate", "portal", "name_thing",
@@ -813,7 +813,7 @@ let tui = {
                                          || !game.player.carrying.commandable)) {
         return fail('not carrying anything commandable');
     } else if (mode_name == 'name_thing' && !game.player.carrying) {
-        return fail('not carrying anything to re-name');
+        return fail('not carrying anything to re-name', 'edit');
     } else if (mode_name == 'admin_thing_protect' && !game.player.carrying) {
         return fail('not carrying anything to protect')
     } else if (mode_name == 'take_thing' && game.player.carrying) {
@@ -1069,9 +1069,13 @@ let tui = {
       this.switch_mode('play');
   },
   enter_ascii_art: function(command) {
-      if (this.inputEl.value.length != 6) {
-          this.log_msg('? wrong input length, must be 6; try again');
+      if (this.inputEl.value.length > 6) {
+          this.log_msg('? wrong input length, must be max 6; try again');
           return;
+      } else if (this.inputEl.value.length < 6) {
+          while (this.inputEl.value.length < 6) {
+              this.inputEl.value += ' ';
+          }
       }
       this.log_msg('  ' + this.inputEl.value);
       this.full_ascii_draw += this.inputEl.value;
@@ -1716,6 +1720,8 @@ tui.inputEl.addEventListener('keydown', (event) => {
     } else if (tui.mode.name == 'admin') {
         if (tui.mode.mode_switch_on_key(event)) {
               null;
+        } else if (event.key == tui.keys.toggle_map_mode) {
+            tui.toggle_map_mode();
         } else if (event.key in tui.movement_keys && tui.task_action_on('move')) {
             server.send(['TASK:MOVE', tui.movement_keys[event.key]]);
         };
@@ -1768,7 +1774,10 @@ window.setInterval(function() {
 }, 1000);
 window.setInterval(function() {
     if (document.activeElement.tagName.toLowerCase() != 'input') {
+        const scroll_x = window.scrollX;
+        const scroll_y = window.scrollY;
         tui.inputEl.focus();
+        window.scrollTo(scroll_x, scroll_y);
     };
 }, 100);
 document.getElementById("help").onclick = function() {
@@ -1804,6 +1813,9 @@ document.getElementById("install").onclick = function() {
 document.getElementById("wear").onclick = function() {
     server.send(['TASK:WEAR']);
 };
+document.getElementById("spin").onclick = function() {
+    server.send(['TASK:SPIN']);
+};
 document.getElementById("dance").onclick = function() {
     server.send(['TASK:DANCE']);
 };