import os import re def get_defined_uids(): uids = {} for root, dirs, files in os.walk('scenes'): for file in files: if file.endswith('.tscn.uid'): path = os.path.join(root, file) with open(path, 'r') as f: content = f.read().strip() if content.startswith('uid://'): uid = content # Get room name from path room_name = path.split('/')[-2] uids[uid] = room_name return uids def get_targeted_uids(): targeted = set() for root, dirs, files in os.walk('scenes'): for file in files: if file.endswith('.tscn'): path = os.path.join(root, file) with open(path, 'r') as f: content = f.read() matches = re.findall(r'target = "uid://([^"]+)"', content) for m in matches: targeted.add(f"uid://{m}") return targeted defined = get_defined_uids() targeted = get_targeted_uids() defined_uids = set(defined.keys()) not_targeted = defined_uids - targeted not_defined = targeted - defined_uids print("--- Rooms that are never targets (no one leads to them) ---") for uid in not_targeted: print(f"{defined[uid]} ({uid})") print("\n--- Targets that are not defined in any .tscn.uid file ---") for uid in not_defined: print(uid)