X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=rogue_chat_curses.py;h=cb5042d5a8d4b620448083e3a8a2b31363b83e71;hb=a89dfb987b200eab956b920d5f3393e68f08b9bf;hp=e5c2dad6e63feab72339c7ed54c61202cf15623b;hpb=904563ed3077b2ce6cc884c8e1f66b68a0d292b5;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index e5c2dad..cb5042d 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -179,7 +179,7 @@ cmd_THING_NAME.argtypes = 'int:nonneg string' def cmd_THING_CHAR(game, thing_id, c): t = game.get_thing(thing_id) if t: - t.player_char = c + t.thing_char = c cmd_THING_CHAR.argtypes = 'int:nonneg char' def cmd_MAP(game, geometry, size, content): @@ -383,19 +383,20 @@ class TUI: import json self.mode_play.available_modes = ["chat", "study", "edit", "admin_enter"] self.mode_play.available_actions = ["move", "take_thing", "drop_thing", - "teleport"] + "teleport", "door"] 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_edit.available_actions = ["move", "flatten", "toggle_map_mode"] - self.mode_control_tile_draw.available_actions = ["toggle_tile_draw"] self.mode_control_tile_draw.available_modes = ["admin_enter"] + self.mode_control_tile_draw.available_actions = ["move_explorer", + "toggle_tile_draw"] self.mode_edit.available_modes = ["write", "annotate", "portal", "name_thing", "password", "chat", "study", "play", "admin_enter"] + self.mode_edit.available_actions = ["move", "flatten", "toggle_map_mode"] self.mode = None self.host = host self.game = Game() @@ -426,6 +427,7 @@ class TUI: 'take_thing': 'z', 'drop_thing': 'u', 'teleport': 'p', + 'door': 'D', 'help': 'h', 'toggle_map_mode': 'L', 'toggle_tile_draw': 'm', @@ -689,14 +691,14 @@ class TUI: if t.position == self.explorer: protection = t.protection if protection == '.': - protection = 'unprotected' - info += 'THING: %s / protection: %s / %s' %\ - (t.type_, protection, self.game.thing_types[t.type_]) - if hasattr(t, 'player_char'): - info += t.player_char + protection = 'none' + info += 'THING: %s / %s' % (t.type_, + self.game.thing_types[t.type_]) + if hasattr(t, 'thing_char'): + info += t.thing_char if hasattr(t, 'name'): info += ' (%s)' % t.name - info += '\n' + info += ' / protection: %s\n' % protection if self.explorer in self.game.portals: info += 'PORTAL: ' + self.game.portals[self.explorer] + '\n' else: @@ -755,8 +757,8 @@ class TUI: for t in self.game.things: symbol = self.game.thing_types[t.type_] meta_char = ' ' - if hasattr(t, 'player_char'): - meta_char = t.player_char + if hasattr(t, 'thing_char'): + meta_char = t.thing_char if t.position in used_positions: meta_char = '+' map_lines_split[t.position.y][t.position.x] = symbol + meta_char @@ -856,13 +858,15 @@ class TUI: 'drop_thing': 'drop thing', 'toggle_map_mode': 'toggle map view', 'toggle_tile_draw': 'toggle protection character drawing', + 'door': 'open/close', } action_tasks = { 'flatten': 'FLATTEN_SURROUNDINGS', 'take_thing': 'PICK_UP', 'drop_thing': 'DROP', - 'move': 'MOVE' + 'door': 'DOOR', + 'move': 'MOVE', } curses.curs_set(False) # hide cursor @@ -1015,6 +1019,8 @@ class TUI: self.send('TASK:PICK_UP') elif key == self.keys['drop_thing'] and task_action_on('drop_thing'): self.send('TASK:DROP') + elif key == self.keys['door'] and task_action_on('door'): + self.send('TASK:DOOR') elif key == self.keys['teleport']: player = self.game.get_thing(self.game.player_id) if player.position in self.game.portals: @@ -1023,7 +1029,7 @@ class TUI: else: self.flash = True self.log_msg('? not standing on portal') - elif key in self.movement_keys and task_action_on('move'):# 'MOVE' in self.game.tasks: + elif key in self.movement_keys and task_action_on('move'): self.send('TASK:MOVE ' + self.movement_keys[key]) elif self.mode.name == 'write': self.send('TASK:WRITE %s %s' % (key, quote(self.password)))