Started cleaning old factions, added back most factions as json. Fixed LHA not spawning.

This commit is contained in:
Khopa
2020-10-23 01:38:08 +02:00
parent bc1e793ce6
commit b4d0eb0b99
61 changed files with 1508 additions and 1879 deletions

View File

@@ -6,7 +6,8 @@ from game.factions.faction import Faction
FACTION_DIRECTORY = "./resources/factions/"
def load_factions() -> {}:
def load_factions() -> {str, Faction}:
files = os.listdir(FACTION_DIRECTORY)
files = [f for f in files if f.endswith(".json")]
@@ -17,8 +18,8 @@ def load_factions() -> {}:
path = os.path.join(FACTION_DIRECTORY, f)
logging.info("Loading faction" + path)
#try:
with open(path, "r") as fdata:
data = json.load(fdata)
with open(path, "r", encoding="utf-8") as fdata:
data = json.load(fdata, encoding="utf-8")
factions[data["name"]] = Faction.from_json(data)
logging.info("Loaded faction : " + path)
#except Exception as e:
@@ -26,8 +27,4 @@ def load_factions() -> {}:
# logging.error("Unable to load faction : " + path)
print(factions)
return factions
if __name__ == "__main__":
load_factions()
return factions