The trailer rolls lived in a folder that is gone, so everything was shot again (-demotrailer, -stills) from today's build: new tools, deck props, console, T logo. - 14 store screenshots from the -stills takes - showcase WEBMs and banners rebuilt (Tools/Steam/showcase.py) - the demo trailer is now an edl for cut.py (Tools/Trailer/edl_demo.py) - tools find the project from their own location instead of the old path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
116 lines
6.1 KiB
Python
116 lines
6.1 KiB
Python
"""
|
|
The 33 awards of Assets/Scripts/Core/Achievements.cs as Steam wants them: a table and two 256 px icons each, earned and locked.
|
|
py -I achievements.py writes Docs/Steam/achievements
|
|
"""
|
|
import csv
|
|
import math
|
|
import os
|
|
|
|
from PIL import Image, ImageDraw, ImageEnhance, ImageFont
|
|
|
|
PROJECT = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".."))
|
|
OUT = os.path.join(PROJECT, r"Docs\Steam\achievements")
|
|
FONT = os.path.join(PROJECT, r"Assets\Fonts\LilitaOne-Regular.ttf")
|
|
S = 512
|
|
GOLD, GREEN, BLUE, RUST, CLAY, DUSK, RED = (222, 164, 36), (70, 150, 52), (46, 118, 178), (168, 84, 44), (150, 112, 70), (92, 74, 150), (178, 48, 44)
|
|
|
|
# id, name, description, plate, word, big, top tier
|
|
A = []
|
|
|
|
|
|
def add(id, name, desc, colour, word, big, top=False):
|
|
A.append((id, name, desc, colour, word, big, top))
|
|
|
|
|
|
add("SHIP_1", "First Delivery", "Ship 1 kg of grass", GREEN, "SHIPPED", "1 KG")
|
|
add("SHIP_100", "100 kg for Earth", "Ship 100 kg of grass", GREEN, "SHIPPED", "100 KG")
|
|
add("SHIP_1000", "1,000 kg for Earth", "Ship 1,000 kg of grass", GREEN, "SHIPPED", "1 T")
|
|
add("SHIP_10000", "10,000 kg for Earth", "Ship 10,000 kg of grass", GREEN, "SHIPPED", "10 T")
|
|
add("SHIP_100000", "100,000 kg for Earth", "Ship 100,000 kg of grass", GREEN, "SHIPPED", "100 T", True)
|
|
add("CASH_1000", "$1,000 in the Bank", "Have $1,000 in the crew wallet", GOLD, "BANK", "$1K")
|
|
add("CASH_10000", "$10,000 in the Bank", "Have $10,000 in the crew wallet", GOLD, "BANK", "$10K")
|
|
add("CASH_100000", "$100K in the Bank", "Have $100K in the crew wallet", GOLD, "BANK", "$100K")
|
|
add("CASH_1000000", "$1M in the Bank", "Have $1M in the crew wallet", GOLD, "BANK", "$1M", True)
|
|
add("SECTOR_1", "Clean Sweep", "Mow 1 sector clean", BLUE, "SECTORS", "1")
|
|
add("SECTOR_10", "10 Sectors", "Mow 10 sectors clean", BLUE, "SECTORS", "10")
|
|
add("SECTOR_100", "100 Sectors", "Mow 100 sectors clean", BLUE, "SECTORS", "100")
|
|
add("SECTOR_1000", "1,000 Sectors", "Mow 1,000 sectors clean", BLUE, "SECTORS", "1K")
|
|
add("SECTOR_10000", "10,000 Sectors", "Mow 10,000 sectors clean", BLUE, "SECTORS", "10K", True)
|
|
add("PLANET_1", "0.01% of Herbaria-7", "Mow 0.01% of the planet", RUST, "PLANET", "0.01%")
|
|
add("PLANET_10", "0.1% of Herbaria-7", "Mow 0.1% of the planet", RUST, "PLANET", "0.1%")
|
|
add("PLANET_100", "1% of Herbaria-7", "Mow 1% of the planet", RUST, "PLANET", "1%")
|
|
add("PLANET_1000", "10% of Herbaria-7", "Mow 10% of the planet", RUST, "PLANET", "10%")
|
|
add("PLANET_5000", "50% of Herbaria-7", "Mow 50% of the planet", RUST, "PLANET", "50%")
|
|
add("PLANET_10000", "Herbaria Mown", "Mow 100% of the planet", RUST, "PLANET", "100%", True)
|
|
add("STAKE_1", "Untangled", "Sort out a survey stake", CLAY, "STAKES", "1")
|
|
add("STAKE_50", "Fifty Stakes", "Sort out 50 survey stakes", CLAY, "STAKES", "50")
|
|
add("STAKE_ALL", "Every Last Stake", "Sort out all 195 survey stakes", CLAY, "STAKES", "195", True)
|
|
add("POINT_1", "Surveyor", "Read a survey point", CLAY, "SURVEY", "1")
|
|
add("POINT_ALL", "The Whole Map", "Read all 26 survey points", CLAY, "SURVEY", "26", True)
|
|
add("STATION_1", "Not Alone Out Here", "Find a far station", DUSK, "STATIONS", "1")
|
|
add("STATION_5", "Well Travelled", "Find 5 far stations", DUSK, "STATIONS", "5")
|
|
add("STATION_ALL", "All Twelve", "Find every station", DUSK, "STATIONS", "12", True)
|
|
add("TOOL_SCYTHE", "A Proper Scythe", "Own the Scythe", GREEN, "TOOLS", "SCYTHE")
|
|
add("TOOL_ALL", "Full Tool Belt", "Own every blade on the wall", GREEN, "TOOLS", "ALL", True)
|
|
add("ROBOT_1", "Let the Robot Do It", "Build a robot dock", BLUE, "ROBOTS", "1")
|
|
add("ROBOT_10", "Robot Crew", "Have 10 robots at work", BLUE, "ROBOTS", "10", True)
|
|
add("REAPER", "Fear the Reaper", "Set a Reaper loose", RED, "ROBOTS", "REAPER", True)
|
|
|
|
|
|
def hexagon(cx, cy, r):
|
|
return [(cx + r * math.cos(math.radians(60 * i + 30)), cy + r * math.sin(math.radians(60 * i + 30))) for i in range(6)]
|
|
|
|
|
|
def text(d, cx, cy, s, size, fill=(255, 255, 255), edge=(22, 58, 24)):
|
|
while True:
|
|
font = ImageFont.truetype(FONT, size)
|
|
stroke = max(4, size // 10)
|
|
box = d.textbbox((0, 0), s, font=font, stroke_width=stroke)
|
|
if box[2] - box[0] <= S * 0.6 or size < 40:
|
|
break
|
|
size -= 6
|
|
d.text((cx - (box[0] + box[2]) / 2, cy - (box[1] + box[3]) / 2), s, font=font, fill=fill, stroke_width=stroke, stroke_fill=edge)
|
|
|
|
|
|
def tuft(d, cx, y, w, h, colour):
|
|
n = 7
|
|
for i in range(n):
|
|
x = cx - w / 2 + w * (i + 0.5) / n
|
|
lean = (i - n / 2) * 7
|
|
t = h * (0.7 + 0.3 * ((i * 5) % 3) / 2)
|
|
d.polygon([(x - w / n * 0.8, y), (x + lean, y - t), (x + w / n * 0.8, y)], fill=colour, outline=(22, 58, 24))
|
|
|
|
|
|
def icon(colour, word, big, top):
|
|
im = Image.new("RGB", (S, S), (24, 38, 28))
|
|
d = ImageDraw.Draw(im)
|
|
for y in range(S):
|
|
k = y / S
|
|
d.line([(0, y), (S, y)], fill=(int(30 - k * 12), int(62 - k * 28), int(38 - k * 16)))
|
|
d.polygon(hexagon(S / 2, S / 2 + 12, 226), fill=(22, 58, 24))
|
|
d.polygon(hexagon(S / 2, S / 2 + 12, 212), fill=(255, 255, 255))
|
|
d.polygon(hexagon(S / 2, S / 2 + 12, 196), fill=colour)
|
|
dark = tuple(int(c * 0.82) for c in colour)
|
|
d.polygon(hexagon(S / 2, S / 2 + 12, 150), fill=dark)
|
|
tuft(d, S / 2, 104, 190, 70, (110, 214, 60) if not top else (255, 214, 72))
|
|
text(d, S / 2, 160, word, 54)
|
|
text(d, S / 2, 292, big, 124)
|
|
return im.resize((256, 256), Image.LANCZOS)
|
|
|
|
|
|
os.makedirs(OUT, exist_ok=True)
|
|
with open(os.path.join(OUT, "achievements.csv"), "w", newline="", encoding="utf-8") as f:
|
|
w = csv.writer(f)
|
|
w.writerow(["api_name", "display_name", "description"])
|
|
for id, name, desc, colour, word, big, top in A:
|
|
w.writerow([id, name, desc])
|
|
on = icon(colour, word, big, top)
|
|
on.save(os.path.join(OUT, id + ".png"), optimize=True)
|
|
off = ImageEnhance.Brightness(ImageEnhance.Color(on).enhance(0.0)).enhance(0.55)
|
|
off.save(os.path.join(OUT, id + "_locked.png"), optimize=True)
|
|
print(len(A), "awards")
|
|
sheet = Image.new("RGB", (11 * 130, 3 * 130), (27, 40, 56))
|
|
for i, a in enumerate(A):
|
|
sheet.paste(Image.open(os.path.join(OUT, a[0] + ".png")).resize((126, 126)), ((i % 11) * 130 + 2, (i // 11) * 130 + 2))
|
|
sheet.save(os.path.join(OUT, "_sheet.jpg"), quality=88)
|