From 382edede11fc6b3ca318abc50f7b4091c1d31376 Mon Sep 17 00:00:00 2001 From: filoxenace Date: Wed, 25 Mar 2026 22:28:07 -0400 Subject: [PATCH] feat: move createFaceByBundle.py to codegen.py and add mesh scraping --- scripts/{createFaceByBundle.py => codegen.py} | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) rename scripts/{createFaceByBundle.py => codegen.py} (50%) diff --git a/scripts/createFaceByBundle.py b/scripts/codegen.py similarity index 50% rename from scripts/createFaceByBundle.py rename to scripts/codegen.py index dad90e7..b93d5b2 100644 --- a/scripts/createFaceByBundle.py +++ b/scripts/codegen.py @@ -54,3 +54,48 @@ lines.append("return faceByBundle") with open("../src/faceByBundle.luau", mode="w") as f: f.write("\n".join(lines) + "\n") + +mesh_face_dict = {} + +for face, bundle_id in bundle_face_dict.items(): + if bundle_id is None: + continue + delay = 1.0 + for attempt in range(5): + try: + response = requests.get(url=f"https://catalog.roblox.com/v1/bundles/{bundle_id}/details") + if response.status_code == 429: + print(f"Rate limited on bundle {bundle_id}, retrying in {delay}s...") + time.sleep(delay) + delay *= 2 + continue + response.raise_for_status() + break + except requests.exceptions.ConnectionError: + if attempt == 4: + raise + print(f"Connection error for bundle {bundle_id}, retrying in {delay}s...") + time.sleep(delay) + delay *= 2 + else: + print(f"Skipping bundle {bundle_id} after 5 attempts") + continue + + details = response.json() + head_item = next( + (item for item in details["items"] if item["type"] == "Asset" and "- Head" in item["name"]), + None, + ) + if head_item is not None: + mesh_face_dict[head_item["id"]] = face + time.sleep(1.0) + +lines = ["local faceByMesh: {[number]: number} = {"] +for mesh_id, face in mesh_face_dict.items(): + lines.append(f"\t[{mesh_id}] = {face},") +lines.append("}") +lines.append("") +lines.append("return faceByMesh") + +with open("../src/faceByMesh.luau", mode="w") as f: + f.write("\n".join(lines) + "\n")