mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Migrate support AEW&C away from find_unittype.
This commit is contained in:
parent
ef35ad90b8
commit
ea15421308
@ -16,6 +16,7 @@ from dcs.task import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from game import db
|
from game import db
|
||||||
|
from .flights.ai_flight_planner_db import AEWC_CAPABLE
|
||||||
from .naming import namegen
|
from .naming import namegen
|
||||||
from .callsigns import callsign_for_support_unit
|
from .callsigns import callsign_for_support_unit
|
||||||
from .conflictgen import Conflict
|
from .conflictgen import Conflict
|
||||||
@ -178,9 +179,16 @@ class AirSupportConflictGenerator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not self.game.settings.disable_legacy_aewc:
|
if not self.game.settings.disable_legacy_aewc:
|
||||||
possible_awacs = db.find_unittype(AWACS, self.conflict.attackers_side)
|
possible_awacs = [
|
||||||
|
a
|
||||||
|
for a in self.game.faction_for(player=True).aircrafts
|
||||||
|
if a in AEWC_CAPABLE
|
||||||
|
]
|
||||||
|
|
||||||
|
if not possible_awacs:
|
||||||
|
logging.warning("No AWACS for faction")
|
||||||
|
return
|
||||||
|
|
||||||
if len(possible_awacs) > 0:
|
|
||||||
awacs_unit = possible_awacs[0]
|
awacs_unit = possible_awacs[0]
|
||||||
freq = self.radio_registry.alloc_uhf()
|
freq = self.radio_registry.alloc_uhf()
|
||||||
|
|
||||||
@ -214,5 +222,3 @@ class AirSupportConflictGenerator:
|
|||||||
blue=True,
|
blue=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
logging.warning("No AWACS for faction")
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user