Fixed faction loader so it works with known modded units

This commit is contained in:
Khopa
2020-10-22 13:55:37 +02:00
parent aa7eacc043
commit bc1e793ce6
2 changed files with 82 additions and 0 deletions

View File

@@ -193,6 +193,10 @@ def unit_loader(unit: str, class_repository:[]) -> Optional[PlaneType]:
for mother_class in class_repository:
if getattr(mother_class, unit, None) is not None:
return getattr(mother_class, unit)
if type(mother_class) is list:
for m in mother_class:
if m.__name__ == unit:
return m
logging.info("FACTION ERROR : Unable to find " + unit + " in pydcs")
print("FACTION ERROR : Unable to find " + unit + " in pydcs")
return None