mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Added Iron Dome, David's Slinh, NASAMS-B and Rapier sites to Pretense. Fixed the timestamp in the save file name.
This commit is contained in:
parent
969f0e26c7
commit
a4d8c14579
@ -16,13 +16,17 @@ from dcs.triggers import TriggerStart
|
||||
from dcs.vehicles import AirDefence
|
||||
|
||||
from game.ato import FlightType
|
||||
from game.coalition import Coalition
|
||||
from game.data.units import UnitClass
|
||||
from game.dcs.aircrafttype import AircraftType
|
||||
from game.missiongenerator.luagenerator import LuaGenerator
|
||||
from game.missiongenerator.missiondata import MissionData
|
||||
from game.plugins import LuaPluginManager
|
||||
from game.pretense.pretensetgogenerator import PretenseGroundObjectGenerator
|
||||
from game.theater import Airfield, OffMapSpawn, TheaterGroundObject
|
||||
from game.theater.iadsnetwork.iadsrole import IadsRole
|
||||
from game.utils import escape_string_for_lua
|
||||
from pydcs_extensions import IRON_DOME_LN, DAVID_SLING_LN
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
@ -276,7 +280,11 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
"sa11",
|
||||
"hawk",
|
||||
"patriot",
|
||||
"nasams",
|
||||
"nasamsb",
|
||||
"nasamsc",
|
||||
"rapier",
|
||||
"irondome",
|
||||
"davidsling",
|
||||
]:
|
||||
sam_presets[sam_name] = PretenseSam(sam_name)
|
||||
|
||||
@ -364,11 +372,19 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
sam_presets["hawk"].enabled = True
|
||||
if ground_unit.unit_type.dcs_unit_type == AirDefence.Patriot_ln:
|
||||
sam_presets["patriot"].enabled = True
|
||||
if ground_unit.unit_type.dcs_unit_type == AirDefence.NASAMS_LN_B:
|
||||
sam_presets["nasamsb"].enabled = True
|
||||
if ground_unit.unit_type.dcs_unit_type == AirDefence.NASAMS_LN_C:
|
||||
sam_presets["nasamsc"].enabled = True
|
||||
if (
|
||||
ground_unit.unit_type.dcs_unit_type == AirDefence.NASAMS_LN_B
|
||||
or ground_unit.unit_type.dcs_unit_type == AirDefence.NASAMS_LN_C
|
||||
ground_unit.unit_type.dcs_unit_type
|
||||
== AirDefence.Rapier_fsa_launcher
|
||||
):
|
||||
sam_presets["nasams"].enabled = True
|
||||
sam_presets["rapier"].enabled = True
|
||||
if ground_unit.unit_type.dcs_unit_type == IRON_DOME_LN:
|
||||
sam_presets["irondome"].enabled = True
|
||||
if ground_unit.unit_type.dcs_unit_type == DAVID_SLING_LN:
|
||||
sam_presets["davidsling"].enabled = True
|
||||
|
||||
cp_has_sams = False
|
||||
for sam_name in sam_presets:
|
||||
@ -800,6 +816,365 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
|
||||
return lua_string_zones
|
||||
|
||||
def get_ground_unit(
|
||||
self, coalition: Coalition, side: int, desired_unit_classes: list[UnitClass]
|
||||
) -> str:
|
||||
for unit_class in desired_unit_classes:
|
||||
if coalition.faction.has_access_to_unit_class(unit_class):
|
||||
dcs_unit_type = PretenseGroundObjectGenerator.ground_unit_of_class(
|
||||
coalition=coalition, unit_class=unit_class
|
||||
)
|
||||
if dcs_unit_type is not None:
|
||||
return dcs_unit_type.dcs_id
|
||||
|
||||
# Faction did not contain any of the desired unit classes.
|
||||
# Fall back to defaults.
|
||||
if desired_unit_classes[0] == UnitClass.TANK:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "M-1 Abrams"
|
||||
else:
|
||||
return "T-90"
|
||||
elif desired_unit_classes[0] == UnitClass.ATGM:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "M1134 Stryker ATGM"
|
||||
else:
|
||||
return "BTR_D"
|
||||
elif desired_unit_classes[0] == UnitClass.IFV:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "M1128 Stryker MGS"
|
||||
else:
|
||||
return "BMP-3"
|
||||
elif desired_unit_classes[0] == UnitClass.APC:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "LAV-25"
|
||||
else:
|
||||
return "BTR-80"
|
||||
elif desired_unit_classes[0] == UnitClass.RECON:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "M1043 HMMWV Armament"
|
||||
else:
|
||||
return "BRDM-2"
|
||||
elif desired_unit_classes[0] == UnitClass.SHORAD:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "Roland ADS"
|
||||
else:
|
||||
return "2S6 Tunguska"
|
||||
elif desired_unit_classes[0] == UnitClass.AAA:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "bofors40"
|
||||
else:
|
||||
return "KS-19"
|
||||
elif desired_unit_classes[0] == UnitClass.MANPAD:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "Soldier stinger"
|
||||
else:
|
||||
return "SA-18 Igla manpad"
|
||||
elif desired_unit_classes[0] == UnitClass.LOGISTICS:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "M 818"
|
||||
else:
|
||||
return "Ural-4320T"
|
||||
else:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
return "Soldier M4"
|
||||
else:
|
||||
return "Infantry AK"
|
||||
|
||||
def generate_pretense_ground_groups(self, side: int) -> str:
|
||||
if side == PRETENSE_BLUE_SIDE:
|
||||
side_str = "blue"
|
||||
skill_str = self.game.settings.player_skill
|
||||
coalition = self.game.blue
|
||||
else:
|
||||
side_str = "red"
|
||||
skill_str = self.game.settings.enemy_vehicle_skill
|
||||
coalition = self.game.red
|
||||
|
||||
lua_string_ground_groups = ""
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["infantry-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.IFV, UnitClass.APC, UnitClass.RECON])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.TANK, UnitClass.ATGM, UnitClass.IFV, UnitClass.APC, UnitClass.RECON])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.TANK, UnitClass.ATGM, UnitClass.IFV, UnitClass.APC, UnitClass.RECON])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.MANPAD, UnitClass.INFANTRY])}"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["defense-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.INFANTRY])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.MANPAD, UnitClass.INFANTRY])}"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["shorad-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.AAA, UnitClass.SHORAD, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.AAA, UnitClass.SHORAD, UnitClass.MANPAD])}"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += 'TemplateDB.templates["sa2-' + side_str + '"] = {\n'
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "p-19 s-125 sr",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "S_75M_Volhov",\n'
|
||||
lua_string_ground_groups += ' "S_75M_Volhov",\n'
|
||||
lua_string_ground_groups += ' "S_75M_Volhov",\n'
|
||||
lua_string_ground_groups += ' "S_75M_Volhov",\n'
|
||||
lua_string_ground_groups += ' "S_75M_Volhov",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += ' "SNR_75V"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["hawk-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "Hawk pcp",\n'
|
||||
lua_string_ground_groups += ' "Hawk cwar",\n'
|
||||
lua_string_ground_groups += ' "Hawk ln",\n'
|
||||
lua_string_ground_groups += ' "Hawk ln",\n'
|
||||
lua_string_ground_groups += ' "Hawk ln",\n'
|
||||
lua_string_ground_groups += ' "Hawk ln",\n'
|
||||
lua_string_ground_groups += ' "Hawk ln",\n'
|
||||
lua_string_ground_groups += ' "Hawk tr",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "Hawk sr"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["patriot-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "Patriot cp",\n'
|
||||
lua_string_ground_groups += ' "Patriot str",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "Patriot ln",\n'
|
||||
lua_string_ground_groups += ' "Patriot ln",\n'
|
||||
lua_string_ground_groups += ' "Patriot ln",\n'
|
||||
lua_string_ground_groups += ' "Patriot ln",\n'
|
||||
lua_string_ground_groups += ' "Patriot str",\n'
|
||||
lua_string_ground_groups += ' "Patriot str",\n'
|
||||
lua_string_ground_groups += ' "Patriot str",\n'
|
||||
lua_string_ground_groups += ' "Patriot EPP",\n'
|
||||
lua_string_ground_groups += ' "Patriot ECS",\n'
|
||||
lua_string_ground_groups += ' "Patriot AMG"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += 'TemplateDB.templates["sa3-' + side_str + '"] = {\n'
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "p-19 s-125 sr",\n'
|
||||
lua_string_ground_groups += ' "snr s-125 tr",\n'
|
||||
lua_string_ground_groups += ' "5p73 s-125 ln",\n'
|
||||
lua_string_ground_groups += ' "5p73 s-125 ln",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "5p73 s-125 ln",\n'
|
||||
lua_string_ground_groups += ' "5p73 s-125 ln"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += 'TemplateDB.templates["sa6-' + side_str + '"] = {\n'
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "Kub 1S91 str",\n'
|
||||
lua_string_ground_groups += ' "Kub 2P25 ln",\n'
|
||||
lua_string_ground_groups += ' "Kub 2P25 ln",\n'
|
||||
lua_string_ground_groups += ' "Kub 2P25 ln",\n'
|
||||
lua_string_ground_groups += ' "Kub 2P25 ln",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += ' "Kub 2P25 ln"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["sa10-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "S-300PS 54K6 cp",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 5P85C ln",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 5P85C ln",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 5P85C ln",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 5P85C ln",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 5P85C ln",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 5P85C ln",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 40B6MD sr",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 40B6M tr",\n'
|
||||
lua_string_ground_groups += ' "S-300PS 64H6E sr"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += 'TemplateDB.templates["sa5-' + side_str + '"] = {\n'
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "RLS_19J6",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "RPC_5N62V",\n'
|
||||
lua_string_ground_groups += ' "S-200_Launcher",\n'
|
||||
lua_string_ground_groups += ' "S-200_Launcher",\n'
|
||||
lua_string_ground_groups += ' "S-200_Launcher",\n'
|
||||
lua_string_ground_groups += ' "S-200_Launcher",\n'
|
||||
lua_string_ground_groups += ' "S-200_Launcher",\n'
|
||||
lua_string_ground_groups += ' "S-200_Launcher"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["sa11-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "SA-11 Buk SR 9S18M1",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk LN 9A310M1",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk LN 9A310M1",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk LN 9A310M1",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk LN 9A310M1",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk LN 9A310M1",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk SR 9S18M1",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += ' "SA-11 Buk CC 9S470M1"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["nasamsb-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "NASAMS_Command_Post",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.AAA, UnitClass.SHORAD, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_B",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_B",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_B",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_B",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["nasamsc-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "NASAMS_Command_Post",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.AAA, UnitClass.SHORAD, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_C",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_C",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_C",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_LN_C",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1",\n'
|
||||
lua_string_ground_groups += ' "NASAMS_Radar_MPQ64F1"\n'
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
lua_string_ground_groups += (
|
||||
'TemplateDB.templates["rapier-' + side_str + '"] = {\n'
|
||||
)
|
||||
lua_string_ground_groups += " units = {\n"
|
||||
lua_string_ground_groups += ' "rapier_fsa_blindfire_radar",\n'
|
||||
lua_string_ground_groups += ' "rapier_fsa_blindfire_radar",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.AAA, UnitClass.SHORAD, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.LOGISTICS])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += f' "{self.get_ground_unit(coalition, side, [UnitClass.SHORAD, UnitClass.AAA, UnitClass.MANPAD])}",\n'
|
||||
lua_string_ground_groups += ' "rapier_fsa_launcher",\n'
|
||||
lua_string_ground_groups += ' "rapier_fsa_launcher",\n'
|
||||
lua_string_ground_groups += ' "rapier_fsa_launcher",\n'
|
||||
lua_string_ground_groups += ' "rapier_fsa_launcher",\n'
|
||||
lua_string_ground_groups += (
|
||||
' "rapier_fsa_optical_tracker_unit",\n'
|
||||
)
|
||||
lua_string_ground_groups += (
|
||||
' "rapier_fsa_optical_tracker_unit",\n'
|
||||
)
|
||||
lua_string_ground_groups += (
|
||||
' "rapier_fsa_optical_tracker_unit"\n'
|
||||
)
|
||||
lua_string_ground_groups += " },\n"
|
||||
lua_string_ground_groups += " maxDist = 300,\n"
|
||||
lua_string_ground_groups += f' skill = "{skill_str}",\n'
|
||||
lua_string_ground_groups += " dataCategory = TemplateDB.type.group\n"
|
||||
lua_string_ground_groups += "}\n"
|
||||
|
||||
return lua_string_ground_groups
|
||||
|
||||
@staticmethod
|
||||
def generate_pretense_zone_connection(
|
||||
connected_points: dict[str, list[str]],
|
||||
@ -820,8 +1195,14 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
other_cp_name not in connected_points[cp_name]
|
||||
and cp_name not in connected_points[other_cp_name]
|
||||
):
|
||||
cp_name_conn = "".join(
|
||||
[i for i in cp_name if i.isalnum() or i.isspace() or i == "-"]
|
||||
)
|
||||
cp_name_conn_other = "".join(
|
||||
[i for i in other_cp_name if i.isalnum() or i.isspace() or i == "-"]
|
||||
)
|
||||
lua_string_connman = (
|
||||
f" cm: addConnection('{cp_name}', '{other_cp_name}')\n"
|
||||
f" cm: addConnection('{cp_name_conn}', '{cp_name_conn_other}')\n"
|
||||
)
|
||||
connected_points[cp_name].append(other_cp_name)
|
||||
connected_points[other_cp_name].append(cp_name)
|
||||
@ -850,7 +1231,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
trigger = TriggerStart(comment="Pretense init")
|
||||
|
||||
now = datetime.now()
|
||||
date_time = now.strftime("%Y-%d-%mT%H_%M_%S")
|
||||
date_time = now.strftime("%Y-%m-%dT%H_%M_%S")
|
||||
lua_string_savefile = (
|
||||
f"local savefile = 'pretense_retribution_{date_time}.json'"
|
||||
)
|
||||
@ -858,6 +1239,13 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
init_header_file = open("./resources/plugins/pretense/init_header.lua", "r")
|
||||
init_header = init_header_file.read()
|
||||
|
||||
lua_string_ground_groups_blue = self.generate_pretense_ground_groups(
|
||||
PRETENSE_BLUE_SIDE
|
||||
)
|
||||
lua_string_ground_groups_red = self.generate_pretense_ground_groups(
|
||||
PRETENSE_RED_SIDE
|
||||
)
|
||||
|
||||
lua_string_zones = ""
|
||||
|
||||
for cp in self.game.theater.controlpoints:
|
||||
@ -865,6 +1253,9 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
continue
|
||||
|
||||
cp_name_trimmed = "".join([i for i in cp.name.lower() if i.isalpha()])
|
||||
cp_name = "".join(
|
||||
[i for i in cp.name if i.isalnum() or i.isspace() or i == "-"]
|
||||
)
|
||||
cp_side = 2 if cp.captured else 1
|
||||
for side in range(1, 3):
|
||||
if cp_name_trimmed not in self.game.pretense_air[cp_side]:
|
||||
@ -874,7 +1265,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
if cp_name_trimmed not in self.game.pretense_ground_assault[cp_side]:
|
||||
self.game.pretense_ground_assault[side][cp_name_trimmed] = list()
|
||||
lua_string_zones += (
|
||||
f"zones.{cp_name_trimmed} = ZoneCommand:new('{cp.name}')\n"
|
||||
f"zones.{cp_name_trimmed} = ZoneCommand:new('{cp_name}')\n"
|
||||
)
|
||||
lua_string_zones += (
|
||||
f"zones.{cp_name_trimmed}.initialState = "
|
||||
@ -1004,17 +1395,23 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
init_body_2_file = open("./resources/plugins/pretense/init_body_2.lua", "r")
|
||||
init_body_2 = init_body_2_file.read()
|
||||
|
||||
init_body_3_file = open("./resources/plugins/pretense/init_body_3.lua", "r")
|
||||
init_body_3 = init_body_3_file.read()
|
||||
|
||||
init_footer_file = open("./resources/plugins/pretense/init_footer.lua", "r")
|
||||
init_footer = init_footer_file.read()
|
||||
|
||||
lua_string = (
|
||||
lua_string_savefile
|
||||
+ init_header
|
||||
+ lua_string_ground_groups_blue
|
||||
+ lua_string_ground_groups_red
|
||||
+ init_body_1
|
||||
+ lua_string_zones
|
||||
+ lua_string_connman
|
||||
+ init_body_1
|
||||
+ lua_string_jtac
|
||||
+ init_body_2
|
||||
+ lua_string_jtac
|
||||
+ init_body_3
|
||||
+ lua_string_supply
|
||||
+ init_footer
|
||||
)
|
||||
|
||||
@ -227,7 +227,7 @@ presets = {
|
||||
template='infantry-red',
|
||||
}),
|
||||
shorad = Preset:new({
|
||||
display = 'SAM',
|
||||
display = 'SHORAD',
|
||||
cost=2500,
|
||||
type='defense',
|
||||
template='shorad-red',
|
||||
@ -236,55 +236,79 @@ presets = {
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='sa2',
|
||||
template='sa2-red',
|
||||
}),
|
||||
sa10 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=30000,
|
||||
type='defense',
|
||||
template='sa10',
|
||||
template='sa10-red',
|
||||
}),
|
||||
sa5 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=20000,
|
||||
type='defense',
|
||||
template='sa5',
|
||||
template='sa5-red',
|
||||
}),
|
||||
sa3 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=4000,
|
||||
type='defense',
|
||||
template='sa3',
|
||||
template='sa3-red',
|
||||
}),
|
||||
sa6 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=6000,
|
||||
type='defense',
|
||||
template='sa6',
|
||||
template='sa6-red',
|
||||
}),
|
||||
sa11 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=10000,
|
||||
type='defense',
|
||||
template='sa11',
|
||||
template='sa11-red',
|
||||
}),
|
||||
hawk = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=6000,
|
||||
type='defense',
|
||||
template='hawk',
|
||||
template='hawk-red',
|
||||
}),
|
||||
patriot = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=30000,
|
||||
type='defense',
|
||||
template='patriot',
|
||||
template='patriot-red',
|
||||
}),
|
||||
nasams = Preset:new({
|
||||
nasamsb = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='nasams',
|
||||
template='nasamsb-red',
|
||||
}),
|
||||
nasamsc = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='nasamsc-red',
|
||||
}),
|
||||
rapier = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='rapier-red',
|
||||
}),
|
||||
irondome = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=20000,
|
||||
type='defense',
|
||||
template='irondome-red',
|
||||
}),
|
||||
davidsling = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=30000,
|
||||
type='defense',
|
||||
template='davidsling-red',
|
||||
}),
|
||||
redShipGroup = Preset:new({
|
||||
display = 'SAM',
|
||||
@ -301,7 +325,7 @@ presets = {
|
||||
template='infantry-blue',
|
||||
}),
|
||||
shorad = Preset:new({
|
||||
display = 'SAM',
|
||||
display = 'SHORAD',
|
||||
cost=2500,
|
||||
type='defense',
|
||||
template='shorad-blue',
|
||||
@ -310,55 +334,79 @@ presets = {
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='sa2',
|
||||
template='sa2-blue',
|
||||
}),
|
||||
sa10 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=30000,
|
||||
type='defense',
|
||||
template='sa10',
|
||||
template='sa10-blue',
|
||||
}),
|
||||
sa5 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=20000,
|
||||
type='defense',
|
||||
template='sa5',
|
||||
template='sa5-blue',
|
||||
}),
|
||||
sa3 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=4000,
|
||||
type='defense',
|
||||
template='sa3',
|
||||
template='sa3-blue',
|
||||
}),
|
||||
sa6 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=6000,
|
||||
type='defense',
|
||||
template='sa6',
|
||||
template='sa6-blue',
|
||||
}),
|
||||
sa11 = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=10000,
|
||||
type='defense',
|
||||
template='sa11',
|
||||
template='sa11-blue',
|
||||
}),
|
||||
hawk = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=6000,
|
||||
type='defense',
|
||||
template='hawk',
|
||||
template='hawk-blue',
|
||||
}),
|
||||
patriot = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=30000,
|
||||
type='defense',
|
||||
template='patriot',
|
||||
template='patriot-blue',
|
||||
}),
|
||||
nasams = Preset:new({
|
||||
nasamsb = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='nasams',
|
||||
template='nasamsb-blue',
|
||||
}),
|
||||
nasamsc = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='nasamsc-blue',
|
||||
}),
|
||||
rapier = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=3000,
|
||||
type='defense',
|
||||
template='rapier-blue',
|
||||
}),
|
||||
irondome = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=20000,
|
||||
type='defense',
|
||||
template='irondome-blue',
|
||||
}),
|
||||
davidsling = Preset:new({
|
||||
display = 'SAM',
|
||||
cost=30000,
|
||||
type='defense',
|
||||
template='davidsling-blue',
|
||||
}),
|
||||
blueShipGroup = Preset:new({
|
||||
display = 'SAM',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user