Faction rework wip.

This commit is contained in:
Khopa
2020-10-20 20:58:39 +02:00
parent da2584d7ee
commit 24394d4d00
5 changed files with 389 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import json
import os
import logging
FACTION_DIRECTORY = "./resources/factions/"
def load_factions() -> {}:
files = os.listdir(FACTION_DIRECTORY)
files = [f for f in files if f.endswith(".json")]
factions = {}
for f in files:
path = os.path.join(FACTION_DIRECTORY, f)
logging.info("Loading faction" + path)
try:
with open(path, "r") as fdata:
data = json.load(fdata)
factions[data["name"]] = data
logging.info("Loaded faction : " + path)
except:
logging.error("Unable to load faction : " + path)
return factions
if __name__ == "__main__":
load_factions()