Fix bug introduced by AI unlimited fuel option

Since the unlimited fuel option would add the option before the threat-reaction option, this result into a false assertion when using EWJ
This commit is contained in:
Raffson 2024-01-07 15:04:50 +01:00
parent 6e96b4fbb0
commit 93ec459460
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 13 additions and 5 deletions

View File

@ -121,7 +121,11 @@ class MissionGenerator:
@staticmethod
def _configure_ewrj(gen: AircraftGenerator) -> None:
for groups in gen.ewrj_package_dict.values():
optrot = groups[0].points[0].tasks[0]
optrot = [
task
for task in groups[0].points[0].tasks
if isinstance(task, OptReactOnThreat)
][0]
assert isinstance(optrot, OptReactOnThreat)
if (
len(groups) == 1
@ -130,9 +134,13 @@ class MissionGenerator:
# primary flight with no EWR-Jamming capability
continue
for group in groups:
group.points[0].tasks[0] = OptReactOnThreat(
OptReactOnThreat.Values.PassiveDefense
)
tasks = group.points[0].tasks
for i in range(len(tasks)):
if isinstance(tasks[i], OptReactOnThreat):
tasks[i] = OptReactOnThreat(
OptReactOnThreat.Values.PassiveDefense
)
break
def setup_mission_coalitions(self) -> None:
self.mission.coalition["blue"] = Coalition(

View File

@ -1,5 +1,5 @@
{
"nameInUI": "EWR Jammer (for player only)",
"nameInUI": "EW Jammer (for player only)",
"defaultValue": false,
"specificOptions": [
{