sortingthings out...
This commit is contained in:
parent
7a262c1cb9
commit
b22f417c42
@ -1,35 +0,0 @@
|
||||
import os
|
||||
import json
|
||||
from typing import Dict, Any
|
||||
|
||||
|
||||
class ParticleLoader:
|
||||
def __init__(self):
|
||||
self.base_path = "config/particles"
|
||||
self.categories = {
|
||||
"elements": ["basic", "liquids", "gases", "solids"],
|
||||
"states": ["frozen", "molten", "burning"],
|
||||
"special": ["effects", "forces"],
|
||||
}
|
||||
|
||||
def load_all_particles(self) -> Dict[str, Any]:
|
||||
"""Load and merge all particle configurations"""
|
||||
all_particles = {}
|
||||
|
||||
for category, subcategories in self.categories.items():
|
||||
category_path = os.path.join(self.base_path, category)
|
||||
for subcat in subcategories:
|
||||
file_path = os.path.join(category_path, f"{subcat}.json")
|
||||
particles = self._load_json_file(file_path)
|
||||
all_particles.update(particles)
|
||||
|
||||
return all_particles
|
||||
|
||||
def _load_json_file(self, file_path: str) -> Dict[str, Any]:
|
||||
"""Load a single JSON configuration file"""
|
||||
try:
|
||||
with open(file_path, "r") as f:
|
||||
return json.load(f)
|
||||
except FileNotFoundError:
|
||||
print(f"Warning: Configuration file not found: {file_path}")
|
||||
return {}
|
||||
Loading…
x
Reference in New Issue
Block a user