F-16I mod v2.2 support (by IDF Mods Project) (#9)

This commit is contained in:
MetalStormGhost
2022-10-29 18:12:50 +03:00
committed by GitHub
parent 7a5e878733
commit b64a0f17eb
49 changed files with 7769 additions and 9 deletions

View File

@@ -126,6 +126,14 @@ from pydcs_extensions.f100.f100 import VSN_F100
from pydcs_extensions.f104.f104 import VSN_F104C, VSN_F104G, VSN_F104S, VSN_F104S_AG
from pydcs_extensions.f105.f105 import VSN_F105D, VSN_F105G
from pydcs_extensions.f15d.f15d import F_15D
from pydcs_extensions.f16i_idf.f16i_idf import (
F_16D_50,
F_16D_52,
F_16D_50_NS,
F_16D_52_NS,
F_16D_Barak,
F_16I,
)
from pydcs_extensions.f22a.f22a import F_22A
from pydcs_extensions.f4b.f4b import VSN_F4B
from pydcs_extensions.f84g.f84g import VSN_F84G
@@ -160,6 +168,12 @@ CAP_CAPABLE = [
Su_27,
MiG_29S,
F_16C_50,
F_16I,
F_16D_Barak,
F_16D_50,
F_16D_50_NS,
F_16D_52,
F_16D_52_NS,
FA_18C_hornet,
JF_17,
JAS39Gripen,
@@ -224,6 +238,12 @@ CAS_CAPABLE = [
F_15E,
F_16A,
F_16C_50,
F_16I,
F_16D_Barak,
F_16D_50,
F_16D_50_NS,
F_16D_52,
F_16D_52_NS,
FA_18C_hornet,
Tornado_GR4,
Tornado_IDS,
@@ -312,6 +332,12 @@ CAS_CAPABLE = [
SEAD_CAPABLE = [
JF_17,
F_16C_50,
F_16I,
F_16D_Barak,
F_16D_50,
F_16D_50_NS,
F_16D_52,
F_16D_52_NS,
FA_18C_hornet,
Tornado_IDS,
Su_25T,
@@ -385,6 +411,12 @@ STRIKE_CAPABLE = [
AJS37,
Tornado_GR4,
F_16C_50,
F_16I,
F_16D_Barak,
F_16D_50,
F_16D_50_NS,
F_16D_52,
F_16D_52_NS,
FA_18C_hornet,
AV8BNA,
JF_17,
@@ -500,6 +532,12 @@ RUNWAY_ATTACK_CAPABLE = [
F_15E,
AJS37,
F_16C_50,
F_16I,
F_16D_Barak,
F_16D_50,
F_16D_50_NS,
F_16D_52,
F_16D_52_NS,
FA_18C_hornet,
AV8BNA,
JF_17,

View File

@@ -151,10 +151,10 @@ class Loadout:
# names, so those have been included here too. The priority goes from first to
# last - the first element in the tuple will be tried first, then the second,
# etc.
loadout_names = {t: [f"Liberation {t.value}"] for t in FlightType}
loadout_names = {t: [f"Retribution {t.value}"] for t in FlightType}
legacy_names = {
FlightType.TARCAP: ("CAP HEAVY", "CAP", "Liberation BARCAP"),
FlightType.BARCAP: ("CAP HEAVY", "CAP", "Liberation TARCAP"),
FlightType.TARCAP: ("CAP HEAVY", "CAP", "Retribution BARCAP"),
FlightType.BARCAP: ("CAP HEAVY", "CAP", "Retribution TARCAP"),
FlightType.CAS: ("CAS MAVERICK F", "CAS"),
FlightType.STRIKE: ("STRIKE",),
FlightType.ANTISHIP: ("ANTISHIP",),

View File

@@ -32,6 +32,7 @@ from game.dcs.aircrafttype import AircraftType
from game.dcs.groundunittype import GroundUnitType
from game.dcs.shipunittype import ShipUnitType
from game.dcs.unittype import UnitType
from pydcs_extensions.f16i_idf.f16i_idf import inject_F16I
if TYPE_CHECKING:
from game.theater.start_generator import ModSettings
@@ -124,6 +125,10 @@ class Faction:
#: both will use it.
unrestricted_satnav: bool = False
# Store mod settings so mod properties can be injected again on game load,
# in case mods like CJS F/A-18E/F/G or IDF F-16I are selected by the player
mod_settings: Optional[ModSettings] = field(default=None)
def has_access_to_dcs_type(self, unit_type: Type[DcsUnitType]) -> bool:
# Vehicle and Ship Units
if any(unit_type == u.dcs_unit_type for u in self.accessible_units):
@@ -294,7 +299,21 @@ class Faction:
if unit.unit_class is unit_class:
yield unit
def apply_mod_settings(self, mod_settings: ModSettings) -> None:
def apply_mod_settings(self, mod_settings: Optional[ModSettings] = None) -> None:
if mod_settings is None:
if self.mod_settings is None:
# No mod settings were provided and none were saved for this faction
# so stop here
return
elif self.mod_settings is not None:
# Saved mod settings were found for this faction,
# so load them for use
mod_settings = self.mod_settings
else:
# Update the mod settings of this faction
# so the settings can be applied again on load, if needed
self.mod_settings = mod_settings
# aircraft
if not mod_settings.a4_skyhawk:
self.remove_aircraft("A-4E-C")
@@ -307,6 +326,16 @@ class Faction:
self.remove_aircraft("VSN_F4B")
if not mod_settings.f15d_baz:
self.remove_aircraft("F-15D")
if not mod_settings.f_16_idf:
self.remove_aircraft("F-16I")
self.remove_aircraft("F_16D_52")
self.remove_aircraft("F_16D_50")
self.remove_aircraft("F_16D_50_NS")
self.remove_aircraft("F_16D_52_NS")
else:
inject_F16I()
# Remove the stock Viper because that DCS ID is now used by the Sufa
self.remove_aircraft_by_name("F-16CM Fighting Falcon (Block 50)")
if not mod_settings.f22_raptor:
self.remove_aircraft("F-22A")
if not mod_settings.f84g_thunderjet:
@@ -391,6 +420,11 @@ class Faction:
if i.dcs_unit_type.id == name:
self.aircrafts.remove(i)
def remove_aircraft_by_name(self, name: str) -> None:
for i in self.aircrafts:
if i.name == name:
self.aircrafts.remove(i)
def remove_preset(self, name: str) -> None:
for pg in self.preset_groups:
if pg.name == name:

View File

@@ -232,6 +232,10 @@ class Game:
LuaPluginManager.load_settings(self.settings)
ObjectiveDistanceCache.set_theater(self.theater)
self.compute_unculled_zones(GameUpdateEvents())
# Apply mod settings again so mod properties get injected again,
# in case mods like CJS F/A-18E/F/G or IDF F-16I are selected by the player
self.blue.faction.apply_mod_settings()
self.red.faction.apply_mod_settings()
if not game_still_initializing:
# We don't need to push events that happen during load. The UI will fully
# reset when we're done.

View File

@@ -55,6 +55,7 @@ class ModSettings:
a6a_intruder: bool = False
f4b_phantom: bool = False
f15d_baz: bool = False
f_16_idf: bool = False
f22_raptor: bool = False
f84g_thunderjet: bool = False
f100_supersabre: bool = False