X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=rogue_chat_curses.py;h=f7ac8cf0bf33c492eac88482d18f7c0b1a9c7c9b;hb=2dc444966037a42b51ed190ab0eab88a09c0282a;hp=ec9eee5b276b1373a77588b2cfc01a78e1625545;hpb=dfb05774efac717d1adc699e97b6140599e5df1e;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index ec9eee5..f7ac8cf 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -186,7 +186,9 @@ cmd_OTHER_WIPE.argtypes = '' def cmd_LOGIN_OK(game): game.tui.switch_mode('post_login_wait') game.tui.send('GET_GAMESTATE') - game.tui.log_msg('@ welcome') + game.tui.log_msg('@ welcome!') + game.tui.log_msg('@ hint: see top of terminal for how to get help.') + game.tui.log_msg('@ hint: enter study mode to understand your environment.') cmd_LOGIN_OK.argtypes = '' def cmd_ADMIN_OK(game): @@ -294,7 +296,7 @@ def cmd_GAME_STATE_COMPLETE(game): game.player = game.get_thing(game.player_id) game.players_hat_chars = game.players_hat_chars_new game.bladder_pressure = game.bladder_pressure_new - game.weariness = game.weariness_new + game.energy = game.energy_new game.turn_complete = True if game.tui.mode.name == 'post_login_wait': game.tui.switch_mode('play') @@ -362,10 +364,10 @@ def cmd_RANDOM_COLORS(game): game.tui.set_random_colors() cmd_RANDOM_COLORS.argtypes = '' -def cmd_STATS(game, bladder_pressure, weariness): +def cmd_STATS(game, bladder_pressure, energy): game.bladder_pressure_new = bladder_pressure - game.weariness_new = weariness -cmd_STATS.argtypes = 'int:nonneg int:nonneg' + game.energy_new = energy +cmd_STATS.argtypes = 'int:nonneg int' class Game(GameBase): turn_complete = False @@ -510,13 +512,13 @@ class TUI: "command_thing", "take_thing", "drop_thing"] self.mode_play.available_actions = ["move", "teleport", "door", "consume", - "install", "wear", "spin"] + "install", "wear", "spin", "dance"] 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", "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"] @@ -564,6 +566,7 @@ class TUI: 'install': 'I', 'wear': 'W', 'spin': 'S', + 'dance': 'T', 'help': 'h', 'toggle_map_mode': 'L', 'toggle_tile_draw': 'm', @@ -700,7 +703,7 @@ class TUI: not self.game.player.carrying.commandable): return fail('not carrying anything commandable') if mode_name == 'name_thing' and not self.game.player.carrying: - return fail('not carrying anything to re-name') + return fail('not carrying anything to re-name', 'edit') if mode_name == 'admin_thing_protect' and not self.game.player.carrying: return fail('not carrying anything to protect') if mode_name == 'take_thing' and self.game.player.carrying: @@ -944,8 +947,8 @@ class TUI: y += 1 def draw_stats(): - stats = 'WEARY: %s BLADDER: %s' % (self.game.weariness, - self.game.bladder_pressure) + stats = 'ENERGY: %s BLADDER: %s' % (self.game.energy, + self.game.bladder_pressure) safe_addstr(0, self.window_width, stats) def draw_mode(): @@ -1114,9 +1117,11 @@ class TUI: self.switch_mode('play') def enter_ascii_art(command): - if len(self.input_) != 6: - self.log_msg('? wrong input length, must be 6; try again') + if len(self.input_) > 6: + self.log_msg('? wrong input length, must be max 6; try again') return + if len(self.input_) < 6: + self.input_ += ' ' * (6 - len(self.input_)) self.log_msg(' ' + self.input_) self.full_ascii_draw += self.input_ self.ascii_draw_stage += 1 @@ -1142,6 +1147,7 @@ class TUI: 'door': 'open/close', 'consume': 'consume', 'spin': 'spin', + 'dance': 'dance', } action_tasks = { @@ -1155,6 +1161,7 @@ class TUI: 'command': 'COMMAND', 'consume': 'INTOXICATE', 'spin': 'SPIN', + 'dance': 'DANCE', } curses.curs_set(False) # hide cursor @@ -1165,6 +1172,7 @@ class TUI: reset_screen_size() self.explorer = YX(0, 0) self.input_ = '' + store_widechar = False input_prompt = '> ' interval = datetime.timedelta(seconds=5) last_ping = datetime.datetime.now() - interval @@ -1199,6 +1207,13 @@ class TUI: keycode = None if len(key) == 1: keycode = ord(key) + # workaround for + if store_widechar: + store_widechar = False + key = bytes([195, keycode]).decode() + if keycode == 195: + store_widechar = True + continue self.show_help = False self.draw_face = False if key == 'KEY_RESIZE': @@ -1327,6 +1342,8 @@ class TUI: self.send('TASK:WEAR') elif key == self.keys['spin'] and task_action_on('spin'): self.send('TASK:SPIN') + elif key == self.keys['dance'] and task_action_on('dance'): + self.send('TASK:DANCE') elif key == self.keys['teleport']: if self.game.player.position in self.game.portals: self.host = self.game.portals[self.game.player.position] @@ -1349,6 +1366,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':