X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=rogue_chat_curses.py;h=c26c3805a0ec092c6e4ff8affead14a222c7127f;hb=feb0ffb7c7523ddee0cbd685cbc9c2e768a56cbd;hp=07c8697fc71d160cf63d9f43914f2d1ed64d58ec;hpb=2760d30c1b9cb8d68c0bdaf1449d3b17eed87ac0;p=plomrogue2 diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 07c8697..c26c380 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -29,7 +29,7 @@ mode_helps = { 'name_thing': { 'short': 'name thing', 'intro': '', - 'long': 'Give name to/change name of thing here.' + 'long': 'Give name to/change name of carried thing.' }, 'command_thing': { 'short': 'command', @@ -49,7 +49,7 @@ mode_helps = { 'admin_thing_protect': { 'short': 'change thing protection', 'intro': '@ enter thing protection character:', - 'long': 'Change protection character for thing here.' + 'long': 'Change protection character for carried thing.' }, 'enter_face': { 'short': 'edit face', @@ -342,7 +342,7 @@ def cmd_THING_INSTALLED(game, thing_id): cmd_THING_INSTALLED.argtypes = 'int:pos' def cmd_THING_CARRYING(game, thing_id, carried_id): - game.get_thing_temp(thing_id).carrying = game.get_thing(carried_id) + game.get_thing_temp(thing_id).carrying = game.get_thing_temp(carried_id) cmd_THING_CARRYING.argtypes = 'int:pos int:pos' def cmd_TERRAIN(game, terrain_char, terrain_desc): @@ -514,7 +514,8 @@ class TUI: self.mode_control_tile_draw.available_actions = ["move_explorer", "toggle_tile_draw"] self.mode_edit.available_modes = ["write", "annotate", "portal", - "name_thing", "enter_face", "enter_hat", "password", + "name_thing", "enter_face", "enter_hat", + "password", "chat", "study", "play", "admin_enter"] self.mode_edit.available_actions = ["move", "flatten", "install", "toggle_map_mode"] @@ -649,11 +650,11 @@ class TUI: elif self.mode.name == 'password': self.input_ = self.password elif self.mode.name == 'name_thing': - if hasattr(self.thing_selected, 'name'): - self.input_ = self.thing_selected.name + if hasattr(self.game.player.carrying, 'name'): + self.input_ = self.game.player.carrying.name elif self.mode.name == 'admin_thing_protect': - if hasattr(self.thing_selected, 'protection'): - self.input_ = self.thing_selected.protection + if hasattr(self.game.player.carrying, 'protection'): + self.input_ = self.game.player.carrying.protection elif self.mode.name in {'enter_face', 'enter_hat'}: start = self.ascii_draw_stage * 6 end = (self.ascii_draw_stage + 1) * 6 @@ -691,6 +692,10 @@ class TUI: (not self.game.player.carrying or 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') + 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: return fail('already carrying something') if mode_name == 'drop_thing' and not self.game.player.carrying: @@ -699,17 +704,6 @@ class TUI: 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'}: - thing = None - for t in [t for t in self.game.things - if t.position == self.game.player.position - and t.id_ != self.game.player.id_]: - thing = t - break - if not thing: - return fail('not standing over thing', 'edit') - else: - self.thing_selected = thing self.mode = getattr(self, 'mode_' + mode_name) if self.mode.name in {'control_tile_draw', 'control_tile_type', 'control_pw_type'}: @@ -1250,8 +1244,7 @@ class TUI: if len(self.input_) != 1: self.log_msg('@ entered non-single-char, therefore aborted') else: - self.send('THING_PROTECTION %s %s' % (self.thing_selected.id_, - quote(self.input_))) + self.send('THING_PROTECTION %s' % (quote(self.input_))) self.log_msg('@ sent new protection character for thing') self.switch_mode('admin') elif self.mode.name == 'control_tile_type' and key == '\n': @@ -1279,9 +1272,8 @@ class TUI: elif self.mode.name == 'name_thing' and key == '\n': if self.input_ == '': self.input_ = ' ' - self.send('THING_NAME %s %s %s' % (self.thing_selected.id_, - quote(self.input_), - quote(self.password))) + self.send('THING_NAME %s %s' % (quote(self.input_), + quote(self.password))) self.switch_mode('edit') elif self.mode.name == 'annotate' and key == '\n': if self.input_ == '':