1
Fork 0
mirror of https://github.com/Steffo99/flyingsnake.git synced 2024-10-16 14:37:34 +00:00

Fill missing colors with #FF00FF

This commit is contained in:
Steffo 2020-06-28 17:12:56 +02:00
parent 4d26a53e87
commit 3b0c1233e5
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
2 changed files with 20 additions and 19 deletions

View file

@ -1,5 +1,6 @@
import click as c import click as c
import lihzahrd as li import lihzahrd as li
import lihzahrd.enums as le
import json import json
import typing import typing
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
@ -142,19 +143,19 @@ def flyingsnake(input_file: str,
curr_y = 0 curr_y = 0
if min_y <= world.underground_level: if min_y <= world.underground_level:
sky_y = min(world.underground_level - min_y, height) sky_y = min(world.underground_level - min_y, height)
draw.rectangle(((0, curr_y), (width, sky_y)), tuple(colors["Globals"]["Sky"])) draw.rectangle(((0, curr_y), (width, sky_y)), tuple(colors["Globals"].get("Sky", (255, 0, 255, 255))))
curr_y = sky_y + 1 curr_y = sky_y + 1
if max_y > world.underground_level and min_y <= world.cavern_level: if max_y > world.underground_level and min_y <= world.cavern_level:
earth_y = min(world.cavern_level - min_y, height) earth_y = min(world.cavern_level - min_y, height)
draw.rectangle(((0, curr_y), (width, earth_y)), tuple(colors["Globals"]["Earth"])) draw.rectangle(((0, curr_y), (width, earth_y)), tuple(colors["Globals"].get("Earth", (255, 0, 255, 255))))
curr_y = earth_y + 1 curr_y = earth_y + 1
edge_of_rock = world.size.y - 192 edge_of_rock = world.size.y - 192
if max_y > world.cavern_level and min_y <= edge_of_rock: if max_y > world.cavern_level and min_y <= edge_of_rock:
rock_y = min(edge_of_rock - min_y, height) rock_y = min(edge_of_rock - min_y, height)
draw.rectangle(((0, curr_y), (width, rock_y)), tuple(colors["Globals"]["Rock"])) draw.rectangle(((0, curr_y), (width, rock_y)), tuple(colors["Globals"].get("Rock", (255, 0, 255, 255))))
curr_y = rock_y + 1 curr_y = rock_y + 1
if max_y > edge_of_rock: if max_y > edge_of_rock:
draw.rectangle(((0, curr_y), (width, height)), tuple(colors["Globals"]["Hell"])) draw.rectangle(((0, curr_y), (width, height)), tuple(colors["Globals"].get("Hell", (255, 0, 255, 255))))
del draw del draw
to_merge.append(background) to_merge.append(background)
@ -167,9 +168,9 @@ def flyingsnake(input_file: str,
tile = world.tiles[x, y] tile = world.tiles[x, y]
if tile.wall: if tile.wall:
if draw_paint and tile.wall.paint: if draw_paint and tile.wall.paint:
color = tuple(colors["Paints"][str(tile.wall.paint)]) color = tuple(colors["Paints"].get(str(tile.wall.paint), (255, 0, 255, 255)))
else: else:
color = tuple(colors["Walls"][str(tile.wall.type.value)]) color = tuple(colors["Walls"].get(str(tile.wall.type.value), (255, 0, 255, 255)))
draw.point((x - min_x, y - min_y), color) draw.point((x - min_x, y - min_y), color)
if not x % 100: if not x % 100:
c.echo(f"{x} / {width} rows done") c.echo(f"{x} / {width} rows done")
@ -184,12 +185,12 @@ def flyingsnake(input_file: str,
for y in range(min_y, max_y): for y in range(min_y, max_y):
tile = world.tiles[x, y] tile = world.tiles[x, y]
if tile.liquid: if tile.liquid:
if tile.liquid.type == li.tiles.LiquidType.WATER: if tile.liquid.type == le.LiquidType.WATER:
color = tuple(colors["Globals"]["Water"]) color = tuple(colors["Globals"].get("Water", (255, 0, 255, 255)))
elif tile.liquid.type == li.tiles.LiquidType.LAVA: elif tile.liquid.type == le.LiquidType.LAVA:
color = tuple(colors["Globals"]["Lava"]) color = tuple(colors["Globals"].get("Lava", (255, 0, 255, 255)))
elif tile.liquid.type == li.tiles.LiquidType.HONEY: elif tile.liquid.type == le.LiquidType.HONEY:
color = tuple(colors["Globals"]["Honey"]) color = tuple(colors["Globals"].get("Honey", (255, 0, 255, 255)))
else: else:
continue continue
draw.point((x - min_x, y - min_y), color) draw.point((x - min_x, y - min_y), color)
@ -207,9 +208,9 @@ def flyingsnake(input_file: str,
tile = world.tiles[x, y] tile = world.tiles[x, y]
if tile.block: if tile.block:
if draw_paint and tile.block.paint: if draw_paint and tile.block.paint:
color = tuple(colors["Paints"][str(tile.block.paint)]) color = tuple(colors["Paints"].get(str(tile.block.paint), (255, 0, 255, 255)))
else: else:
color = tuple(colors["Blocks"][str(tile.block.type.value)]) color = tuple(colors["Blocks"].get(str(tile.block.type.value), (255, 0, 255, 255)))
draw.point((x - min_x, y - min_y), color) draw.point((x - min_x, y - min_y), color)
if not x % 100: if not x % 100:
c.echo(f"{x} / {width} rows done") c.echo(f"{x} / {width} rows done")
@ -225,13 +226,13 @@ def flyingsnake(input_file: str,
tile = world.tiles[x, y] tile = world.tiles[x, y]
if tile.wiring: if tile.wiring:
if tile.wiring.red: if tile.wiring.red:
color = tuple(colors["Globals"]["Wire"]) color = tuple(colors["Globals"].get("Wire", (255, 0, 255, 255)))
elif tile.wiring.blue: elif tile.wiring.blue:
color = tuple(colors["Globals"]["Wire1"]) color = tuple(colors["Globals"].get("Wire1", (255, 0, 255, 255)))
elif tile.wiring.green: elif tile.wiring.green:
color = tuple(colors["Globals"]["Wire2"]) color = tuple(colors["Globals"].get("Wire2", (255, 0, 255, 255)))
elif tile.wiring.yellow: elif tile.wiring.yellow:
color = tuple(colors["Globals"]["Wire3"]) color = tuple(colors["Globals"].get("Wire3", (255, 0, 255, 255)))
else: else:
continue continue
draw.point((x - min_x, y - min_y), color) draw.point((x - min_x, y - min_y), color)

File diff suppressed because one or more lines are too long