Adds tools/check_assets.py — check-yaml does NOT resolve sprite file paths, so a missing PNG only crashes at map load. This catches it statically. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
29 lines
947 B
Python
29 lines
947 B
Python
#!/usr/bin/env python3
|
|
"""Verify every Filename: referenced by the mod's sequence yaml actually exists.
|
|
|
|
check-yaml does NOT do this — missing sprites only surface as a FileNotFoundException
|
|
when a map loads. Run this after adding art. Exits non-zero on any miss.
|
|
"""
|
|
import os, re, sys, glob
|
|
|
|
MOD = os.path.join(os.path.dirname(__file__), '..', 'mods', 'vinylgod')
|
|
missing = []
|
|
checked = 0
|
|
for y in glob.glob(os.path.join(MOD, 'sequences', '*.yaml')):
|
|
for i, line in enumerate(open(y), 1):
|
|
m = re.search(r'Filename:\s*(\S+)', line)
|
|
if not m:
|
|
continue
|
|
checked += 1
|
|
p = os.path.join(MOD, m.group(1))
|
|
if not os.path.exists(p):
|
|
missing.append(f'{os.path.basename(y)}:{i} {m.group(1)}')
|
|
|
|
print(f'checked {checked} sprite references')
|
|
if missing:
|
|
print(f'MISSING {len(missing)}:')
|
|
for m in missing:
|
|
print(' ' + m)
|
|
sys.exit(1)
|
|
print('all sprite files present')
|