From: Christian Heller Date: Mon, 7 Mar 2016 00:50:34 +0000 (+0100) Subject: TCE: Add map coloring. X-Git-Tag: tce~76 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/day?a=commitdiff_plain;h=15be45b8bd3fba5cc9779cfe36e8e8a0ea68f081;p=plomrogue TCE: Add map coloring. --- diff --git a/plugins/client/TheCrawlingEater.py b/plugins/client/TheCrawlingEater.py new file mode 100644 index 0000000..7d52bd3 --- /dev/null +++ b/plugins/client/TheCrawlingEater.py @@ -0,0 +1,71 @@ +def win_map(self): + win_size = self.size + offset = [0, 0] + for i in range(2): + if world_data["map_center"][i] * (i + 1) > win_size[i] / 2 and \ + win_size[i] < world_data["map_size"] * (i + 1): + if world_data["map_center"][i] * (i + 1) \ + < world_data["map_size"] * (i + 1) - win_size[i] / 2: + offset[i] = world_data["map_center"][i] * (i + 1) \ + - int(win_size[i] / 2) + if i == 1: + offset[1] = offset[1] + world_data["map_center"][0] % 2 + else: + offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i + winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1] + winmap = [] + curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) + curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK) + curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK) + curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK) + col_unknown = curses.color_pair(1) + col_mem_obstacle = curses.color_pair(2) + col_mem = curses.color_pair(2) + col_ground = curses.color_pair(3) + col_stone = curses.color_pair(4) + col_earth = curses.color_pair(3) + col_player = curses.color_pair(1) + for y in range(world_data["map_size"]): + for x in range(world_data["map_size"]): + pos = y * world_data["map_size"] + x + char = world_data["fov_map"][pos] + if world_data["look_mode"] and y == world_data["map_center"][0] \ + and x == world_data["map_center"][1]: + if char == " ": + char = world_data["mem_map"][pos] + winmap += [(char, curses.A_REVERSE), ("?", curses.A_REVERSE)] + continue + if char == " ": + char = world_data["mem_map"][pos] + attribute = col_mem + if char == " ": + attribute = col_unknown + elif char == "X" or char == "#": + attribute = col_mem_obstacle + bonus = (" ", attribute) + winmap += [(char, attribute), bonus] + else: + attribute = col_stone + if char == ".": + attribute = col_ground + if char == "#": + attribute = col_earth + elif char == "@": + attribute = col_player + bonus = (" ", attribute) + winmap += [(char, attribute), bonus] + if y % 2 == 0: + winmap += " " + return offset, winmap_size, winmap + +from client.config.windows import windows_config +from client.windows import win_log, win_inventory, win_look, win_info +windows_config[:] = [ + {"config": [1, 33], "func": win_info, "title": "Stats"}, + {"config": [-7, 33], "func": win_log, "title": "Log"}, + {"config": [4, 16], "func": win_inventory, "title": "Inventory"}, + {"config": [4, 16], "func": win_look, "title": "Things here"}, + {"config": [0, -34], "func": win_map, "title": "The Crawling Eater"} +] +from client.window_management import set_windows +set_windows() diff --git a/plugins/server/TheCrawlingEater.py b/plugins/server/TheCrawlingEater.py index 71eb14e..d153301 100644 --- a/plugins/server/TheCrawlingEater.py +++ b/plugins/server/TheCrawlingEater.py @@ -55,3 +55,5 @@ import server.config.world_data server.config.world_data.symbols_hide += "#" import server.config.make_world_helpers server.config.make_world_helpers.make_map = make_map + +strong_write(io_db["file_out"], "PLUGIN TheCrawlingEater\n")