mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Merge pull request #237 from VEAF/skynet-iads-plugin
First version of the Skynet IADS plugin
This commit is contained in:
commit
2c6b26003b
@ -148,23 +148,23 @@ class Operation:
|
|||||||
logging.debug(
|
logging.debug(
|
||||||
f"Skipping already loaded {script} for {plugin_mnemonic}"
|
f"Skipping already loaded {script} for {plugin_mnemonic}"
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
self.plugin_scripts.append(script_mnemonic)
|
||||||
|
|
||||||
self.plugin_scripts.append(script_mnemonic)
|
plugin_path = Path("./resources/plugins", plugin_mnemonic)
|
||||||
|
|
||||||
plugin_path = Path("./resources/plugins", plugin_mnemonic)
|
script_path = Path(plugin_path, script)
|
||||||
|
if not script_path.exists():
|
||||||
|
logging.error(
|
||||||
|
f"Cannot find {script_path} for plugin {plugin_mnemonic}"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
script_path = Path(plugin_path, script)
|
trigger = TriggerStart(comment=f"Load {script_mnemonic}")
|
||||||
if not script_path.exists():
|
filename = script_path.resolve()
|
||||||
logging.error(
|
fileref = self.current_mission.map_resource.add_resource_file(filename)
|
||||||
f"Cannot find {script_path} for plugin {plugin_mnemonic}"
|
trigger.add_action(DoScriptFile(fileref))
|
||||||
)
|
self.current_mission.triggerrules.triggers.append(trigger)
|
||||||
return
|
|
||||||
|
|
||||||
trigger = TriggerStart(comment=f"Load {script_mnemonic}")
|
|
||||||
filename = script_path.resolve()
|
|
||||||
fileref = self.current_mission.map_resource.add_resource_file(filename)
|
|
||||||
trigger.add_action(DoScriptFile(fileref))
|
|
||||||
self.current_mission.triggerrules.triggers.append(trigger)
|
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
radio_registry = RadioRegistry()
|
radio_registry = RadioRegistry()
|
||||||
|
|||||||
19
gen/sam/genericsam_group_generator.py
Normal file
19
gen/sam/genericsam_group_generator.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
from dcs.vehicles import AirDefence
|
||||||
|
from game import db
|
||||||
|
from gen.sam.group_generator import GroupGenerator
|
||||||
|
|
||||||
|
|
||||||
|
class GenericSamGroupGenerator(GroupGenerator):
|
||||||
|
"""
|
||||||
|
This is the base for all SAM group generators
|
||||||
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def groupNamePrefix(self) -> str:
|
||||||
|
# prefix the SAM site for use with the Skynet IADS plugin
|
||||||
|
if self.faction == self.game.player_name: # this is the player faction
|
||||||
|
return "BLUE SAM "
|
||||||
|
else:
|
||||||
|
return "RED SAM "
|
||||||
@ -8,16 +8,20 @@ from dcs.unit import Vehicle
|
|||||||
|
|
||||||
class GroupGenerator():
|
class GroupGenerator():
|
||||||
|
|
||||||
def __init__(self, game, ground_object):
|
def __init__(self, game, ground_object, faction = None): # faction is not mandatory because some subclasses do not use it
|
||||||
self.game = game
|
self.game = game
|
||||||
self.go = ground_object
|
self.go = ground_object
|
||||||
self.position = ground_object.position
|
self.position = ground_object.position
|
||||||
self.heading = random.randint(0, 359)
|
self.heading = random.randint(0, 359)
|
||||||
self.vg = unitgroup.VehicleGroup(self.game.next_group_id(), self.go.group_identifier)
|
self.faction = faction
|
||||||
|
self.vg = unitgroup.VehicleGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier)
|
||||||
wp = self.vg.add_waypoint(self.position, PointAction.OffRoad, 0)
|
wp = self.vg.add_waypoint(self.position, PointAction.OffRoad, 0)
|
||||||
wp.ETA_locked = True
|
wp.ETA_locked = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def groupNamePrefix(self) -> str:
|
||||||
|
return ""
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,6 @@ def get_faction_possible_sams_generator(faction: str) -> List[Type[GroupGenerato
|
|||||||
"""
|
"""
|
||||||
return [SAM_MAP[s] for s in db.FACTIONS[faction].sams if s in SAM_MAP.keys()]
|
return [SAM_MAP[s] for s in db.FACTIONS[faction].sams if s in SAM_MAP.keys()]
|
||||||
|
|
||||||
|
|
||||||
def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
||||||
"""
|
"""
|
||||||
This generate a SAM group
|
This generate a SAM group
|
||||||
@ -118,7 +117,7 @@ def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
|||||||
possible_sams_generators = get_faction_possible_sams_generator(faction)
|
possible_sams_generators = get_faction_possible_sams_generator(faction)
|
||||||
if len(possible_sams_generators) > 0:
|
if len(possible_sams_generators) > 0:
|
||||||
sam_generator_class = random.choice(possible_sams_generators)
|
sam_generator_class = random.choice(possible_sams_generators)
|
||||||
generator = sam_generator_class(game, ground_object)
|
generator = sam_generator_class(game, ground_object, faction)
|
||||||
generator.generate()
|
generator.generate()
|
||||||
return generator.get_generated_group()
|
return generator.get_generated_group()
|
||||||
return None
|
return None
|
||||||
@ -139,5 +138,3 @@ def generate_shorad_group(game, parent_cp, ground_object, faction_name: str):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class HawkGenerator(GroupGenerator):
|
class HawkGenerator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate an HAWK group
|
This generate an HAWK group
|
||||||
"""
|
"""
|
||||||
@ -14,8 +14,8 @@ class HawkGenerator(GroupGenerator):
|
|||||||
price = 115
|
price = 115
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
self.add_unit(AirDefence.SAM_Hawk_PCP, "PCP", self.position.x, self.position.y, self.heading)
|
|
||||||
self.add_unit(AirDefence.SAM_Hawk_SR_AN_MPQ_50, "SR", self.position.x + 20, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_Hawk_SR_AN_MPQ_50, "SR", self.position.x + 20, self.position.y, self.heading)
|
||||||
|
self.add_unit(AirDefence.SAM_Hawk_PCP, "PCP", self.position.x, self.position.y, self.heading)
|
||||||
self.add_unit(AirDefence.SAM_Hawk_TR_AN_MPQ_46, "TR", self.position.x + 40, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_Hawk_TR_AN_MPQ_46, "TR", self.position.x + 40, self.position.y, self.heading)
|
||||||
|
|
||||||
# Triple A for close range defense
|
# Triple A for close range defense
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class HQ7Generator(GroupGenerator):
|
class HQ7Generator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate an HQ7 group
|
This generate an HQ7 group
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class PatriotGenerator(GroupGenerator):
|
class PatriotGenerator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a Patriot group
|
This generate a Patriot group
|
||||||
"""
|
"""
|
||||||
@ -15,11 +15,11 @@ class PatriotGenerator(GroupGenerator):
|
|||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
# Command Post
|
# Command Post
|
||||||
|
self.add_unit(AirDefence.SAM_Patriot_STR_AN_MPQ_53, "ICC", self.position.x + 30, self.position.y + 30, self.heading)
|
||||||
self.add_unit(AirDefence.SAM_Patriot_AMG_AN_MRC_137, "MRC", self.position.x, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_Patriot_AMG_AN_MRC_137, "MRC", self.position.x, self.position.y, self.heading)
|
||||||
self.add_unit(AirDefence.SAM_Patriot_ECS_AN_MSQ_104, "MSQ", self.position.x + 30, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_Patriot_ECS_AN_MSQ_104, "MSQ", self.position.x + 30, self.position.y, self.heading)
|
||||||
self.add_unit(AirDefence.SAM_Patriot_ICC, "ICC", self.position.x + 60, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_Patriot_ICC, "ICC", self.position.x + 60, self.position.y, self.heading)
|
||||||
self.add_unit(AirDefence.SAM_Patriot_EPP_III, "EPP", self.position.x, self.position.y + 30, self.heading)
|
self.add_unit(AirDefence.SAM_Patriot_EPP_III, "EPP", self.position.x, self.position.y + 30, self.heading)
|
||||||
self.add_unit(AirDefence.SAM_Patriot_STR_AN_MPQ_53, "ICC", self.position.x + 30, self.position.y + 30, self.heading)
|
|
||||||
|
|
||||||
num_launchers = random.randint(3, 4)
|
num_launchers = random.randint(3, 4)
|
||||||
positions = self.get_circular_position(num_launchers, launcher_distance=120, coverage=360)
|
positions = self.get_circular_position(num_launchers, launcher_distance=120, coverage=360)
|
||||||
@ -30,4 +30,4 @@ class PatriotGenerator(GroupGenerator):
|
|||||||
num_launchers = random.randint(3, 4)
|
num_launchers = random.randint(3, 4)
|
||||||
positions = self.get_circular_position(num_launchers, launcher_distance=300, coverage=360)
|
positions = self.get_circular_position(num_launchers, launcher_distance=300, coverage=360)
|
||||||
for i, position in enumerate(positions):
|
for i, position in enumerate(positions):
|
||||||
self.add_unit(AirDefence.AAA_Vulcan_M163, "SPAAA#" + str(i), position[0], position[1], position[2])
|
self.add_unit(AirDefence.AAA_Vulcan_M163, "SPAAA#" + str(i), position[0], position[1], position[2])
|
||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class RapierGenerator(GroupGenerator):
|
class RapierGenerator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a Rapier Group
|
This generate a Rapier Group
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
from dcs.vehicles import AirDefence, Unarmed
|
from dcs.vehicles import AirDefence, Unarmed
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class RolandGenerator(GroupGenerator):
|
class RolandGenerator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a Roland group
|
This generate a Roland group
|
||||||
"""
|
"""
|
||||||
@ -12,7 +12,7 @@ class RolandGenerator(GroupGenerator):
|
|||||||
price = 40
|
price = 40
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
self.add_unit(AirDefence.SAM_Roland_ADS, "ADS", self.position.x, self.position.y, self.heading)
|
|
||||||
self.add_unit(AirDefence.SAM_Roland_EWR, "EWR", self.position.x + 40, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_Roland_EWR, "EWR", self.position.x + 40, self.position.y, self.heading)
|
||||||
|
self.add_unit(AirDefence.SAM_Roland_ADS, "ADS", self.position.x, self.position.y, self.heading)
|
||||||
self.add_unit(Unarmed.Transport_M818, "TRUCK", self.position.x + 80, self.position.y, self.heading)
|
self.add_unit(Unarmed.Transport_M818, "TRUCK", self.position.x + 80, self.position.y, self.heading)
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class SA10Generator(GroupGenerator):
|
class SA10Generator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a SA-10 group
|
This generate a SA-10 group
|
||||||
"""
|
"""
|
||||||
@ -14,15 +14,15 @@ class SA10Generator(GroupGenerator):
|
|||||||
price = 450
|
price = 450
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
# Command Post
|
|
||||||
self.add_unit(AirDefence.SAM_SA_10_S_300PS_CP_54K6, "CP", self.position.x, self.position.y, self.heading)
|
|
||||||
|
|
||||||
# Search Radar
|
# Search Radar
|
||||||
self.add_unit(AirDefence.SAM_SA_10_S_300PS_SR_5N66M, "SR1", self.position.x, self.position.y + 40, self.heading)
|
self.add_unit(AirDefence.SAM_SA_10_S_300PS_SR_5N66M, "SR1", self.position.x, self.position.y + 40, self.heading)
|
||||||
|
|
||||||
# Search radar for missiles (optionnal)
|
# Search radar for missiles (optionnal)
|
||||||
self.add_unit(AirDefence.SAM_SA_10_S_300PS_SR_64H6E, "SR2", self.position.x - 40, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_SA_10_S_300PS_SR_64H6E, "SR2", self.position.x - 40, self.position.y, self.heading)
|
||||||
|
|
||||||
|
# Command Post
|
||||||
|
self.add_unit(AirDefence.SAM_SA_10_S_300PS_CP_54K6, "CP", self.position.x, self.position.y, self.heading)
|
||||||
|
|
||||||
# 2 Tracking radars
|
# 2 Tracking radars
|
||||||
self.add_unit(AirDefence.SAM_SA_10_S_300PS_TR_30N6, "TR1", self.position.x - 40, self.position.y - 40, self.heading)
|
self.add_unit(AirDefence.SAM_SA_10_S_300PS_TR_30N6, "TR1", self.position.x - 40, self.position.y - 40, self.heading)
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class SA11Generator(GroupGenerator):
|
class SA11Generator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a SA-11 group
|
This generate a SA-11 group
|
||||||
"""
|
"""
|
||||||
@ -14,8 +14,8 @@ class SA11Generator(GroupGenerator):
|
|||||||
price = 180
|
price = 180
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
self.add_unit(AirDefence.SAM_SA_11_Buk_CC_9S470M1, "CC", self.position.x, self.position.y, self.heading)
|
|
||||||
self.add_unit(AirDefence.SAM_SA_11_Buk_SR_9S18M1, "SR", self.position.x+20, self.position.y, self.heading)
|
self.add_unit(AirDefence.SAM_SA_11_Buk_SR_9S18M1, "SR", self.position.x+20, self.position.y, self.heading)
|
||||||
|
self.add_unit(AirDefence.SAM_SA_11_Buk_CC_9S470M1, "CC", self.position.x, self.position.y, self.heading)
|
||||||
|
|
||||||
num_launchers = random.randint(2, 4)
|
num_launchers = random.randint(2, 4)
|
||||||
positions = self.get_circular_position(num_launchers, launcher_distance=140, coverage=180)
|
positions = self.get_circular_position(num_launchers, launcher_distance=140, coverage=180)
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class SA2Generator(GroupGenerator):
|
class SA2Generator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a SA-2 group
|
This generate a SA-2 group
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class SA3Generator(GroupGenerator):
|
class SA3Generator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a SA-3 group
|
This generate a SA-3 group
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import random
|
|||||||
|
|
||||||
from dcs.vehicles import AirDefence
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.genericsam_group_generator import GenericSamGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
class SA6Generator(GroupGenerator):
|
class SA6Generator(GenericSamGroupGenerator):
|
||||||
"""
|
"""
|
||||||
This generate a SA-6 group
|
This generate a SA-6 group
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
[
|
[
|
||||||
|
"base",
|
||||||
"jtacautolase",
|
"jtacautolase",
|
||||||
"base"
|
"skynetiads"
|
||||||
]
|
]
|
||||||
|
|||||||
59
resources/plugins/skynetiads/plugin.json
Normal file
59
resources/plugins/skynetiads/plugin.json
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"mnemonic": "skynetiads",
|
||||||
|
"nameInUI": "Skynet IADS",
|
||||||
|
"defaultValue": false,
|
||||||
|
"specificOptions": [
|
||||||
|
{
|
||||||
|
"nameInUI": "create IADS for RED coalition",
|
||||||
|
"mnemonic": "createRedIADS",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "create IADS for BLUE coalition",
|
||||||
|
"mnemonic": "createBlueIADS",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "Long-range SAM act as EWR for RED coalition",
|
||||||
|
"mnemonic": "actAsEwrRED",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "Long-range SAM act as EWR for BLUE coalition",
|
||||||
|
"mnemonic": "actAsEwrBLUE",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "Include RED IADS in radio menu",
|
||||||
|
"mnemonic": "includeRedInRadio",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "Include BLUE IADS in radio menu",
|
||||||
|
"mnemonic": "includeBlueInRadio",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "Generate debug information for RED IADS",
|
||||||
|
"mnemonic": "debugRED",
|
||||||
|
"defaultValue": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nameInUI": "Generate debug information for BLUE IADS",
|
||||||
|
"mnemonic": "debugBLUE",
|
||||||
|
"defaultValue": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scriptsWorkOrders": [
|
||||||
|
{
|
||||||
|
"file": "skynet-iads-compiled.lua",
|
||||||
|
"mnemonic": "skynetiads-script"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configurationWorkOrders": [
|
||||||
|
{
|
||||||
|
"file": "skynetiads-config.lua",
|
||||||
|
"mnemonic": "skynetiads-config"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
2963
resources/plugins/skynetiads/skynet-iads-compiled.lua
Normal file
2963
resources/plugins/skynetiads/skynet-iads-compiled.lua
Normal file
File diff suppressed because it is too large
Load Diff
130
resources/plugins/skynetiads/skynetiads-config.lua
Normal file
130
resources/plugins/skynetiads/skynetiads-config.lua
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- Mission configuration file for the Skynet-IADS framework
|
||||||
|
-- see https://github.com/walder/Skynet-IADS
|
||||||
|
--
|
||||||
|
-- This configuration is tailored for a mission generated by DCS Liberation
|
||||||
|
-- see https://github.com/Khopa/dcs_liberation
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Skynet-IADS plugin - configuration
|
||||||
|
env.info("DCSLiberation|Skynet-IADS plugin - configuration")
|
||||||
|
|
||||||
|
if dcsLiberation and SkynetIADS then
|
||||||
|
|
||||||
|
-- specific options
|
||||||
|
local createRedIADS = false
|
||||||
|
local createBlueIADS = false
|
||||||
|
local actAsEwrRED = false
|
||||||
|
local actAsEwrBLUE = false
|
||||||
|
local includeRedInRadio = false
|
||||||
|
local includeBlueInRadio = false
|
||||||
|
local debugRED = false
|
||||||
|
local debugBLUE = false
|
||||||
|
|
||||||
|
-- retrieve specific options values
|
||||||
|
if dcsLiberation.plugins then
|
||||||
|
if dcsLiberation.plugins.skynetiads then
|
||||||
|
createRedIADS = dcsLiberation.plugins.skynetiads.createRedIADS
|
||||||
|
createBlueIADS = dcsLiberation.plugins.skynetiads.createBlueIADS
|
||||||
|
actAsEwrRED = dcsLiberation.plugins.skynetiads.actAsEwrRED
|
||||||
|
actAsEwrBLUE = dcsLiberation.plugins.skynetiads.actAsEwrBLUE
|
||||||
|
includeRedInRadio = dcsLiberation.plugins.skynetiads.includeRedInRadio
|
||||||
|
includeBlueInRadio = dcsLiberation.plugins.skynetiads.includeBlueInRadio
|
||||||
|
debugRED = dcsLiberation.plugins.skynetiads.debugRED
|
||||||
|
debugBLUE = dcsLiberation.plugins.skynetiads.debugBLUE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - createRedIADS=%s",tostring(createRedIADS)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - createBlueIADS=%s",tostring(createBlueIADS)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - actAsEwrRED=%s",tostring(actAsEwrRED)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - actAsEwrBLUE=%s",tostring(actAsEwrBLUE)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - includeRedInRadio=%s",tostring(includeRedInRadio)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - includeBlueInRadio=%s",tostring(includeBlueInRadio)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - debugRED=%s",tostring(debugRED)))
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - debugBLUE=%s",tostring(debugBLUE)))
|
||||||
|
|
||||||
|
-- actual configuration code
|
||||||
|
|
||||||
|
local function initializeIADS(iads, coalition, actAsEwr, inRadio, debug)
|
||||||
|
|
||||||
|
local coalitionPrefix = "BLUE"
|
||||||
|
if coalition == 1 then
|
||||||
|
coalitionPrefix = "RED"
|
||||||
|
end
|
||||||
|
|
||||||
|
if debug then
|
||||||
|
env.info("adding debug information")
|
||||||
|
local iadsDebug = iads:getDebugSettings()
|
||||||
|
iadsDebug.IADSStatus = true
|
||||||
|
iadsDebug.samWentDark = true
|
||||||
|
iadsDebug.contacts = true
|
||||||
|
iadsDebug.radarWentLive = true
|
||||||
|
iadsDebug.noWorkingCommmandCenter = false
|
||||||
|
iadsDebug.ewRadarNoConnection = false
|
||||||
|
iadsDebug.samNoConnection = false
|
||||||
|
iadsDebug.jammerProbability = true
|
||||||
|
iadsDebug.addedEWRadar = false
|
||||||
|
iadsDebug.hasNoPower = false
|
||||||
|
iadsDebug.harmDefence = true
|
||||||
|
iadsDebug.samSiteStatusEnvOutput = true
|
||||||
|
iadsDebug.earlyWarningRadarStatusEnvOutput = true
|
||||||
|
end
|
||||||
|
|
||||||
|
--add EW units to the IADS:
|
||||||
|
iads:addEarlyWarningRadarsByPrefix(coalitionPrefix .. " EW")
|
||||||
|
|
||||||
|
--add SAM groups to the IADS:
|
||||||
|
iads:addSAMSitesByPrefix(coalitionPrefix .. " SAM")
|
||||||
|
|
||||||
|
-- specific configurations, for each SAM type
|
||||||
|
if actAsEwr then
|
||||||
|
iads:getSAMSitesByNatoName('SA-10'):setActAsEW(true)
|
||||||
|
iads:getSAMSitesByNatoName('SA-6'):setActAsEW(true)
|
||||||
|
iads:getSAMSitesByNatoName('Patriot'):setActAsEW(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add the AWACS
|
||||||
|
if dcsLiberation.AWACs then
|
||||||
|
for _, data in pairs(dcsLiberation.AWACs) do
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - processing AWACS %s", data.dcsGroupName))
|
||||||
|
local group = Group.getByName(data.dcsGroupName)
|
||||||
|
if group then
|
||||||
|
if group:getCoalition() == coalition then
|
||||||
|
local unit = group:getUnit(1)
|
||||||
|
if unit then
|
||||||
|
local unitName = unit:getName()
|
||||||
|
env.info(string.format("DCSLiberation|Skynet-IADS plugin - adding AWACS %s", unitName))
|
||||||
|
iads:addEarlyWarningRadar(unitName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if inRadio then
|
||||||
|
--activate the radio menu to toggle IADS Status output
|
||||||
|
env.info("DCSLiberation|Skynet-IADS plugin - adding in radio menu")
|
||||||
|
iads:addRadioMenu()
|
||||||
|
end
|
||||||
|
|
||||||
|
--activate the IADS
|
||||||
|
iads:setupSAMSitesAndThenActivate()
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
-- create the IADS networks
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
if createRedIADS then
|
||||||
|
env.info("DCSLiberation|Skynet-IADS plugin - creating red IADS")
|
||||||
|
redIADS = SkynetIADS:create("IADS")
|
||||||
|
initializeIADS(redIADS, 1, actAsEwrRED, includeRedInRadio, debugRED) -- RED
|
||||||
|
end
|
||||||
|
|
||||||
|
if createBlueIADS then
|
||||||
|
env.info("DCSLiberation|Skynet-IADS plugin - creating blue IADS")
|
||||||
|
blueIADS = SkynetIADS:create("IADS")
|
||||||
|
initializeIADS(blueIADS, 2, actAsEwrBLUE, includeBlueInRadio, debugBLUE) -- BLUE
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user