mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
@@ -74,6 +74,10 @@ class Coalition:
|
||||
def country_name(self) -> str:
|
||||
return self.faction.country
|
||||
|
||||
@property
|
||||
def country_shortname(self) -> str:
|
||||
return self.faction.country_shortname
|
||||
|
||||
@property
|
||||
def opponent(self) -> Coalition:
|
||||
assert self._opponent is not None
|
||||
|
||||
@@ -46,6 +46,9 @@ class Faction:
|
||||
# Country used by this faction
|
||||
country: str = field(default="")
|
||||
|
||||
# Country's short name used by this faction
|
||||
country_shortname: str = field(default="")
|
||||
|
||||
# Nice name of the faction
|
||||
name: str = field(default="")
|
||||
|
||||
@@ -172,13 +175,22 @@ class Faction:
|
||||
faction = Faction(locales=json.get("locales"))
|
||||
|
||||
faction.country = json.get("country", "/")
|
||||
if faction.country not in [c.name for c in country_dict.values()]:
|
||||
|
||||
country = None
|
||||
for c in country_dict.values():
|
||||
if c.name == faction.country:
|
||||
country = c
|
||||
break
|
||||
|
||||
if country is None:
|
||||
raise AssertionError(
|
||||
'Faction\'s country ("{}") is not a valid DCS country ID'.format(
|
||||
faction.country
|
||||
)
|
||||
)
|
||||
|
||||
faction.country_shortname = country.shortname
|
||||
|
||||
faction.name = json.get("name", "")
|
||||
if not faction.name:
|
||||
raise AssertionError("Faction has no valid name")
|
||||
|
||||
Reference in New Issue
Block a user