X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;ds=sidebyside;f=new%2Fexample_client.py;h=8a0de5060f9c1bc7a144132e7fce64efa5492c84;hb=d33b918833cc762029abf5ca0b6930e16f91e8da;hp=039d8de6bc134f9835c4f70a130a3a4879fb7890;hpb=faf90001efa004054b41df5e2638b6c7c4c1fd98;p=plomrogue2-experiments diff --git a/new/example_client.py b/new/example_client.py index 039d8de..8a0de50 100755 --- a/new/example_client.py +++ b/new/example_client.py @@ -172,6 +172,8 @@ class Game: symbol = '@' elif type_ == 'monster': symbol = 'm' + elif type_ == 'item': + symbol = 'i' return symbol @@ -292,7 +294,10 @@ class MapWidget(Widget): terrain_as_list = list(self.tui.game.world.map_.terrain[:]) for t in self.tui.game.world.things: pos_i = self.tui.game.world.map_.get_position_index(t.position) - terrain_as_list[pos_i] = self.tui.game.symbol_for_type(t.type_) + symbol = self.tui.game.symbol_for_type(t.type_) + if symbol in {'i'} and terrain_as_list[pos_i] in {'@', 'm'}: + continue + terrain_as_list[pos_i] = symbol return ''.join(terrain_as_list) def pad_or_cut_x(lines): @@ -315,6 +320,8 @@ class MapWidget(Widget): for c in ''.join(lines): if c in {'@', 'm'}: chars_with_attrs += [(c, curses.color_pair(1))] + elif c == 'i': + chars_with_attrs += [(c, curses.color_pair(4))] elif c == '.': chars_with_attrs += [(c, curses.color_pair(2))] elif c in {'x', 'X', '#'}: @@ -365,6 +372,7 @@ class TUI: curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_RED) curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_GREEN) curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_BLUE) + curses.init_pair(4, curses.COLOR_BLACK, curses.COLOR_YELLOW) curses.curs_set(False) # hide cursor self.to_send = [] self.edit = EditWidget(self, (0, 6), (1, 14), check_tui = ['edit'])