Merge remote-tracking branch 'remotes/MetalStormGhost/dcs_liberation/f16i-mod-support-v2.2' into f16i-mod-support-v2.2

Added a pydcs extension for the IDF Mods Project F-16I mod version 2.2, utilizing the pylon_injector written for the CJS Superbug mod support. Includes banner by Schmokedpancake.

The mod alters the stock F-16C aircraft, which requires a different approach when injecting the mod information to pydcs. The extension changes the F-16C parameters by setattr(F_16C_50, "fuel_max", 2585.48), adds new weapons to the existing pylons and adds five new ones (for example, the mod allows internal ECM equipment in the dorsal spine, freeing the central hardpoint for a fuel tank).

The mod also adds additional Vipers: F-16D (both with and without the dorsal spine, GE and P&W engines) and the stock F-16C Block 50 under a different DCS unit ID.

Also added a separate mod_payloads directory under resources which can be used when aircraft added by mods use the same "unitType" in the loadout lua files. The loadouts are only loaded if the mod is enabled (uses the existing inject_custom_payloads function).

The mod settings are now saved in the Liberation save inside the Faction, so loading the aircraft icons, banners, loadouts etc and the pydcs injection can be re-applied on game load.
This commit is contained in:
MetalStormGhost
2022-10-23 20:54:23 +03:00
42 changed files with 10648 additions and 7 deletions

View File

@@ -125,6 +125,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.hercules.hercules import Hercules
@@ -158,6 +166,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,
@@ -220,6 +234,12 @@ CAS_CAPABLE = [
F_15D,
F_15E,
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,
@@ -306,6 +326,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,
@@ -376,6 +402,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,
@@ -488,6 +520,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

@@ -32,6 +32,7 @@ from game.dcs.groundunittype import GroundUnitType
from game.dcs.shipunittype import ShipUnitType
from game.armedforces.forcegroup import ForceGroup
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,14 @@ 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()
if not mod_settings.f22_raptor:
self.remove_aircraft("F-22A")
if not mod_settings.f100_supersabre:

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

@@ -54,6 +54,7 @@ class ModSettings:
a4_skyhawk: bool = False
f4b_phantom: bool = False
f15d_baz: bool = False
f_16_idf: bool = False
f22_raptor: bool = False
f100_supersabre: bool = False
f104_starfighter: bool = False