From: Christian Heller Date: Sun, 13 Dec 2020 04:31:33 +0000 (+0100) Subject: Don't enter enter_hat menu in client if not wearing hat. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/git-logo.png?a=commitdiff_plain;h=0ae5c165fbce33fcdc60f92cceb18109124aabde;p=plomrogue2 Don't enter enter_hat menu in client if not wearing hat. --- diff --git a/rogue_chat.html b/rogue_chat.html index 4285ded..26322e9 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -794,15 +794,15 @@ let tui = { } this.draw_face = false; this.tile_draw = false; - if (mode_name == 'command_thing' && (!game.player.carrying - || !game.player.carrying.commandable)) { + if (mode_name == 'command_thing' && (!game.player.carrying + || !game.player.carrying.commandable)) { return fail('not carrying anything commandable', 'play'); - }; - if (mode_name == 'take_thing' && game.player.carrying) { + } else if (mode_name == 'take_thing' && game.player.carrying) { return fail('already carrying something', 'play'); - }; - if (mode_name == 'drop_thing' && !game.player.carrying) { + } else if (mode_name == 'drop_thing' && !game.player.carrying) { return fail('not carrying anything droppable', 'play'); + } else if (mode_name == 'enter_hat' && !game.player.hat) { + return fail('not wearing hat to edit', 'edit'); } if (mode_name == 'admin_enter' && this.is_admin) { mode_name = 'admin'; diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index e9f7f6b..9519a95 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -686,6 +686,8 @@ class TUI: return fail('already carrying something') if mode_name == 'drop_thing' and not self.game.player.carrying: return fail('not carrying anything droppable') + if mode_name == 'enter_hat' and not hasattr(self.game.player, 'hat'): + return fail('not wearing hat to edit', 'edit') if mode_name == 'admin_enter' and self.is_admin: mode_name = 'admin' elif mode_name in {'name_thing', 'admin_thing_protect'}: