90 lines
2.9 KiB
Python
90 lines
2.9 KiB
Python
|
|
import os
|
|
import shutil
|
|
|
|
ROOT = "assets/slike/biomi"
|
|
|
|
# Mapping: Old Folder Name -> New Folder Name
|
|
BIOME_MAP = {
|
|
"Puscava": "04_Egyptian_Desert",
|
|
"Ledeno": "07_Arctic_Zone",
|
|
"Dzungle": "09_Amazonas_Jungle",
|
|
"Radioaktivno": "05_Chernobyl", # Assuming radioactive = Chernobyl
|
|
"Jama": "12_Crystal_Caves",
|
|
"Mocvirje": "14_Loch_Ness", # Best guess
|
|
"Farma_Travniki": "20_Base_Farm",
|
|
"Vulkan": "10_Volcanic_Zone",
|
|
"Mesto": "05_Chernobyl", # Ruined city often associates with Chernobyl in this game
|
|
"Gozd": "08_Endless_Forest",
|
|
"Obala": "03_Atlantis"
|
|
}
|
|
|
|
# Mapping: Old Subfolder -> New Subfolder
|
|
CAT_MAP = {
|
|
"Teren": "02_Teren_Tiles",
|
|
"Rastline": "03_Vegetacija_Plants", # From Regex 'Rastline'
|
|
"Zombiji": "01_Fauna_Creatures", # Zombies considered fauna/enemies
|
|
"Zivali": "01_Fauna_Creatures",
|
|
"Liki": "01_Fauna_Creatures", # NPCs in biome folders usually
|
|
"Predmeti": "04_Rekviziti_Props", # Or 09_Tools? Props is safer for biome scatter
|
|
"Kamni": "02_Teren_Tiles",
|
|
"Voda": "02_Teren_Tiles",
|
|
"Zgradbe": "05_Zgradbe_Buildings",
|
|
"Props": "04_Rekviziti_Props",
|
|
"Nerazvrsceno": "04_Rekviziti_Props" # Default dump
|
|
}
|
|
|
|
def migrate():
|
|
print("🚀 MIGRATING TO CANONICAL BIOME STRUCTURE...")
|
|
|
|
for old_b, new_b in BIOME_MAP.items():
|
|
old_path = os.path.join(ROOT, old_b)
|
|
new_path = os.path.join(ROOT, new_b)
|
|
|
|
if not os.path.exists(old_path):
|
|
continue
|
|
|
|
print(f"📦 Migrating {old_b} -> {new_b}...")
|
|
|
|
# Walk old folder
|
|
for root, dirs, files in os.walk(old_path):
|
|
for file in files:
|
|
if file.startswith('.'): continue
|
|
|
|
src_file = os.path.join(root, file)
|
|
|
|
# Determine category from parent folder name
|
|
# root is like assets/slike/biomi/Puscava/Teren
|
|
parent_name = os.path.basename(root)
|
|
|
|
target_cat_folder = CAT_MAP.get(parent_name, "04_Rekviziti_Props")
|
|
|
|
# If parent is the biome root itself (no subfolder), dump to Props
|
|
if root == old_path:
|
|
target_cat_folder = "04_Rekviziti_Props"
|
|
|
|
dest_dir = os.path.join(new_path, target_cat_folder)
|
|
if not os.path.exists(dest_dir):
|
|
os.makedirs(dest_dir)
|
|
|
|
dest_file = os.path.join(dest_dir, file)
|
|
|
|
try:
|
|
shutil.move(src_file, dest_file)
|
|
except Exception as e:
|
|
print(f"Error {file}: {e}")
|
|
|
|
# Cleanup old folder
|
|
try:
|
|
shutil.rmtree(old_path)
|
|
print(f"🗑️ Removed {old_b}")
|
|
except:
|
|
pass
|
|
|
|
print("="*40)
|
|
print("✅ MIGRATION COMPLETE.")
|
|
print("="*40)
|
|
|
|
if __name__ == "__main__":
|
|
migrate()
|