From: Christian Heller Date: Fri, 18 Dec 2020 22:19:23 +0000 (+0100) Subject: Enable map mode toggling in admin mode. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/add_structured?a=commitdiff_plain;h=a7b082cab5ac4cf0580ce55cf2862a883c4da575;p=plomrogue2 Enable map mode toggling in admin mode. --- diff --git a/rogue_chat.html b/rogue_chat.html index a09892d..45f04a6 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -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", @@ -1716,6 +1716,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]]); }; diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 57c3750..72fc0a7 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -518,7 +518,7 @@ class TUI: self.mode_admin.available_modes = ["admin_thing_protect", "control_pw_type", "control_tile_type", "chat", "study", "play", "edit"] - self.mode_admin.available_actions = ["move"] + self.mode_admin.available_actions = ["move", "toggle_map_mode"] self.mode_control_tile_draw.available_modes = ["admin_enter"] self.mode_control_tile_draw.available_actions = ["move_explorer", "toggle_tile_draw"] @@ -1364,6 +1364,8 @@ class TUI: elif self.mode.name == 'admin': if self.mode.mode_switch_on_key(self, key): continue + elif key == self.keys['toggle_map_mode']: + self.toggle_map_mode() elif key in self.movement_keys and task_action_on('move'): self.send('TASK:MOVE ' + self.movement_keys[key]) elif self.mode.name == 'edit':