Fix fg/bg custom colors
This commit is contained in:
		@@ -26,13 +26,11 @@ class MapDisplay(Display):
 | 
				
			|||||||
            for i in range(len(self.map.tiles[j])):
 | 
					            for i in range(len(self.map.tiles[j])):
 | 
				
			||||||
                if not self.map.seen_tiles[j][i]:
 | 
					                if not self.map.seen_tiles[j][i]:
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
                color = self.pack.tile_fg_visible_color if \
 | 
					                fg, bg = self.map.tiles[j][i].visible_color(self.pack) if \
 | 
				
			||||||
                    self.map.visibility[j][i] else self.pack.tile_fg_color
 | 
					                    self.map.visibility[j][i] else \
 | 
				
			||||||
 | 
					                    self.map.tiles[j][i].hidden_color(self.pack)
 | 
				
			||||||
                self.addstr(self.pad, j, self.pack.tile_width * i,
 | 
					                self.addstr(self.pad, j, self.pack.tile_width * i,
 | 
				
			||||||
                            self.map.tiles[j][i].char(self.pack),
 | 
					                            self.map.tiles[j][i].char(self.pack), fg, bg)
 | 
				
			||||||
                            color, self.pack.tile_bg_color)
 | 
					 | 
				
			||||||
        # self.addstr(self.pad, 0, 0, self.map.draw_string(self.pack),
 | 
					 | 
				
			||||||
        #             self.pack.tile_fg_color, self.pack.tile_bg_color)
 | 
					 | 
				
			||||||
        for e in self.map.entities:
 | 
					        for e in self.map.entities:
 | 
				
			||||||
            if self.map.visibility[e.y][e.x]:
 | 
					            if self.map.visibility[e.y][e.x]:
 | 
				
			||||||
                self.addstr(self.pad, e.y, self.pack.tile_width * e.x,
 | 
					                self.addstr(self.pad, e.y, self.pack.tile_width * e.x,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,8 @@ TexturePack.SQUIRREL_PACK = TexturePack(
 | 
				
			|||||||
    EMPTY='  ',
 | 
					    EMPTY='  ',
 | 
				
			||||||
    EXPLOSION='💥',
 | 
					    EXPLOSION='💥',
 | 
				
			||||||
    FLOOR='██',
 | 
					    FLOOR='██',
 | 
				
			||||||
    LADDER=('🪜', curses.COLOR_WHITE, curses.COLOR_WHITE),
 | 
					    LADDER=('🪜', curses.COLOR_WHITE, (1000, 1000, 1000),
 | 
				
			||||||
 | 
					            curses.COLOR_WHITE, (1000, 1000, 1000)),
 | 
				
			||||||
    HAZELNUT='🌰',
 | 
					    HAZELNUT='🌰',
 | 
				
			||||||
    HEART='💜',
 | 
					    HEART='💜',
 | 
				
			||||||
    HEDGEHOG='🦔',
 | 
					    HEDGEHOG='🦔',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -383,12 +383,21 @@ class Tile(Enum):
 | 
				
			|||||||
        val = getattr(pack, self.name)
 | 
					        val = getattr(pack, self.name)
 | 
				
			||||||
        return val[0] if isinstance(val, tuple) else val
 | 
					        return val[0] if isinstance(val, tuple) else val
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def color(self, pack: TexturePack) -> Tuple[int, int]:
 | 
					    def visible_color(self, pack: TexturePack) -> Tuple[int, int]:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Retrieve the tuple (fg_color, bg_color) of the current Tile
 | 
				
			||||||
 | 
					        if it is visible.
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        val = getattr(pack, self.name)
 | 
				
			||||||
 | 
					        return (val[2], val[4]) if isinstance(val, tuple) else \
 | 
				
			||||||
 | 
					            (pack.tile_fg_visible_color, pack.tile_bg_color)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def hidden_color(self, pack: TexturePack) -> Tuple[int, int]:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Retrieve the tuple (fg_color, bg_color) of the current Tile.
 | 
					        Retrieve the tuple (fg_color, bg_color) of the current Tile.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        val = getattr(pack, self.name)
 | 
					        val = getattr(pack, self.name)
 | 
				
			||||||
        return (val[1], val[2]) if isinstance(val, tuple) else \
 | 
					        return (val[1], val[3]) if isinstance(val, tuple) else \
 | 
				
			||||||
            (pack.tile_fg_color, pack.tile_bg_color)
 | 
					            (pack.tile_fg_color, pack.tile_bg_color)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def is_wall(self) -> bool:
 | 
					    def is_wall(self) -> bool:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user