X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=rogue_chat_curses.py;h=8fc2817cbaf45dd1582a84d83e630f38e2cabb5a;hb=ae71aee13ed42ca8aa7d503746419ef975abc667;hp=657523fbcf3257aca52daaa749a8ad880ed8906f;hpb=028871514fd40755055facc5883a4f8076dcebad;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 657523f..8fc2817 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -463,7 +463,7 @@ class TUI: "command_thing", "take_thing", "drop_thing"] self.mode_play.available_actions = ["move", "teleport", "door", "consume", - "install", "wear"] + "install", "wear", "spin"] self.mode_study.available_modes = ["chat", "play", "admin_enter", "edit"] self.mode_study.available_actions = ["toggle_map_mode", "move_explorer"] self.mode_admin.available_modes = ["admin_thing_protect", "control_pw_type", @@ -513,6 +513,7 @@ class TUI: 'door': 'D', 'install': 'I', 'wear': 'W', + 'spin': 'S', 'help': 'h', 'toggle_map_mode': 'L', 'toggle_tile_draw': 'm', @@ -635,6 +636,12 @@ class TUI: self.flash = True self.switch_mode('play') return + if mode_name == 'drop_thing' and\ + not (hasattr(player, 'carrying' or player.carrying)): + self.log_msg('? not carrying anything droppable') + self.flash = True + self.switch_mode('play') + return if mode_name == 'admin_enter' and self.is_admin: mode_name = 'admin' elif mode_name in {'name_thing', 'admin_thing_protect'}: @@ -1024,6 +1031,7 @@ class TUI: 'wear': '(un-)wear', 'door': 'open/close', 'consume': 'consume', + 'spin': 'spin', } action_tasks = { @@ -1036,6 +1044,7 @@ class TUI: 'move': 'MOVE', 'command': 'COMMAND', 'consume': 'INTOXICATE', + 'spin': 'SPIN', } curses.curs_set(False) # hide cursor @@ -1077,15 +1086,20 @@ class TUI: self.do_refresh = True except curses.error: continue - self.show_help = False + keycode = None + if len(key) == 1: + keycode = ord(key) if key == 'KEY_RESIZE': reset_screen_size() elif self.mode.has_input_prompt and key == 'KEY_BACKSPACE': self.input_ = self.input_[:-1] - elif self.mode.has_input_prompt and key == '\n' and self.input_ == ''\ - and self.mode.name in {'chat', 'command_thing', 'take_thing', - 'drop_thing', 'admin_enter'}: - if self.mode.name != 'chat': + elif (((not self.mode.is_intro) and keycode == 27) # Escape + or (self.mode.has_input_prompt and key == '\n' + and self.input_ == ''\ + and self.mode.name in {'chat', 'command_thing', + 'take_thing', 'drop_thing', + 'admin_enter'})): + if self.mode.name not in {'chat', 'play', 'study', 'edit'}: self.log_msg('@ aborted') self.switch_mode('play') elif self.mode.has_input_prompt and key == '\n' and self.input_ == '/help': @@ -1206,6 +1220,8 @@ class TUI: self.send('TASK:INSTALL') elif key == self.keys['wear'] and task_action_on('wear'): self.send('TASK:WEAR') + elif key == self.keys['spin'] and task_action_on('spin'): + self.send('TASK:SPIN') elif key == self.keys['teleport']: player = self.game.get_thing(self.game.player_id) if player.position in self.game.portals: