From: Christian Heller Date: Thu, 10 Dec 2020 23:51:47 +0000 (+0100) Subject: On name thing prohibition, switch back to edit mode; disappear help in curses client... X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/all?a=commitdiff_plain;h=87b8e08add4c032f4f0aa7f07f4964719bbc4236;p=plomrogue2 On name thing prohibition, switch back to edit mode; disappear help in curses client upon key press. --- diff --git a/rogue_chat.html b/rogue_chat.html index fe78f6b..51e8078 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -764,10 +764,10 @@ let tui = { }, switch_mode: function(mode_name) { - function fail(msg) { + function fail(msg, return_mode) { tui.log_msg('? ' + msg); terminal.blink_screen(); - this.switch_mode('play'); + this.switch_mode(return_mode); } if (this.mode && this.mode.name == 'control_tile_draw') { @@ -776,13 +776,13 @@ let tui = { this.tile_draw = false; if (mode_name == 'command_thing' && (!game.player.carrying || !game.player.carrying.commandable)) { - return fail('not carrying anything commandable'); + return fail('not carrying anything commandable', 'play'); }; if (mode_name == 'take_thing' && game.player.carrying) { - return fail('already carrying something'); + return fail('already carrying something', 'play'); }; if (mode_name == 'drop_thing' && !game.player.carrying) { - return fail('not carrying anything droppable'); + return fail('not carrying anything droppable', 'play'); } if (mode_name == 'admin_enter' && this.is_admin) { mode_name = 'admin'; @@ -800,7 +800,7 @@ let tui = { } } if (!thing_id) { - return fail('not standing over thing'); + return fail('not standing over thing', 'fail'); } else { this.selected_thing_id = thing_id; } diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index f75877a..8eb70d6 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -629,10 +629,10 @@ class TUI: def switch_mode(self, mode_name): - def fail(msg): + def fail(msg, return_mode='play'): self.log_msg('? ' + msg) self.flash = True - self.switch_mode('play') + self.switch_mode(return_mode) if self.mode and self.mode.name == 'control_tile_draw': self.log_msg('@ finished tile protection drawing.') @@ -655,7 +655,7 @@ class TUI: thing = t break if not thing: - return fail('not standing over thing') + return fail('not standing over thing', 'edit') else: self.thing_selected = thing self.mode = getattr(self, 'mode_' + mode_name) @@ -1087,6 +1087,7 @@ class TUI: keycode = None if len(key) == 1: keycode = ord(key) + self.show_help = False if key == 'KEY_RESIZE': reset_screen_size() elif self.mode.has_input_prompt and key == 'KEY_BACKSPACE':