88 lines
4.4 KiB
Python
88 lines
4.4 KiB
Python
import os
|
|
import shutil
|
|
|
|
# SOURCE (Reference - Read Only)
|
|
SRC_DIR = os.path.abspath("assets/slike/glavna_referenca")
|
|
|
|
# DESTINATIONS (Game Assets)
|
|
ROOT_ASSETS = os.path.abspath("assets/slike")
|
|
DIRS = {
|
|
"ui": os.path.join(ROOT_ASSETS, "ui"),
|
|
"items": os.path.join(ROOT_ASSETS, "items"),
|
|
"environment": os.path.join(ROOT_ASSETS, "environment"),
|
|
"characters": os.path.join(ROOT_ASSETS, "characters"),
|
|
"animals": os.path.join(ROOT_ASSETS, "animals"),
|
|
}
|
|
|
|
# KEYWORD MAPPINGS (Based on User's List)
|
|
RULES = [
|
|
# --- UI ---
|
|
{"keywords": ["green_grid", "grid"], "dest": os.path.join(DIRS["ui"])},
|
|
{"keywords": ["gold_frame", "frame", "border"], "dest": os.path.join(DIRS["ui"])},
|
|
{"keywords": ["heart", "health", "hp_icon"], "dest": os.path.join(DIRS["ui"])},
|
|
{"keywords": ["virus", "infection", "meter"], "dest": os.path.join(DIRS["ui"])},
|
|
{"keywords": ["button", "gumb", "start", "pause", "exit"], "dest": os.path.join(DIRS["ui"])},
|
|
{"keywords": ["amnesia", "blur", "vignette", "effect"], "dest": os.path.join(DIRS["ui"])},
|
|
|
|
# --- ITEMS ---
|
|
{"keywords": ["axe", "pickaxe", "hammer", "repair", "tool", "sekira", "kramp"], "dest": os.path.join(DIRS["items"], "orodje")},
|
|
{"keywords": ["sleeping_bag", "tent_item", "longboard", "torch", "chest_item", "oprema"], "dest": os.path.join(DIRS["items"], "oprema")},
|
|
{"keywords": ["seed", "seme", "packet", "bag"], "dest": os.path.join(DIRS["items"], "semena")},
|
|
{"keywords": ["elastic", "photo", "helmet", "souvenir", "spominek"], "dest": os.path.join(DIRS["items"], "spominki")},
|
|
|
|
# --- ENVIRONMENT ---
|
|
{"keywords": ["ground", "dirt", "grass_texture", "path", "asphalt", "tla"], "dest": os.path.join(DIRS["environment"], "tla")},
|
|
{"keywords": ["tree", "bush", "flower", "nature", "rock", "narava", "drevo"], "dest": os.path.join(DIRS["environment"], "narava")},
|
|
{"keywords": ["mine", "ore", "iron", "gold", "pillar", "rudnik"], "dest": os.path.join(DIRS["environment"], "rudnik")},
|
|
{"keywords": ["house", "barn", "shed", "fence", "wall", "gradnja", "building"], "dest": os.path.join(DIRS["environment"], "gradnja")},
|
|
{"keywords": ["shop", "store", "hospital", "church", "cemetery", "grave", "mesto"], "dest": os.path.join(DIRS["environment"], "mesto")},
|
|
|
|
# --- CHARACTERS ---
|
|
{"keywords": ["kai", "player"], "dest": os.path.join(DIRS["characters"], "kai")},
|
|
{"keywords": ["ana", "sister"], "dest": os.path.join(DIRS["characters"], "ana")},
|
|
{"keywords": ["gronk"], "dest": os.path.join(DIRS["characters"], "gronk")},
|
|
{"keywords": ["parent", "mom", "dad", "ghost", "starse", "starsa"], "dest": os.path.join(DIRS["characters"], "starsa")},
|
|
{"keywords": ["npc", "villager", "merchant", "doctor"], "dest": os.path.join(DIRS["characters"], "npc")},
|
|
|
|
# --- ANIMALS ---
|
|
{"keywords": ["deer", "rabbit", "hare", "game", "wild"], "dest": os.path.join(DIRS["animals"], "wild")},
|
|
{"keywords": ["dog", "cow", "chicken", "pig", "farm_animal", "domestic"], "dest": os.path.join(DIRS["animals"], "domestic")},
|
|
{"keywords": ["butterfly", "bee", "spider", "insect", "zuzelke"], "dest": os.path.join(DIRS["animals"], "zuzelke")},
|
|
{"keywords": ["zombie", "infected", "monster", "mutant"], "dest": os.path.join(DIRS["animals"], "infected")},
|
|
]
|
|
|
|
def distribute_assets():
|
|
print("🔒 Ensure Reference is Locked (Simulated here, requires shell command)")
|
|
|
|
# Create Dirs
|
|
for r in RULES:
|
|
if not os.path.exists(r['dest']):
|
|
os.makedirs(r['dest'])
|
|
|
|
print("🚀 Starting Distribution from glavna_referenca...")
|
|
|
|
copied_count = 0
|
|
|
|
for root, dirs, files in os.walk(SRC_DIR):
|
|
for filename in files:
|
|
if filename.startswith("."): continue
|
|
|
|
src_path = os.path.join(root, filename)
|
|
lower_name = filename.lower()
|
|
|
|
# Find match
|
|
matched = False
|
|
for rule in RULES:
|
|
if any(k in lower_name for k in rule['keywords']):
|
|
dest_file = os.path.join(rule['dest'], filename)
|
|
# Copy
|
|
shutil.copy2(src_path, dest_file)
|
|
copied_count += 1
|
|
matched = True
|
|
break # Stop after first match to avoid duplicates (Priority order matters)
|
|
|
|
print(f"✨ DONE! Copied {copied_count} assets to game folders.")
|
|
|
|
if __name__ == "__main__":
|
|
distribute_assets()
|