mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Move missiongenerator helper to missiongenerator.
This commit is contained in:
parent
4f64329f25
commit
ddfe4c00b1
@ -2,8 +2,6 @@ from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Type
|
||||
|
||||
from dcs.countries import country_dict
|
||||
|
||||
# mypy can't resolve these if they're wildcard imports for some reason.
|
||||
from dcs.ships import (
|
||||
CVN_71,
|
||||
@ -131,13 +129,6 @@ def upgrade_to_supercarrier(unit: Type[ShipType], name: str) -> Type[ShipType]:
|
||||
return unit
|
||||
|
||||
|
||||
def country_id_from_name(name: str) -> int:
|
||||
for k, v in country_dict.items():
|
||||
if v.name == name:
|
||||
return k
|
||||
return -1
|
||||
|
||||
|
||||
class DefaultLiveries:
|
||||
class Default(Enum):
|
||||
af_standard = ""
|
||||
|
||||
@ -10,7 +10,6 @@ from dcs import Mission, Point
|
||||
from dcs.coalition import Coalition
|
||||
from dcs.countries import country_dict
|
||||
|
||||
from game import db
|
||||
from game.dcs.helpers import unit_type_from_name
|
||||
from game.missiongenerator.aircraft.aircraftgenerator import (
|
||||
AircraftGenerator,
|
||||
@ -48,6 +47,13 @@ if TYPE_CHECKING:
|
||||
COMBINED_ARMS_SLOTS = 1
|
||||
|
||||
|
||||
def country_id_from_name(name: str) -> int:
|
||||
for k, v in country_dict.items():
|
||||
if v.name == name:
|
||||
return k
|
||||
return -1
|
||||
|
||||
|
||||
class MissionGenerator:
|
||||
def __init__(self, game: Game, time: datetime) -> None:
|
||||
self.game = game
|
||||
@ -129,15 +135,15 @@ class MissionGenerator:
|
||||
p_country = self.game.blue.country_name
|
||||
e_country = self.game.red.country_name
|
||||
self.mission.coalition["blue"].add_country(
|
||||
country_dict[db.country_id_from_name(p_country)]()
|
||||
country_dict[country_id_from_name(p_country)]()
|
||||
)
|
||||
self.mission.coalition["red"].add_country(
|
||||
country_dict[db.country_id_from_name(e_country)]()
|
||||
country_dict[country_id_from_name(e_country)]()
|
||||
)
|
||||
|
||||
belligerents = [
|
||||
db.country_id_from_name(p_country),
|
||||
db.country_id_from_name(e_country),
|
||||
country_id_from_name(p_country),
|
||||
country_id_from_name(e_country),
|
||||
]
|
||||
for country in country_dict.keys():
|
||||
if country not in belligerents:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user