This commit is contained in:
2026-01-20 01:05:17 +01:00
parent e4d01bc480
commit cbb2b64f92
5846 changed files with 1687 additions and 4494 deletions

54
scripts/fix_kai_path.py Normal file
View File

@@ -0,0 +1,54 @@
import json
import os
PROJECT_ROOT = "/Users/davidkotnik/repos/novafarma"
LDTK_FILE = os.path.join(PROJECT_ROOT, "AutoLayers_2_stamps.ldtk")
# We will use the path found by the previous command, but for now I'll use a placeholder logic
# or just rely on the 'find' command output in my thought process to hardcode if needed,
# but better to read it dynamically or just correct the known folder structure issue.
# Hardcoding the fix because I know the issue: 'godot/characters/KAI/' needs to be 'godot/characters/KAI/kai/' probably.
# But I will wait for the `find` output to be 100% sure in a real scenario?
# No, I can write the script to search.
def main():
# Find a valid Kai image
kai_img = None
for root, dirs, files in os.walk(os.path.join(PROJECT_ROOT, "godot/characters/KAI")):
for f in files:
if f.endswith(".png") and "walk" in f:
kai_img = os.path.join(root, f)
break
if kai_img: break
if not kai_img:
# Fallback to any png
for root, dirs, files in os.walk(os.path.join(PROJECT_ROOT, "godot/characters/KAI")):
for f in files:
if f.endswith(".png"):
kai_img = os.path.join(root, f)
break
if kai_img: break
if kai_img:
rel_path = os.path.relpath(kai_img, PROJECT_ROOT)
print(f"Found Kai image: {rel_path}")
with open(LDTK_FILE, 'r') as f:
data = json.load(f)
updated = False
for ts in data['defs']['tilesets']:
if ts['identifier'] == "TS_Kai":
ts['relPath'] = rel_path
updated = True
if updated:
with open(LDTK_FILE, 'w') as f:
json.dump(data, f, indent=2)
print("LDtk updated with correct Kai path!")
else:
print("Could not find any Kai image!")
if __name__ == "__main__":
main()