From 86bc41c15c8dad68d76f740e6be5824dfae16c28 Mon Sep 17 00:00:00 2001 From: Walter Date: Mon, 2 Nov 2020 19:19:41 -0600 Subject: [PATCH 01/17] Add base menu to new package dialog for red cp --- qt_ui/widgets/map/QMapControlPoint.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qt_ui/widgets/map/QMapControlPoint.py b/qt_ui/widgets/map/QMapControlPoint.py index d90a973d..e59cdbfb 100644 --- a/qt_ui/widgets/map/QMapControlPoint.py +++ b/qt_ui/widgets/map/QMapControlPoint.py @@ -90,3 +90,10 @@ class QMapControlPoint(QMapObject): # Reinitialized ground planners and the like. self.game_model.game.initialize_turn() GameUpdateSignal.get_instance().updateGame(self.game_model.game) + + def open_new_package_dialog(self) -> None: + """Extends the default packagedialog to redirect to base menu for red air base.""" + if not self.control_point.captured: + self.on_click() + else: + super(QMapControlPoint, self).open_new_package_dialog() From 968d9365d67a113855e3056fe4bde826a3d317f9 Mon Sep 17 00:00:00 2001 From: Khopa Date: Tue, 3 Nov 2020 20:37:39 +0100 Subject: [PATCH 02/17] Re-added F-15E to bluefor modern. --- resources/factions/bluefor_modern.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/factions/bluefor_modern.json b/resources/factions/bluefor_modern.json index fa931951..775993df 100644 --- a/resources/factions/bluefor_modern.json +++ b/resources/factions/bluefor_modern.json @@ -6,6 +6,7 @@ "aircrafts": [ "F_14B", "F_15C", + "F_15E", "F_16C_50", "FA_18C_hornet", "JF_17", From 2a02a743a426e4dd2afe7794840848b7c6883f77 Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 18:53:18 +0100 Subject: [PATCH 03/17] Do not display manage button on base defense group for enemy cp. --- .../basemenu/base_defenses/QBaseDefenseGroupInfo.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qt_ui/windows/basemenu/base_defenses/QBaseDefenseGroupInfo.py b/qt_ui/windows/basemenu/base_defenses/QBaseDefenseGroupInfo.py index 48974305..0602c79e 100644 --- a/qt_ui/windows/basemenu/base_defenses/QBaseDefenseGroupInfo.py +++ b/qt_ui/windows/basemenu/base_defenses/QBaseDefenseGroupInfo.py @@ -31,11 +31,13 @@ class QBaseDefenseGroupInfo(QGroupBox): attack_button.setMaximumWidth(180) attack_button.clicked.connect(self.onAttack) self.main_layout.addWidget(attack_button, 0, Qt.AlignLeft) - manage_button = QPushButton("Manage") - manage_button.setProperty("style", "btn-success") - manage_button.setMaximumWidth(180) - manage_button.clicked.connect(self.onManage) - self.main_layout.addWidget(manage_button, 0, Qt.AlignLeft) + + if self.cp.captured: + manage_button = QPushButton("Manage") + manage_button.setProperty("style", "btn-success") + manage_button.setMaximumWidth(180) + manage_button.clicked.connect(self.onManage) + self.main_layout.addWidget(manage_button, 0, Qt.AlignLeft) self.setLayout(self.main_layout) From 1c9d9be6672a6dc4c2083a73ea2b2a861d9a497f Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 21:02:01 +0100 Subject: [PATCH 04/17] Using latest pydcs data-export --- .gitmodules | 4 ++-- pydcs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index d8db9cf5..df57fd30 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "pydcs"] path = pydcs - url = https://github.com/pydcs/dcs - branch = master + url = https://github.com/khopa/dcs + branch = data-export diff --git a/pydcs b/pydcs index c12733a4..f16b549a 160000 --- a/pydcs +++ b/pydcs @@ -1 +1 @@ -Subproject commit c12733a4712e802b41fd26ad8df7475d06c334b3 +Subproject commit f16b549a097586b18e493875ab7b5c110498b1e3 From 844f8595d137d62dbb16f55a63d83ce23adeb843 Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 21:07:28 +0100 Subject: [PATCH 05/17] Fixed ID of some units to match new pydcs data-export. --- game/db.py | 20 ++++++++++---------- gen/ground_forces/ai_ground_planner.py | 8 ++++---- resources/factions/allies_1944.json | 2 +- resources/factions/germany_1942.json | 2 +- resources/factions/germany_1944.json | 4 ++-- resources/factions/syria_1948.json | 2 +- resources/factions/uk_1944.json | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/game/db.py b/game/db.py index c19af009..a9bf7051 100644 --- a/game/db.py +++ b/game/db.py @@ -402,18 +402,18 @@ PRICES = { Armor.MT_Pz_Kpfw_V_Panther_Ausf_G:24, Armor.MT_Pz_Kpfw_IV_Ausf_H:16, Armor.HT_Pz_Kpfw_VI_Tiger_I:24, - Armor.HT_Pz_Kpfw_VI_Ausf__B__Tiger_II:26, + Armor.HT_Pz_Kpfw_VI_Ausf__B_Tiger_II:26, Armor.TD_Jagdpanther_G1: 18, Armor.TD_Jagdpanzer_IV: 11, Armor.Sd_Kfz_184_Elefant: 18, Armor.APC_Sd_Kfz_251:4, - Armor.IFV_Sd_Kfz_234_2_Puma:8, + Armor.AC_Sd_Kfz_234_2_Puma:8, Armor.MT_M4_Sherman:12, Armor.MT_M4A4_Sherman_Firefly:16, Armor.CT_Cromwell_IV:12, Armor.M30_Cargo_Carrier:2, Armor.APC_M2A1:4, - Armor.ST_Centaur_IV: 10, + Armor.CT_Centaur_IV: 10, Armor.HIT_Churchill_VII: 16, Armor.LAC_M8_Greyhound: 8, Armor.TD_M10_GMC: 14, @@ -743,13 +743,13 @@ UNIT_BY_TASK = { Armor.MT_Pz_Kpfw_V_Panther_Ausf_G, Armor.MT_Pz_Kpfw_IV_Ausf_H, Armor.HT_Pz_Kpfw_VI_Tiger_I, - Armor.HT_Pz_Kpfw_VI_Ausf__B__Tiger_II, + Armor.HT_Pz_Kpfw_VI_Ausf__B_Tiger_II, Armor.APC_Sd_Kfz_251, Armor.APC_Sd_Kfz_251, Armor.APC_Sd_Kfz_251, Armor.APC_Sd_Kfz_251, - Armor.IFV_Sd_Kfz_234_2_Puma, - Armor.IFV_Sd_Kfz_234_2_Puma, + Armor.AC_Sd_Kfz_234_2_Puma, + Armor.AC_Sd_Kfz_234_2_Puma, Armor.MT_M4_Sherman, Armor.MT_M4A4_Sherman_Firefly, Armor.CT_Cromwell_IV, @@ -762,12 +762,12 @@ UNIT_BY_TASK = { Armor.MT_Pz_Kpfw_V_Panther_Ausf_G, Armor.MT_Pz_Kpfw_IV_Ausf_H, Armor.HT_Pz_Kpfw_VI_Tiger_I, - Armor.HT_Pz_Kpfw_VI_Ausf__B__Tiger_II, + Armor.HT_Pz_Kpfw_VI_Ausf__B_Tiger_II, Armor.TD_Jagdpanther_G1, Armor.TD_Jagdpanzer_IV, Armor.Sd_Kfz_184_Elefant, Armor.APC_Sd_Kfz_251, - Armor.IFV_Sd_Kfz_234_2_Puma, + Armor.AC_Sd_Kfz_234_2_Puma, Armor.MT_M4_Sherman, Armor.MT_M4A4_Sherman_Firefly, Armor.CT_Cromwell_IV, @@ -776,8 +776,8 @@ UNIT_BY_TASK = { Armor.M30_Cargo_Carrier, Armor.APC_M2A1, Armor.APC_M2A1, - Armor.ST_Centaur_IV, - Armor.ST_Centaur_IV, + Armor.CT_Centaur_IV, + Armor.CT_Centaur_IV, Armor.HIT_Churchill_VII, Armor.LAC_M8_Greyhound, Armor.LAC_M8_Greyhound, diff --git a/gen/ground_forces/ai_ground_planner.py b/gen/ground_forces/ai_ground_planner.py index bda87407..02af7c6b 100644 --- a/gen/ground_forces/ai_ground_planner.py +++ b/gen/ground_forces/ai_ground_planner.py @@ -27,11 +27,11 @@ TYPE_TANKS = [ Armor.MT_Pz_Kpfw_V_Panther_Ausf_G, Armor.MT_Pz_Kpfw_IV_Ausf_H, Armor.HT_Pz_Kpfw_VI_Tiger_I, - Armor.HT_Pz_Kpfw_VI_Ausf__B__Tiger_II, + Armor.HT_Pz_Kpfw_VI_Ausf__B_Tiger_II, Armor.MT_M4_Sherman, Armor.MT_M4A4_Sherman_Firefly, Armor.StuG_IV, - Armor.ST_Centaur_IV, + Armor.CT_Centaur_IV, Armor.CT_Cromwell_IV, Armor.HIT_Churchill_VII, @@ -73,13 +73,13 @@ TYPE_IFV = [ Armor.IFV_Marder, Armor.IFV_MCV_80, Armor.IFV_LAV_25, - Armor.IFV_Sd_Kfz_234_2_Puma, + Armor.AC_Sd_Kfz_234_2_Puma, Armor.IFV_M2A2_Bradley, Armor.IFV_BMD_1, Armor.ZBD_04A, # WW2 - Armor.IFV_Sd_Kfz_234_2_Puma, + Armor.AC_Sd_Kfz_234_2_Puma, Armor.LAC_M8_Greyhound, # Mods diff --git a/resources/factions/allies_1944.json b/resources/factions/allies_1944.json index cc93ec03..e845527a 100644 --- a/resources/factions/allies_1944.json +++ b/resources/factions/allies_1944.json @@ -17,7 +17,7 @@ "MT_M4_Sherman", "APC_M2A1", "CT_Cromwell_IV", - "ST_Centaur_IV", + "CT_Centaur_IV", "HIT_Churchill_VII", "M30_Cargo_Carrier", "LAC_M8_Greyhound", diff --git a/resources/factions/germany_1942.json b/resources/factions/germany_1942.json index 9a641bc2..e0d94e26 100644 --- a/resources/factions/germany_1942.json +++ b/resources/factions/germany_1942.json @@ -12,7 +12,7 @@ "frontline_units": [ "MT_Pz_Kpfw_IV_Ausf_H", "APC_Sd_Kfz_251", - "IFV_Sd_Kfz_234_2_Puma", + "AC_Sd_Kfz_234_2_Puma", "TD_Jagdpanzer_IV" ], "artillery_units": [ diff --git a/resources/factions/germany_1944.json b/resources/factions/germany_1944.json index 7ff13b99..3aea568b 100644 --- a/resources/factions/germany_1944.json +++ b/resources/factions/germany_1944.json @@ -13,9 +13,9 @@ "MT_Pz_Kpfw_V_Panther_Ausf_G", "MT_Pz_Kpfw_IV_Ausf_H", "HT_Pz_Kpfw_VI_Tiger_I", - "HT_Pz_Kpfw_VI_Ausf__B__Tiger_II", + "HT_Pz_Kpfw_VI_Ausf__B_Tiger_II", "APC_Sd_Kfz_251", - "IFV_Sd_Kfz_234_2_Puma", + "AC_Sd_Kfz_234_2_Puma", "Sd_Kfz_184_Elefant", "TD_Jagdpanther_G1", "TD_Jagdpanzer_IV" diff --git a/resources/factions/syria_1948.json b/resources/factions/syria_1948.json index d9693bf1..1cbe6fa1 100644 --- a/resources/factions/syria_1948.json +++ b/resources/factions/syria_1948.json @@ -8,7 +8,7 @@ "SpitfireLFMkIXCW" ], "frontline_units": [ - "IFV_Sd_Kfz_234_2_Puma", + "AC_Sd_Kfz_234_2_Puma", "APC_Sd_Kfz_251", "MT_Pz_Kpfw_IV_Ausf_H", "MT_M4_Sherman" diff --git a/resources/factions/uk_1944.json b/resources/factions/uk_1944.json index 92c32f8c..91183b5e 100644 --- a/resources/factions/uk_1944.json +++ b/resources/factions/uk_1944.json @@ -17,7 +17,7 @@ "MT_M4_Sherman", "APC_M2A1", "CT_Cromwell_IV", - "ST_Centaur_IV", + "CT_Centaur_IV", "HIT_Churchill_VII" ], "artillery_units": [ From b72a2f4a5fe14b112d20c0519cf79c506abf1e53 Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 21:09:48 +0100 Subject: [PATCH 06/17] Fixed error in new game wizard with units and mods required not being displayed correctly in some cases. --- qt_ui/windows/newgame/QNewGameWizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt_ui/windows/newgame/QNewGameWizard.py b/qt_ui/windows/newgame/QNewGameWizard.py index 5fa06451..0a42e7db 100644 --- a/qt_ui/windows/newgame/QNewGameWizard.py +++ b/qt_ui/windows/newgame/QNewGameWizard.py @@ -230,7 +230,7 @@ class FactionSelection(QtWidgets.QWizardPage): if len(blue_faction.requirements.keys()) > 0: has_mod = True for mod in blue_faction.requirements.keys(): - if not "requirements" in red_faction.keys() or mod not in red_faction.requirements.keys(): + if mod not in red_faction.requirements.keys(): self.requiredMods.setText(self.requiredMods.text() + "\n
  • " + mod + ": " + blue_faction.requirements[mod] + "
  • ") if has_mod: From 95c4dfa52fc6933a2ebede62bb0337d609420bba Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 21:50:25 +0100 Subject: [PATCH 07/17] Added new Flak site configuration (now that flak 18 and bofors guns do not require WW2 asset pack) --- gen/sam/aaa_flak18.py | 29 ++++++++++++++ gen/sam/cold_war_flak.py | 72 ++++++++++++++++++++++++++++++++++ gen/sam/sam_group_generator.py | 16 ++++---- 3 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 gen/sam/aaa_flak18.py create mode 100644 gen/sam/cold_war_flak.py diff --git a/gen/sam/aaa_flak18.py b/gen/sam/aaa_flak18.py new file mode 100644 index 00000000..fea85f70 --- /dev/null +++ b/gen/sam/aaa_flak18.py @@ -0,0 +1,29 @@ +import random + +from dcs.vehicles import AirDefence, Unarmed + +from gen.sam.group_generator import GroupGenerator + + +class Flak18Generator(GroupGenerator): + """ + This generate a German flak artillery group using only free units, thus not requiring the WW2 asset pack + """ + + name = "WW2 Flak Site" + price = 40 + + def generate(self): + + spacing = random.randint(30, 60) + index = 0 + + for i in range(3): + for j in range(2): + index = index + 1 + self.add_unit(AirDefence.AAA_8_8cm_Flak_18, "AAA#" + str(index), + self.position.x + spacing * i + random.randint(1, 5), + self.position.y + spacing * j + random.randint(1, 5), self.heading) + + # Add a commander truck + self.add_unit(Unarmed.Blitz_3_6_6700A, "Blitz#", self.position.x - 35, self.position.y - 20, self.heading) diff --git a/gen/sam/cold_war_flak.py b/gen/sam/cold_war_flak.py new file mode 100644 index 00000000..e35bd01a --- /dev/null +++ b/gen/sam/cold_war_flak.py @@ -0,0 +1,72 @@ +import random + +from dcs.vehicles import AirDefence, Unarmed + +from gen.sam.group_generator import GroupGenerator + + +class EarlyColdWarFlakGenerator(GroupGenerator): + """ + This generator attempt to mimic an early cold-war era flak AAA site. + The Flak 18 88mm is used as the main long range gun and 2 Bofors 40mm guns provide short range protection. + + This does not include search lights and telemeter computer (Kdo.G 40) because these are paid units only available in WW2 asset pack + """ + + name = "Early Cold War Flak Site" + price = 58 + + def generate(self): + + spacing = random.randint(30, 60) + index = 0 + + # Long range guns + for i in range(3): + for j in range(2): + index = index + 1 + self.add_unit(AirDefence.AAA_8_8cm_Flak_18, "AAA#" + str(index), + self.position.x + spacing * i + random.randint(1, 5), + self.position.y + spacing * j + random.randint(1, 5), self.heading) + + # Short range guns + self.add_unit(AirDefence.AAA_Bofors_40mm, "SHO#1", + self.position.x - 40, self.position.y - 40, self.heading + 180), + self.add_unit(AirDefence.AAA_Bofors_40mm, "SHO#1", + self.position.x + spacing * 2 + 40, self.position.y + spacing + 40, self.heading), + + # Add a Kamaz truck + self.add_unit(Unarmed.Transport_KAMAZ_43101, "Kamaz#", self.position.x - 60, self.position.y - 20, self.heading) + + +class ColdWarFlakGenerator(GroupGenerator): + """ + This generator attempt to mimic a cold-war era flak AAA site. + The Flak 18 88mm is used as the main long range gun while 2 Zu-23 guns provide short range protection. + The site is also fitted with a P-19 radar for early detection. + """ + + name = "Early Cold War Flak Site" + price = 72 + + def generate(self): + + spacing = random.randint(30, 60) + index = 0 + + # Long range guns + for i in range(3): + for j in range(2): + index = index + 1 + self.add_unit(AirDefence.AAA_8_8cm_Flak_18, "AAA#" + str(index), + self.position.x + spacing * i + random.randint(1, 5), + self.position.y + spacing * j + random.randint(1, 5), self.heading) + + # Short range guns + self.add_unit(AirDefence.AAA_ZU_23_Closed, "SHO#1", + self.position.x - 40, self.position.y - 40, self.heading + 180), + self.add_unit(AirDefence.AAA_ZU_23_Closed, "SHO#1", + self.position.x + spacing * 2 + 40, self.position.y + spacing + 40, self.heading), + + # Add a P19 Radar for EWR + self.add_unit(AirDefence.SAM_SR_P_19, "SR#0", self.position.x - 60, self.position.y - 20, self.heading) diff --git a/gen/sam/sam_group_generator.py b/gen/sam/sam_group_generator.py index 7a127830..a2a20a1c 100644 --- a/gen/sam/sam_group_generator.py +++ b/gen/sam/sam_group_generator.py @@ -1,13 +1,14 @@ import random from typing import List, Type -from dcs.unittype import UnitType from dcs.vehicles import AirDefence from game import db from gen.sam.aaa_bofors import BoforsGenerator from gen.sam.aaa_flak import FlakGenerator +from gen.sam.aaa_flak18 import Flak18Generator from gen.sam.aaa_zu23_insurgent import ZU23InsurgentGenerator +from gen.sam.cold_war_flak import EarlyColdWarFlakGenerator, ColdWarFlakGenerator from gen.sam.group_generator import GroupGenerator from gen.sam.sam_avenger import AvengerGenerator from gen.sam.sam_chaparral import ChaparralGenerator @@ -61,7 +62,10 @@ SAM_MAP = { "SA13Generator": SA13Generator, "SA15Generator": SA15Generator, "SA19Generator": SA19Generator, - "HQ7Generator": HQ7Generator + "HQ7Generator": HQ7Generator, + "Flak18Generator": Flak18Generator, + "ColdWarFlakGenerator": ColdWarFlakGenerator, + "EarlyColdWarFlakGenerator": EarlyColdWarFlakGenerator } SAM_PRICES = { @@ -106,7 +110,8 @@ 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()] -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 :param parentCp: The parent control point @@ -133,8 +138,3 @@ def generate_shorad_group(game, parent_cp, ground_object, faction_name: str): return generator.get_generated_group() else: return generate_anti_air_group(game, parent_cp, ground_object, faction_name) - - - - - From 95f72be8eb9c4dfc875b732e9253606627055e80 Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 21:51:09 +0100 Subject: [PATCH 08/17] Fixed issue with duplicated WW2 germany faction IDs --- resources/factions/germany_1942.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/factions/germany_1942.json b/resources/factions/germany_1942.json index e0d94e26..a11d9500 100644 --- a/resources/factions/germany_1942.json +++ b/resources/factions/germany_1942.json @@ -1,6 +1,6 @@ { "country": "Third Reich", - "name": "Germany 1944", + "name": "Germany 1942", "authors": "Khopa", "description": "", "aircrafts": [ From 5cfbd8c3ad66d1288624a5463169d2c69429a401 Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 22:01:28 +0100 Subject: [PATCH 09/17] Added building set for WW2 units that does not require WW2 asset pack. --- game/data/building_data.py | 1 + game/factions/faction.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/game/data/building_data.py b/game/data/building_data.py index bd6ab666..939609a6 100644 --- a/game/data/building_data.py +++ b/game/data/building_data.py @@ -3,6 +3,7 @@ import dcs DEFAULT_AVAILABLE_BUILDINGS = ['fuel', 'ammo', 'comms', 'oil', 'ware', 'farp', 'fob', 'power', 'factory', 'derrick', 'aa'] +WW2_FREE = ['fuel', 'factory', 'ware', 'aa'] WW2_GERMANY_BUILDINGS = ['fuel', 'factory', 'ww2bunker', 'ww2bunker', 'ww2bunker', 'allycamp', 'allycamp', 'aa'] WW2_ALLIES_BUILDINGS = ['fuel', 'factory', 'allycamp', 'allycamp', 'allycamp', 'allycamp', 'allycamp', 'aa'] diff --git a/game/factions/faction.py b/game/factions/faction.py index 1ecb20fd..b6c9e058 100644 --- a/game/factions/faction.py +++ b/game/factions/faction.py @@ -10,7 +10,7 @@ from dcs.planes import plane_map from dcs.unittype import FlyingType, ShipType, VehicleType, UnitType from dcs.vehicles import Armor, Unarmed, Infantry, Artillery, AirDefence -from game.data.building_data import WW2_ALLIES_BUILDINGS, DEFAULT_AVAILABLE_BUILDINGS, WW2_GERMANY_BUILDINGS +from game.data.building_data import WW2_ALLIES_BUILDINGS, DEFAULT_AVAILABLE_BUILDINGS, WW2_GERMANY_BUILDINGS, WW2_FREE from game.data.doctrine import Doctrine, MODERN_DOCTRINE, COLDWAR_DOCTRINE, WWII_DOCTRINE from pydcs_extensions.mod_units import MODDED_VEHICLES, MODDED_AIRPLANES @@ -170,6 +170,8 @@ class Faction: building_set = json.get("building_set", "default") if building_set == "default": faction.building_set = DEFAULT_AVAILABLE_BUILDINGS + elif building_set == "ww2free": + faction.building_set = WW2_FREE elif building_set == "ww2ally": faction.building_set = WW2_ALLIES_BUILDINGS elif building_set == "ww2germany": From 4d1a0b85e4bd7d8899104713990146499598aef7 Mon Sep 17 00:00:00 2001 From: Khopa Date: Wed, 4 Nov 2020 22:25:24 +0100 Subject: [PATCH 10/17] Added free version of WW2 factions that will not require the WW2 Asset Pack. --- resources/factions/allies_1944_free.json | 52 +++++++++++++++++++++++ resources/factions/germany_1944_free.json | 52 +++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 resources/factions/allies_1944_free.json create mode 100644 resources/factions/germany_1944_free.json diff --git a/resources/factions/allies_1944_free.json b/resources/factions/allies_1944_free.json new file mode 100644 index 00000000..1cd04d73 --- /dev/null +++ b/resources/factions/allies_1944_free.json @@ -0,0 +1,52 @@ +{ + "country": "USA", + "name": "Allies 1944 (Free)", + "authors": "Khopa", + "description": "A WW2 ally faction that does not requires the paid WW2 asset pack.", + "aircrafts": [ + "P_51D", + "P_51D_30_NA", + "P_47D_30", + "SpitfireLFMkIX", + "SpitfireLFMkIXCW", + "A_20G" + ], + "frontline_units": [ + "MT_M4_Sherman", + "APC_M2A1" + ], + "artillery_units": [ + ], + "logistics_units": [ + "Bedford_MWD" + ], + "infantry_units": [ + "Paratrooper_AKS" + ], + "shorads": [ + "BoforsGenerator" + ], + "sams": [ + "BoforsGenerator" + ], + "aircraft_carrier": [ + ], + "helicopter_carrier": [ + ], + "destroyers": [ + ], + "cruisers": [ + ], + "requirements": { + }, + "carrier_names": [ + ], + "helicopter_carrier_names": [ + ], + "navy_generators": [ + ], + "navy_group_count": 0, + "has_jtac": false, + "doctrine": "ww2", + "building_set": "ww2free" +} diff --git a/resources/factions/germany_1944_free.json b/resources/factions/germany_1944_free.json new file mode 100644 index 00000000..b80df605 --- /dev/null +++ b/resources/factions/germany_1944_free.json @@ -0,0 +1,52 @@ +{ + "country": "Third Reich", + "name": "Germany 1944 (Free)", + "authors": "Khopa", + "description": "", + "aircrafts": [ + "FW_190A8", + "FW_190D9", + "Bf_109K_4" + ], + "frontline_units": [ + "MT_Pz_Kpfw_IV_Ausf_H", + "APC_Sd_Kfz_251" + ], + "artillery_units": [ + ], + "logistics_units": [ + "Blitz_3_6_6700A" + ], + "infantry_units": [ + "Infantry_Soldier_Rus" + ], + "shorads": [ + "Flak18Generator" + ], + "sams": [ + "Flak18Generator" + ], + "aircraft_carrier": [ + ], + "helicopter_carrier": [ + ], + "destroyers": [ + ], + "cruisers": [ + ], + "requirements": { + }, + "carrier_names": [ + ], + "helicopter_carrier_names": [ + ], + "navy_generators": [ + ], + "navy_group_count": 0, + "missiles": [ + ], + "missiles_group_count": 0, + "has_jtac": false, + "doctrine": "ww2", + "building_set": "ww2free" +} From de2d5481393cc4d0cfff9d90dcdd61578c096bfb Mon Sep 17 00:00:00 2001 From: Khopa Date: Thu, 5 Nov 2020 00:34:57 +0100 Subject: [PATCH 11/17] Added Flak guns to most coldwar factions --- game/db.py | 3 +++ gen/sam/cold_war_flak.py | 6 +++--- resources/factions/bluefor_coldwar.json | 1 + resources/factions/bluefor_coldwar_a4.json | 1 + resources/factions/bluefor_coldwar_a4_mb339.json | 1 + resources/factions/israel_1948.json | 1 + resources/factions/israel_1973.json | 5 ++--- resources/factions/russia_1955.json | 8 ++------ resources/factions/russia_1965.json | 4 ++-- resources/factions/russia_1975.json | 4 ++-- resources/factions/syria_1967.json | 1 + resources/factions/syria_1967_with_ww2_weapons.json | 2 ++ resources/factions/syria_1973.json | 5 ++--- resources/factions/syria_1982.json | 5 ++--- resources/factions/syria_2011.json | 3 ++- resources/factions/usa_1955.json | 5 ++--- resources/factions/usa_1960.json | 1 + resources/factions/usa_1965.json | 3 ++- resources/factions/usa_1975.json | 1 + 19 files changed, 33 insertions(+), 27 deletions(-) diff --git a/game/db.py b/game/db.py index a9bf7051..67eccd5a 100644 --- a/game/db.py +++ b/game/db.py @@ -2,7 +2,9 @@ from datetime import datetime from enum import Enum from typing import Dict, List, Optional, Tuple, Type, Union +from dcs import Mission from dcs.countries import country_dict +from dcs.country import Country from dcs.helicopters import ( AH_1W, AH_64A, @@ -1388,6 +1390,7 @@ class DefaultLiveries: class Default(Enum): af_standard = "" + OH_58D.Liveries = DefaultLiveries F_16C_50.Liveries = DefaultLiveries P_51D_30_NA.Liveries = DefaultLiveries diff --git a/gen/sam/cold_war_flak.py b/gen/sam/cold_war_flak.py index e35bd01a..c0b7e81d 100644 --- a/gen/sam/cold_war_flak.py +++ b/gen/sam/cold_war_flak.py @@ -35,8 +35,8 @@ class EarlyColdWarFlakGenerator(GroupGenerator): self.add_unit(AirDefence.AAA_Bofors_40mm, "SHO#1", self.position.x + spacing * 2 + 40, self.position.y + spacing + 40, self.heading), - # Add a Kamaz truck - self.add_unit(Unarmed.Transport_KAMAZ_43101, "Kamaz#", self.position.x - 60, self.position.y - 20, self.heading) + # Add a truck + self.add_unit(Unarmed.Transport_KAMAZ_43101, "Truck#", self.position.x - 60, self.position.y - 20, self.heading) class ColdWarFlakGenerator(GroupGenerator): @@ -46,7 +46,7 @@ class ColdWarFlakGenerator(GroupGenerator): The site is also fitted with a P-19 radar for early detection. """ - name = "Early Cold War Flak Site" + name = "Cold War Flak Site" price = 72 def generate(self): diff --git a/resources/factions/bluefor_coldwar.json b/resources/factions/bluefor_coldwar.json index 73265ae3..511df4ff 100644 --- a/resources/factions/bluefor_coldwar.json +++ b/resources/factions/bluefor_coldwar.json @@ -37,6 +37,7 @@ "Soldier_M249" ], "shorads": [ + "EarlyColdWarFlakGenerator", "VulcanGenerator" ], "sams": [ diff --git a/resources/factions/bluefor_coldwar_a4.json b/resources/factions/bluefor_coldwar_a4.json index 7a2fd90d..89a674c6 100644 --- a/resources/factions/bluefor_coldwar_a4.json +++ b/resources/factions/bluefor_coldwar_a4.json @@ -38,6 +38,7 @@ "Soldier_M249" ], "shorads": [ + "EarlyColdWarFlakGenerator", "VulcanGenerator" ], "sams": [ diff --git a/resources/factions/bluefor_coldwar_a4_mb339.json b/resources/factions/bluefor_coldwar_a4_mb339.json index 880f505f..f525c4c3 100644 --- a/resources/factions/bluefor_coldwar_a4_mb339.json +++ b/resources/factions/bluefor_coldwar_a4_mb339.json @@ -39,6 +39,7 @@ "Soldier_M249" ], "shorads": [ + "EarlyColdWarFlakGenerator", "VulcanGenerator" ], "sams": [ diff --git a/resources/factions/israel_1948.json b/resources/factions/israel_1948.json index cd723e9f..74b2132b 100644 --- a/resources/factions/israel_1948.json +++ b/resources/factions/israel_1948.json @@ -29,6 +29,7 @@ "BoforsGenerator" ], "sams": [ + "EarlyColdWarFlakGenerator", "BoforsGenerator" ], "aircraft_carrier": [ diff --git a/resources/factions/israel_1973.json b/resources/factions/israel_1973.json index 071833c3..7b475f35 100644 --- a/resources/factions/israel_1973.json +++ b/resources/factions/israel_1973.json @@ -16,7 +16,7 @@ "KC130" ], "frontline_units": [ - "MT_M4A4_Sherman_Firefly", + "MT_M4_Sherman", "APC_M2A1", "MBT_M60A3_Patton", "APC_M113" @@ -46,8 +46,7 @@ "cruisers": [ ], "requirements": { - "Community A-4E": "https://heclak.github.io/community-a4e-c/", - "WW2 Asset Pack": "https://www.digitalcombatsimulator.com/en/products/other/wwii_assets_pack/" + "Community A-4E": "https://heclak.github.io/community-a4e-c/" }, "carrier_names": [ ], diff --git a/resources/factions/russia_1955.json b/resources/factions/russia_1955.json index f621238f..bb56df67 100644 --- a/resources/factions/russia_1955.json +++ b/resources/factions/russia_1955.json @@ -31,14 +31,10 @@ "Soldier_RPG" ], "shorads": [ - "ZSU23Generator", - "ZU23Generator", - "ZU23UralGenerator" + "EarlyColdWarFlakGenerator" ], "sams": [ - "ZSU23Generator", - "ZU23Generator", - "ZU23UralGenerator" + "EarlyColdWarFlakGenerator" ], "aircraft_carrier": [ ], diff --git a/resources/factions/russia_1965.json b/resources/factions/russia_1965.json index fd34c39c..b747b204 100644 --- a/resources/factions/russia_1965.json +++ b/resources/factions/russia_1965.json @@ -36,8 +36,8 @@ ], "shorads": [ "ZSU23Generator", - "ZU23Generator", - "ZU23UralGenerator" + "EarlyColdWarFlakGenerator", + "ZU23Generator" ], "sams": [ "SA2Generator", diff --git a/resources/factions/russia_1975.json b/resources/factions/russia_1975.json index ac73f830..27232275 100644 --- a/resources/factions/russia_1975.json +++ b/resources/factions/russia_1975.json @@ -41,9 +41,9 @@ "Soldier_RPG" ], "shorads": [ + "ColdWarFlakGenerator", "ZSU23Generator", - "ZU23Generator", - "ZU23UralGenerator" + "ZU23Generator" ], "sams": [ "SA3Generator", diff --git a/resources/factions/syria_1967.json b/resources/factions/syria_1967.json index 0a2eda52..6830a420 100644 --- a/resources/factions/syria_1967.json +++ b/resources/factions/syria_1967.json @@ -18,6 +18,7 @@ ], "frontline_units": [ "ARV_BRDM_2", + "MT_Pz_Kpfw_IV_Ausf_H", "MBT_T_55" ], "artillery_units": [ diff --git a/resources/factions/syria_1967_with_ww2_weapons.json b/resources/factions/syria_1967_with_ww2_weapons.json index 1a37b8c0..1217d370 100644 --- a/resources/factions/syria_1967_with_ww2_weapons.json +++ b/resources/factions/syria_1967_with_ww2_weapons.json @@ -38,9 +38,11 @@ ], "shorads": [ "ZU23Generator", + "EarlyColdWarFlakGenerator", "ZU23UralGenerator" ], "sams": [ + "EarlyColdWarFlakGenerator", "SA2Generator" ], "aircraft_carrier": [ diff --git a/resources/factions/syria_1973.json b/resources/factions/syria_1973.json index 7d04ab52..cc74b6ac 100644 --- a/resources/factions/syria_1973.json +++ b/resources/factions/syria_1973.json @@ -34,9 +34,8 @@ "Soldier_RPG" ], "shorads": [ - "ZSU23Generator", - "ZU23Generator", - "ZU23UralGenerator" + "EarlyColdWarFlakGenerator", + "ZU23Generator" ], "sams": [ "SA2Generator", diff --git a/resources/factions/syria_1982.json b/resources/factions/syria_1982.json index 30f53661..03a7666b 100644 --- a/resources/factions/syria_1982.json +++ b/resources/factions/syria_1982.json @@ -36,10 +36,9 @@ "Paratrooper_RPG_16" ], "shorads": [ - "ZSU23Generator", "ZU23Generator", - "ZU23Generator", - "ZU23UralGenerator" + "EarlyColdWarFlakGenerator", + "ColdWarFlakGenerator" ], "sams": [ "SA2Generator", diff --git a/resources/factions/syria_2011.json b/resources/factions/syria_2011.json index a96f843c..e39c72dd 100644 --- a/resources/factions/syria_2011.json +++ b/resources/factions/syria_2011.json @@ -53,7 +53,8 @@ "SA9Generator", "SA13Generator", "SA19Generator", - "ZSU23Generator" + "ZSU23Generator", + "ColdWarFlakGenerator" ], "sams": [ "SA2Generator", diff --git a/resources/factions/usa_1955.json b/resources/factions/usa_1955.json index 3c5de408..fa7609f3 100644 --- a/resources/factions/usa_1955.json +++ b/resources/factions/usa_1955.json @@ -10,7 +10,6 @@ "B_52H" ], "frontline_units": [ - "MT_M4A4_Sherman_Firefly", "MT_M4_Sherman", "MBT_M60A3_Patton", "APC_M2A1" @@ -22,13 +21,13 @@ "Transport_M818" ], "infantry_units": [ - "Infantry_M1_Garand" + "Infantry_M4" ], "shorads": [ "BoforsGenerator" ], "sams": [ - "BoforsGenerator" + "EarlyColdWarFlakGenerator" ], "doctrine": "ww2", "building_set": "ww2ally", diff --git a/resources/factions/usa_1960.json b/resources/factions/usa_1960.json index 7c2d762d..1ef741fd 100644 --- a/resources/factions/usa_1960.json +++ b/resources/factions/usa_1960.json @@ -23,6 +23,7 @@ "Infantry_M4" ], "shorads": [ + "EarlyColdWarFlakGenerator", "VulcanGenerator" ], "sams": [ diff --git a/resources/factions/usa_1965.json b/resources/factions/usa_1965.json index 74171172..b2b5b1dd 100644 --- a/resources/factions/usa_1965.json +++ b/resources/factions/usa_1965.json @@ -25,7 +25,8 @@ ], "shorads": [ "VulcanGenerator", - "ChaparralGenerator" + "ChaparralGenerator", + "EarlyColdWarFlakGenerator" ], "sams": [ "HawkGenerator", diff --git a/resources/factions/usa_1975.json b/resources/factions/usa_1975.json index 5c999a9e..a30330a6 100644 --- a/resources/factions/usa_1975.json +++ b/resources/factions/usa_1975.json @@ -25,6 +25,7 @@ "Soldier_M249" ], "shorads": [ + "EarlyColdWarFlakGenerator", "VulcanGenerator", "ChaparralGenerator" ], From e6cb1b59702c2b96c32795c9eb6de4978f910ffb Mon Sep 17 00:00:00 2001 From: Khopa Date: Thu, 5 Nov 2020 19:59:21 +0100 Subject: [PATCH 12/17] Updated pydcs submodule commit reference --- .gitmodules | 4 ++-- pydcs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index df57fd30..d8db9cf5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "pydcs"] path = pydcs - url = https://github.com/khopa/dcs - branch = data-export + url = https://github.com/pydcs/dcs + branch = master diff --git a/pydcs b/pydcs index f16b549a..8e74bfb6 160000 --- a/pydcs +++ b/pydcs @@ -1 +1 @@ -Subproject commit f16b549a097586b18e493875ab7b5c110498b1e3 +Subproject commit 8e74bfb61b829477d35a80148fc295f2158902dd From e2682d633fde2b4e703bc9e63c87949df147dcf7 Mon Sep 17 00:00:00 2001 From: Khopa Date: Thu, 5 Nov 2020 20:43:49 +0100 Subject: [PATCH 13/17] Added payloads for bombers. --- resources/customized_payloads/B-1B.lua | 96 +++++++++++++++++ resources/customized_payloads/B-52H.lua | 82 +++++++++++++++ resources/customized_payloads/F-117A.lua | 79 ++++++++++++++ resources/customized_payloads/Tu-142.lua | 67 ++++++++++++ resources/customized_payloads/Tu-160.lua | 82 +++++++++++++++ resources/customized_payloads/Tu-22M3.lua | 123 ++++++++++++++++++++++ resources/customized_payloads/Tu-95MS.lua | 67 ++++++++++++ 7 files changed, 596 insertions(+) create mode 100644 resources/customized_payloads/B-1B.lua create mode 100644 resources/customized_payloads/B-52H.lua create mode 100644 resources/customized_payloads/F-117A.lua create mode 100644 resources/customized_payloads/Tu-142.lua create mode 100644 resources/customized_payloads/Tu-160.lua create mode 100644 resources/customized_payloads/Tu-22M3.lua create mode 100644 resources/customized_payloads/Tu-95MS.lua diff --git a/resources/customized_payloads/B-1B.lua b/resources/customized_payloads/B-1B.lua new file mode 100644 index 00000000..a637ddb4 --- /dev/null +++ b/resources/customized_payloads/B-1B.lua @@ -0,0 +1,96 @@ +local unitPayloads = { + ["name"] = "B-1B", + ["payloads"] = { + [1] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{AABA1A14-78A1-4E85-94DD-463CF75BD9E4}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{AABA1A14-78A1-4E85-94DD-463CF75BD9E4}", + ["num"] = 2, + }, + [3] = { + ["CLSID"] = "{AABA1A14-78A1-4E85-94DD-463CF75BD9E4}", + ["num"] = 3, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [2] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "B-1B_Mk-84*8", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "B-1B_Mk-84*8", + ["num"] = 2, + }, + [3] = { + ["CLSID"] = "B-1B_Mk-84*8", + ["num"] = 3, + }, + }, + ["tasks"] = { + [1] = 34, + [2] = 32, + }, + }, + [3] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{AABA1A14-78A1-4E85-94DD-463CF75BD9E4}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{AABA1A14-78A1-4E85-94DD-463CF75BD9E4}", + ["num"] = 2, + }, + [3] = { + ["CLSID"] = "{AABA1A14-78A1-4E85-94DD-463CF75BD9E4}", + ["num"] = 3, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [4] = { + ["name"] = "CAP", + ["pylons"] = { + }, + ["tasks"] = { + [1] = 33, + }, + }, + [5] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "CBU97*10", + ["num"] = 3, + }, + [2] = { + ["CLSID"] = "CBU97*10", + ["num"] = 2, + }, + [3] = { + ["CLSID"] = "CBU97*10", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + }, + ["unitType"] = "B-1B", +} +return unitPayloads diff --git a/resources/customized_payloads/B-52H.lua b/resources/customized_payloads/B-52H.lua new file mode 100644 index 00000000..80be1776 --- /dev/null +++ b/resources/customized_payloads/B-52H.lua @@ -0,0 +1,82 @@ +local unitPayloads = { + ["name"] = "B-52H", + ["payloads"] = { + [1] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "{585D626E-7F42-4073-AB70-41E728C333E2}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{6C47D097-83FF-4FB2-9496-EAB36DDF0B05}", + ["num"] = 2, + }, + [3] = { + ["CLSID"] = "{585D626E-7F42-4073-AB70-41E728C333E2}", + ["num"] = 3, + }, + }, + ["tasks"] = { + [1] = 32, + [2] = 34, + }, + }, + [2] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{45447F82-01B5-4029-A572-9AAD28AF0275}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{8DCAF3A3-7FCF-41B8-BB88-58DEDA878EDE}", + ["num"] = 2, + }, + [3] = { + ["CLSID"] = "{45447F82-01B5-4029-A572-9AAD28AF0275}", + ["num"] = 3, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [3] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{46ACDCF8-5451-4E26-BDDB-E78D5830E93C}", + ["num"] = 2, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [4] = { + ["name"] = "CAP", + ["pylons"] = { + }, + ["tasks"] = { + }, + }, + [5] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "{4CD2BB0F-5493-44EF-A927-9760350F7BA1}", + ["num"] = 3, + }, + [2] = { + ["CLSID"] = "{4CD2BB0F-5493-44EF-A927-9760350F7BA1}", + ["num"] = 1, + }, + }, + ["tasks"] = { + }, + }, + }, + ["unitType"] = "B-52H", +} +return unitPayloads diff --git a/resources/customized_payloads/F-117A.lua b/resources/customized_payloads/F-117A.lua new file mode 100644 index 00000000..503ed662 --- /dev/null +++ b/resources/customized_payloads/F-117A.lua @@ -0,0 +1,79 @@ +local unitPayloads = { + ["name"] = "F-117A", + ["payloads"] = { + [1] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 2, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [2] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 2, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [3] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 2, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [4] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 1, + }, + [2] = { + ["CLSID"] = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}", + ["num"] = 2, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [5] = { + ["name"] = "CAP", + ["pylons"] = { + }, + ["tasks"] = { + [1] = 33, + }, + }, + }, + ["unitType"] = "F-117A", +} +return unitPayloads diff --git a/resources/customized_payloads/Tu-142.lua b/resources/customized_payloads/Tu-142.lua new file mode 100644 index 00000000..2570bf01 --- /dev/null +++ b/resources/customized_payloads/Tu-142.lua @@ -0,0 +1,67 @@ +local unitPayloads = { + ["name"] = "Tu-142", + ["payloads"] = { + [1] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "{C42EE4C3-355C-4B83-8B22-B39430B8F4AE}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [2] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{C42EE4C3-355C-4B83-8B22-B39430B8F4AE}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [3] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "{C42EE4C3-355C-4B83-8B22-B39430B8F4AE}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [4] = { + ["name"] = "CAP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{C42EE4C3-355C-4B83-8B22-B39430B8F4AE}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [5] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{C42EE4C3-355C-4B83-8B22-B39430B8F4AE}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + }, + ["unitType"] = "Tu-142", +} +return unitPayloads diff --git a/resources/customized_payloads/Tu-160.lua b/resources/customized_payloads/Tu-160.lua new file mode 100644 index 00000000..e0506bfc --- /dev/null +++ b/resources/customized_payloads/Tu-160.lua @@ -0,0 +1,82 @@ +local unitPayloads = { + ["name"] = "Tu-160", + ["payloads"] = { + [1] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 2, + }, + [2] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + }, + }, + [2] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 2, + }, + [2] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + }, + }, + [3] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 2, + }, + [2] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + }, + }, + [4] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 2, + }, + [2] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + }, + }, + [5] = { + ["name"] = "CAP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 2, + }, + [2] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + }, + }, + }, + ["unitType"] = "Tu-160", +} +return unitPayloads diff --git a/resources/customized_payloads/Tu-22M3.lua b/resources/customized_payloads/Tu-22M3.lua new file mode 100644 index 00000000..d64f0862 --- /dev/null +++ b/resources/customized_payloads/Tu-22M3.lua @@ -0,0 +1,123 @@ +local unitPayloads = { + ["name"] = "Tu-22M3", + ["payloads"] = { + [1] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 5, + }, + [2] = { + ["CLSID"] = "{E1AAE713-5FC3-4CAA-9FF5-3FDCFB899E33}", + ["num"] = 4, + }, + [3] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 3, + }, + [4] = { + ["CLSID"] = "{E1AAE713-5FC3-4CAA-9FF5-3FDCFB899E33}", + ["num"] = 2, + }, + [5] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [2] = { + ["name"] = "CAP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 5, + }, + [2] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 3, + }, + [3] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [3] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "{E1AAE713-5FC3-4CAA-9FF5-3FDCFB899E33}", + ["num"] = 5, + }, + [2] = { + ["CLSID"] = "{E1AAE713-5FC3-4CAA-9FF5-3FDCFB899E33}", + ["num"] = 4, + }, + [3] = { + ["CLSID"] = "{AD5E5863-08FC-4283-B92C-162E2B2BD3FF}", + ["num"] = 3, + }, + [4] = { + ["CLSID"] = "{E1AAE713-5FC3-4CAA-9FF5-3FDCFB899E33}", + ["num"] = 2, + }, + [5] = { + ["CLSID"] = "{E1AAE713-5FC3-4CAA-9FF5-3FDCFB899E33}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [4] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 5, + }, + [2] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 1, + }, + [3] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 3, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + [5] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 5, + }, + [2] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 3, + }, + [3] = { + ["CLSID"] = "{12429ECF-03F0-4DF6-BCBD-5D38B6343DE1}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 30, + }, + }, + }, + ["unitType"] = "Tu-22M3", +} +return unitPayloads diff --git a/resources/customized_payloads/Tu-95MS.lua b/resources/customized_payloads/Tu-95MS.lua new file mode 100644 index 00000000..43341378 --- /dev/null +++ b/resources/customized_payloads/Tu-95MS.lua @@ -0,0 +1,67 @@ +local unitPayloads = { + ["name"] = "Tu-95MS", + ["payloads"] = { + [1] = { + ["name"] = "CAP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [2] = { + ["name"] = "CAS", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [3] = { + ["name"] = "SEAD", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [4] = { + ["name"] = "ANTISHIP", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + [5] = { + ["name"] = "STRIKE", + ["pylons"] = { + [1] = { + ["CLSID"] = "{0290F5DE-014A-4BB1-9843-D717749B1DED}", + ["num"] = 1, + }, + }, + ["tasks"] = { + [1] = 33, + }, + }, + }, + ["unitType"] = "Tu-95MS", +} +return unitPayloads From 4ca92ea22d980dbd2339847ec83d87c84f1d58db Mon Sep 17 00:00:00 2001 From: Walter Date: Tue, 3 Nov 2020 12:19:16 -0600 Subject: [PATCH 14/17] Fix ships being wrong unit type --- gen/fleet/dd_group.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gen/fleet/dd_group.py b/gen/fleet/dd_group.py index 7c02a64b..3ba5517e 100644 --- a/gen/fleet/dd_group.py +++ b/gen/fleet/dd_group.py @@ -1,20 +1,41 @@ import random from gen.sam.group_generator import GroupGenerator +from dcs import unitgroup +from dcs.point import PointAction +from dcs.unit import Ship from dcs.ships import * class DDGroupGenerator(GroupGenerator): def __init__(self, game, ground_object, faction, ddtype): - super(DDGroupGenerator, self).__init__(game, ground_object) + self.game = game + self.go = ground_object + self.position = ground_object.position + self.heading = random.randint(0, 359) self.faction = faction + self.vg = unitgroup.ShipGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier) + wp = self.vg.add_waypoint(self.position, 0) + wp.ETA_locked = True self.ddtype = ddtype def generate(self): self.add_unit(self.ddtype, "DD1", self.position.x + 500, self.position.y + 900, self.heading) self.add_unit(self.ddtype, "DD2", self.position.x + 500, self.position.y - 900, self.heading) self.get_generated_group().points[0].speed = 20 + + def add_unit(self, unit_type, name, pos_x, pos_y, heading): + nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name + + unit = Ship(self.game.next_unit_id(), + nn, unit_type) + unit.position.x = pos_x + unit.position.y = pos_y + unit.heading = heading + self.vg.add_unit(unit) + return unit + class OliverHazardPerryGroupGenerator(DDGroupGenerator): From 9087f3487d81bd61963ee642bca2a93abcf240cb Mon Sep 17 00:00:00 2001 From: walterroach Date: Tue, 3 Nov 2020 15:13:24 -0600 Subject: [PATCH 15/17] Single ShipGroupGenerator added --- gen/fleet/carrier_group.py | 10 +++------- gen/fleet/cn_dd_group.py | 8 ++------ gen/fleet/dd_group.py | 27 +++------------------------ gen/fleet/lha_group.py | 8 ++------ gen/fleet/ru_dd_group.py | 8 ++------ gen/fleet/schnellboot.py | 8 ++------ gen/fleet/ship_group_generator.py | 28 +++++++++++++++++++++++++++- gen/fleet/uboat.py | 8 ++------ gen/fleet/ww2lst.py | 8 ++------ gen/sam/group_generator.py | 24 +++++++++++++++++++++++- 10 files changed, 68 insertions(+), 69 deletions(-) diff --git a/gen/fleet/carrier_group.py b/gen/fleet/carrier_group.py index bc7a712c..7d79dbca 100644 --- a/gen/fleet/carrier_group.py +++ b/gen/fleet/carrier_group.py @@ -1,14 +1,10 @@ import random -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator -class CarrierGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(CarrierGroupGenerator, self).__init__(game, ground_object) - self.faction = faction - +class CarrierGroupGenerator(ShipGroupGenerator): + def generate(self): # Add carrier diff --git a/gen/fleet/cn_dd_group.py b/gen/fleet/cn_dd_group.py index efef82d2..162137c9 100644 --- a/gen/fleet/cn_dd_group.py +++ b/gen/fleet/cn_dd_group.py @@ -1,15 +1,11 @@ import random from gen.fleet.dd_group import DDGroupGenerator -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator from dcs.ships import * -class ChineseNavyGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(ChineseNavyGroupGenerator, self).__init__(game, ground_object) - self.faction = faction +class ChineseNavyGroupGenerator(ShipGroupGenerator): def generate(self): diff --git a/gen/fleet/dd_group.py b/gen/fleet/dd_group.py index 3ba5517e..14d58951 100644 --- a/gen/fleet/dd_group.py +++ b/gen/fleet/dd_group.py @@ -1,40 +1,19 @@ import random -from gen.sam.group_generator import GroupGenerator -from dcs import unitgroup -from dcs.point import PointAction -from dcs.unit import Ship +from gen.sam.group_generator import ShipGroupGenerator from dcs.ships import * -class DDGroupGenerator(GroupGenerator): +class DDGroupGenerator(ShipGroupGenerator): def __init__(self, game, ground_object, faction, ddtype): - self.game = game - self.go = ground_object - self.position = ground_object.position - self.heading = random.randint(0, 359) - self.faction = faction - self.vg = unitgroup.ShipGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier) - wp = self.vg.add_waypoint(self.position, 0) - wp.ETA_locked = True + super(DDGroupGenerator, self).__init__(game, ground_object, faction, ddtype) self.ddtype = ddtype def generate(self): self.add_unit(self.ddtype, "DD1", self.position.x + 500, self.position.y + 900, self.heading) self.add_unit(self.ddtype, "DD2", self.position.x + 500, self.position.y - 900, self.heading) self.get_generated_group().points[0].speed = 20 - - def add_unit(self, unit_type, name, pos_x, pos_y, heading): - nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name - - unit = Ship(self.game.next_unit_id(), - nn, unit_type) - unit.position.x = pos_x - unit.position.y = pos_y - unit.heading = heading - self.vg.add_unit(unit) - return unit diff --git a/gen/fleet/lha_group.py b/gen/fleet/lha_group.py index 6fbf23ac..49ab31e6 100644 --- a/gen/fleet/lha_group.py +++ b/gen/fleet/lha_group.py @@ -1,13 +1,9 @@ import random -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator -class LHAGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(LHAGroupGenerator, self).__init__(game, ground_object) - self.faction = faction +class LHAGroupGenerator(ShipGroupGenerator): def generate(self): diff --git a/gen/fleet/ru_dd_group.py b/gen/fleet/ru_dd_group.py index dc048029..ed9d6ad4 100644 --- a/gen/fleet/ru_dd_group.py +++ b/gen/fleet/ru_dd_group.py @@ -1,15 +1,11 @@ import random from gen.fleet.dd_group import DDGroupGenerator -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator from dcs.ships import * -class RussianNavyGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(RussianNavyGroupGenerator, self).__init__(game, ground_object) - self.faction = faction +class RussianNavyGroupGenerator(ShipGroupGenerator): def generate(self): diff --git a/gen/fleet/schnellboot.py b/gen/fleet/schnellboot.py index 20459ac7..20b128ae 100644 --- a/gen/fleet/schnellboot.py +++ b/gen/fleet/schnellboot.py @@ -2,14 +2,10 @@ import random from dcs.ships import Schnellboot_type_S130 -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator -class SchnellbootGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(SchnellbootGroupGenerator, self).__init__(game, ground_object) - self.faction = faction +class SchnellbootGroupGenerator(ShipGroupGenerator): def generate(self): diff --git a/gen/fleet/ship_group_generator.py b/gen/fleet/ship_group_generator.py index b60746b7..b3f8855c 100644 --- a/gen/fleet/ship_group_generator.py +++ b/gen/fleet/ship_group_generator.py @@ -11,6 +11,9 @@ from gen.fleet.ru_dd_group import RussianNavyGroupGenerator, GrishaGroupGenerato from gen.fleet.schnellboot import SchnellbootGroupGenerator from gen.fleet.uboat import UBoatGroupGenerator from gen.fleet.ww2lst import WW2LSTGroupGenerator +# from dcs import unitgroup +# from dcs.unit import Ship + SHIP_MAP = { "SchnellbootGroupGenerator": SchnellbootGroupGenerator, @@ -68,4 +71,27 @@ def generate_lha_group(faction:str, game, ground_object): """ generator = LHAGroupGenerator(game, ground_object, db.FACTIONS[faction]) generator.generate() - return generator.get_generated_group() \ No newline at end of file + return generator.get_generated_group() + +# class ShipGroupGenerator(GroupGenerator): +# """Abstract class for other ship generator classes""" +# def __init__(self, game, ground_object, faction): +# self.game = game +# self.go = ground_object +# self.position = ground_object.position +# self.heading = random.randint(0, 359) +# self.faction = faction +# self.vg = unitgroup.ShipGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier) +# wp = self.vg.add_waypoint(self.position, 0) +# wp.ETA_locked = True + +# def add_unit(self, unit_type, name, pos_x, pos_y, heading): +# nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name + +# unit = Ship(self.game.next_unit_id(), +# nn, unit_type) +# unit.position.x = pos_x +# unit.position.y = pos_y +# unit.heading = heading +# self.vg.add_unit(unit) +# return unit diff --git a/gen/fleet/uboat.py b/gen/fleet/uboat.py index c93c7814..8d2e9cc0 100644 --- a/gen/fleet/uboat.py +++ b/gen/fleet/uboat.py @@ -2,14 +2,10 @@ import random from dcs.ships import Uboat_VIIC_U_flak -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator -class UBoatGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(UBoatGroupGenerator, self).__init__(game, ground_object) - self.faction = faction +class UBoatGroupGenerator(ShipGroupGenerator): def generate(self): diff --git a/gen/fleet/ww2lst.py b/gen/fleet/ww2lst.py index 07f320d0..e0512009 100644 --- a/gen/fleet/ww2lst.py +++ b/gen/fleet/ww2lst.py @@ -2,14 +2,10 @@ import random from dcs.ships import LS_Samuel_Chase, LST_Mk_II -from gen.sam.group_generator import GroupGenerator +from gen.sam.group_generator import ShipGroupGenerator -class WW2LSTGroupGenerator(GroupGenerator): - - def __init__(self, game, ground_object, faction): - super(WW2LSTGroupGenerator, self).__init__(game, ground_object) - self.faction = faction +class WW2LSTGroupGenerator(ShipGroupGenerator): def generate(self): diff --git a/gen/sam/group_generator.py b/gen/sam/group_generator.py index 9f150ef4..c3e0912f 100644 --- a/gen/sam/group_generator.py +++ b/gen/sam/group_generator.py @@ -3,7 +3,7 @@ import random from dcs import unitgroup from dcs.point import PointAction -from dcs.unit import Vehicle +from dcs.unit import Vehicle, Ship class GroupGenerator(): @@ -75,3 +75,25 @@ class GroupGenerator(): current_offset += outer_offset return positions +class ShipGroupGenerator(GroupGenerator): + """Abstract class for other ship generator classes""" + def __init__(self, game, ground_object, faction): + self.game = game + self.go = ground_object + self.position = ground_object.position + self.heading = random.randint(0, 359) + self.faction = faction + self.vg = unitgroup.ShipGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier) + wp = self.vg.add_waypoint(self.position, 0) + wp.ETA_locked = True + + def add_unit(self, unit_type, name, pos_x, pos_y, heading): + nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name + + unit = Ship(self.game.next_unit_id(), + nn, unit_type) + unit.position.x = pos_x + unit.position.y = pos_y + unit.heading = heading + self.vg.add_unit(unit) + return unit From 1f165835c6aaf11174d7b067c1ead1dc771dcecb Mon Sep 17 00:00:00 2001 From: walterroach Date: Tue, 3 Nov 2020 16:21:15 -0600 Subject: [PATCH 16/17] type hinting and comment cleanup --- gen/fleet/carrier_group.py | 4 ++-- gen/fleet/cn_dd_group.py | 21 ++++++++++++++++++--- gen/fleet/dd_group.py | 21 ++++++++++++++------- gen/fleet/lha_group.py | 2 +- gen/fleet/ru_dd_group.py | 29 +++++++++++++++++++++++------ gen/fleet/schnellboot.py | 2 +- gen/fleet/ship_group_generator.py | 29 ++--------------------------- gen/sam/group_generator.py | 16 ++++++++++++---- gen/sam/sam_group_generator.py | 2 +- 9 files changed, 74 insertions(+), 52 deletions(-) diff --git a/gen/fleet/carrier_group.py b/gen/fleet/carrier_group.py index 7d79dbca..a06ebaee 100644 --- a/gen/fleet/carrier_group.py +++ b/gen/fleet/carrier_group.py @@ -4,7 +4,7 @@ from gen.sam.group_generator import ShipGroupGenerator class CarrierGroupGenerator(ShipGroupGenerator): - + def generate(self): # Add carrier @@ -23,4 +23,4 @@ class CarrierGroupGenerator(ShipGroupGenerator): self.add_unit(dd_type, "DD3", self.position.x + 4500, self.position.y + 8500, self.heading) self.add_unit(dd_type, "DD4", self.position.x + 4500, self.position.y - 8500, self.heading) - self.get_generated_group().points[0].speed = 20 \ No newline at end of file + self.get_generated_group().points[0].speed = 20 diff --git a/gen/fleet/cn_dd_group.py b/gen/fleet/cn_dd_group.py index 162137c9..020f68c2 100644 --- a/gen/fleet/cn_dd_group.py +++ b/gen/fleet/cn_dd_group.py @@ -1,8 +1,23 @@ -import random +from __future__ import annotations +import random +from typing import TYPE_CHECKING + + +from dcs.ships import ( + Type_052C_Destroyer, + Type_052B_Destroyer, + Type_054A_Frigate, + CGN_1144_2_Pyotr_Velikiy, +) + +from game.factions.faction import Faction from gen.fleet.dd_group import DDGroupGenerator from gen.sam.group_generator import ShipGroupGenerator -from dcs.ships import * +from theater.theatergroundobject import TheaterGroundObject + +if TYPE_CHECKING: + from game.game import Game class ChineseNavyGroupGenerator(ShipGroupGenerator): @@ -34,5 +49,5 @@ class ChineseNavyGroupGenerator(ShipGroupGenerator): class Type54GroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(Type54GroupGenerator, self).__init__(game, ground_object, faction, Type_054A_Frigate) diff --git a/gen/fleet/dd_group.py b/gen/fleet/dd_group.py index 14d58951..b11de653 100644 --- a/gen/fleet/dd_group.py +++ b/gen/fleet/dd_group.py @@ -1,13 +1,21 @@ -import random +from __future__ import annotations +from typing import TYPE_CHECKING + +from game.factions.faction import Faction +from theater.theatergroundobject import TheaterGroundObject from gen.sam.group_generator import ShipGroupGenerator -from dcs.ships import * +from dcs.unittype import ShipType +from dcs.ships import Oliver_Hazzard_Perry_class, USS_Arleigh_Burke_IIa + +if TYPE_CHECKING: + from game.game import Game class DDGroupGenerator(ShipGroupGenerator): - def __init__(self, game, ground_object, faction, ddtype): - super(DDGroupGenerator, self).__init__(game, ground_object, faction, ddtype) + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction, ddtype: ShipType): + super(DDGroupGenerator, self).__init__(game, ground_object, faction) self.ddtype = ddtype def generate(self): @@ -16,12 +24,11 @@ class DDGroupGenerator(ShipGroupGenerator): self.get_generated_group().points[0].speed = 20 - class OliverHazardPerryGroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(OliverHazardPerryGroupGenerator, self).__init__(game, ground_object, faction, Oliver_Hazzard_Perry_class) class ArleighBurkeGroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(ArleighBurkeGroupGenerator, self).__init__(game, ground_object, faction, USS_Arleigh_Burke_IIa) diff --git a/gen/fleet/lha_group.py b/gen/fleet/lha_group.py index 49ab31e6..cfbafcbb 100644 --- a/gen/fleet/lha_group.py +++ b/gen/fleet/lha_group.py @@ -18,4 +18,4 @@ class LHAGroupGenerator(ShipGroupGenerator): self.add_unit(dd_type, "DD1", self.position.x + 1250, self.position.y + 1450, self.heading) self.add_unit(dd_type, "DD2", self.position.x + 1250, self.position.y - 1450, self.heading) - self.get_generated_group().points[0].speed = 20 \ No newline at end of file + self.get_generated_group().points[0].speed = 20 diff --git a/gen/fleet/ru_dd_group.py b/gen/fleet/ru_dd_group.py index ed9d6ad4..0948991a 100644 --- a/gen/fleet/ru_dd_group.py +++ b/gen/fleet/ru_dd_group.py @@ -1,8 +1,26 @@ +from __future__ import annotations import random +from typing import TYPE_CHECKING + +from dcs.ships import ( + FFL_1124_4_Grisha, + FSG_1241_1MP_Molniya, + FFG_11540_Neustrashimy, + FF_1135M_Rezky, + CG_1164_Moskva, + CGN_1144_2_Pyotr_Velikiy, + SSK_877, + SSK_641B +) from gen.fleet.dd_group import DDGroupGenerator from gen.sam.group_generator import ShipGroupGenerator -from dcs.ships import * +from game.factions.faction import Faction +from theater.theatergroundobject import TheaterGroundObject + + +if TYPE_CHECKING: + from game.game import Game class RussianNavyGroupGenerator(ShipGroupGenerator): @@ -35,21 +53,20 @@ class RussianNavyGroupGenerator(ShipGroupGenerator): class GrishaGroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(GrishaGroupGenerator, self).__init__(game, ground_object, faction, FFL_1124_4_Grisha) class MolniyaGroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(MolniyaGroupGenerator, self).__init__(game, ground_object, faction, FSG_1241_1MP_Molniya) class KiloSubGroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(KiloSubGroupGenerator, self).__init__(game, ground_object, faction, SSK_877) class TangoSubGroupGenerator(DDGroupGenerator): - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): super(TangoSubGroupGenerator, self).__init__(game, ground_object, faction, SSK_641B) - diff --git a/gen/fleet/schnellboot.py b/gen/fleet/schnellboot.py index 20b128ae..3de8783e 100644 --- a/gen/fleet/schnellboot.py +++ b/gen/fleet/schnellboot.py @@ -12,4 +12,4 @@ class SchnellbootGroupGenerator(ShipGroupGenerator): for i in range(random.randint(2, 4)): self.add_unit(Schnellboot_type_S130, "Schnellboot" + str(i), self.position.x + i * random.randint(100, 250), self.position.y + (random.randint(100, 200)-100), self.heading) - self.get_generated_group().points[0].speed = 20 \ No newline at end of file + self.get_generated_group().points[0].speed = 20 diff --git a/gen/fleet/ship_group_generator.py b/gen/fleet/ship_group_generator.py index b3f8855c..db0a78cd 100644 --- a/gen/fleet/ship_group_generator.py +++ b/gen/fleet/ship_group_generator.py @@ -11,8 +11,6 @@ from gen.fleet.ru_dd_group import RussianNavyGroupGenerator, GrishaGroupGenerato from gen.fleet.schnellboot import SchnellbootGroupGenerator from gen.fleet.uboat import UBoatGroupGenerator from gen.fleet.ww2lst import WW2LSTGroupGenerator -# from dcs import unitgroup -# from dcs.unit import Ship SHIP_MAP = { @@ -48,7 +46,7 @@ def generate_ship_group(game, ground_object, faction_name: str): return None -def generate_carrier_group(faction:str, game, ground_object): +def generate_carrier_group(faction: str, game, ground_object): """ This generate a carrier group :param parentCp: The parent control point @@ -61,7 +59,7 @@ def generate_carrier_group(faction:str, game, ground_object): return generator.get_generated_group() -def generate_lha_group(faction:str, game, ground_object): +def generate_lha_group(faction: str, game, ground_object): """ This generate a lha carrier group :param parentCp: The parent control point @@ -72,26 +70,3 @@ def generate_lha_group(faction:str, game, ground_object): generator = LHAGroupGenerator(game, ground_object, db.FACTIONS[faction]) generator.generate() return generator.get_generated_group() - -# class ShipGroupGenerator(GroupGenerator): -# """Abstract class for other ship generator classes""" -# def __init__(self, game, ground_object, faction): -# self.game = game -# self.go = ground_object -# self.position = ground_object.position -# self.heading = random.randint(0, 359) -# self.faction = faction -# self.vg = unitgroup.ShipGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier) -# wp = self.vg.add_waypoint(self.position, 0) -# wp.ETA_locked = True - -# def add_unit(self, unit_type, name, pos_x, pos_y, heading): -# nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name - -# unit = Ship(self.game.next_unit_id(), -# nn, unit_type) -# unit.position.x = pos_x -# unit.position.y = pos_y -# unit.heading = heading -# self.vg.add_unit(unit) -# return unit diff --git a/gen/sam/group_generator.py b/gen/sam/group_generator.py index c3e0912f..5f6e90d6 100644 --- a/gen/sam/group_generator.py +++ b/gen/sam/group_generator.py @@ -1,14 +1,23 @@ +from __future__ import annotations import math import random +from typing import TYPE_CHECKING, Optional from dcs import unitgroup from dcs.point import PointAction from dcs.unit import Vehicle, Ship +from dcs.unittype import VehicleType + +from game.factions.faction import Faction +from theater.theatergroundobject import TheaterGroundObject + +if TYPE_CHECKING: + from game.game import Game class GroupGenerator(): - def __init__(self, game, ground_object, faction = None): # faction is not mandatory because some subclasses do not use it + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Optional[Faction] = None): # faction is not mandatory because some subclasses do not use it self.game = game self.go = ground_object self.position = ground_object.position @@ -28,8 +37,7 @@ class GroupGenerator(): def get_generated_group(self): return self.vg - def add_unit(self, unit_type, name, pos_x, pos_y, heading): - + def add_unit(self, unit_type: VehicleType, name: str, pos_x: float, pos_y: float, heading: int): nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name unit = Vehicle(self.game.next_unit_id(), @@ -77,7 +85,7 @@ class GroupGenerator(): class ShipGroupGenerator(GroupGenerator): """Abstract class for other ship generator classes""" - def __init__(self, game, ground_object, faction): + def __init__(self, game: Game, ground_object: TheaterGroundObject, faction: Faction): self.game = game self.go = ground_object self.position = ground_object.position diff --git a/gen/sam/sam_group_generator.py b/gen/sam/sam_group_generator.py index a2a20a1c..ea9cb1f8 100644 --- a/gen/sam/sam_group_generator.py +++ b/gen/sam/sam_group_generator.py @@ -122,7 +122,7 @@ def generate_anti_air_group(game, parent_cp, ground_object, faction: str): possible_sams_generators = get_faction_possible_sams_generator(faction) if len(possible_sams_generators) > 0: sam_generator_class = random.choice(possible_sams_generators) - generator = sam_generator_class(game, ground_object, faction) + generator = sam_generator_class(game, ground_object, db.FACTIONS[faction]) generator.generate() return generator.get_generated_group() return None From f4d3660eacfddebb3e00e223d46c8c84e52e48c2 Mon Sep 17 00:00:00 2001 From: walterroach Date: Wed, 4 Nov 2020 11:15:41 -0600 Subject: [PATCH 17/17] split sead and dead change SEAD to engage in zone --- gen/aircraft.py | 57 ++++++++++++++++++++++++++++++---- gen/flights/flight.py | 1 + gen/flights/flightplan.py | 38 ++++++++++++++++++++--- gen/flights/waypointbuilder.py | 5 +++ 4 files changed, 91 insertions(+), 10 deletions(-) diff --git a/gen/aircraft.py b/gen/aircraft.py index 25c4f65e..0fac70b0 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -1027,9 +1027,21 @@ class AircraftConflictGenerator: rtb_winchester=OptRTBOnOutOfAmmo.Values.Unguided, restrict_jettison=True) + def configure_dead(self, group: FlyingGroup, package: Package, + flight: Flight, + dynamic_runways: Dict[str, RunwayData]) -> None: + group.task = SEAD.name + self._setup_group(group, SEAD, package, flight, dynamic_runways) + self.configure_behavior( + group, + react_on_threat=OptReactOnThreat.Values.EvadeFire, + roe=OptROE.Values.OpenFire, + rtb_winchester=OptRTBOnOutOfAmmo.Values.ASM, + restrict_jettison=True) + def configure_sead(self, group: FlyingGroup, package: Package, - flight: Flight, - dynamic_runways: Dict[str, RunwayData]) -> None: + flight: Flight, + dynamic_runways: Dict[str, RunwayData]) -> None: group.task = SEAD.name self._setup_group(group, SEAD, package, flight, dynamic_runways) self.configure_behavior( @@ -1087,7 +1099,9 @@ class AircraftConflictGenerator: self.configure_cap(group, package, flight, dynamic_runways) elif flight_type in [FlightType.CAS, FlightType.BAI]: self.configure_cas(group, package, flight, dynamic_runways) - elif flight_type in [FlightType.SEAD, FlightType.DEAD]: + elif flight_type in [FlightType.DEAD, ]: + self.configure_dead(group, package, flight, dynamic_runways) + elif flight_type in [FlightType.SEAD, ]: self.configure_sead(group, package, flight, dynamic_runways) elif flight_type in [FlightType.STRIKE]: self.configure_strike(group, package, flight, dynamic_runways) @@ -1208,6 +1222,7 @@ class PydcsWaypointBuilder: mission: Mission) -> PydcsWaypointBuilder: builders = { FlightWaypointType.INGRESS_CAS: CasIngressBuilder, + FlightWaypointType.INGRESS_DEAD: DeadIngressBuilder, FlightWaypointType.INGRESS_SEAD: SeadIngressBuilder, FlightWaypointType.INGRESS_STRIKE: StrikeIngressBuilder, FlightWaypointType.JOIN: JoinPointBuilder, @@ -1273,14 +1288,14 @@ class CasIngressBuilder(PydcsWaypointBuilder): return waypoint -class SeadIngressBuilder(PydcsWaypointBuilder): +class DeadIngressBuilder(PydcsWaypointBuilder): def build(self) -> MovingPoint: waypoint = super().build() target_group = self.package.target if isinstance(target_group, TheaterGroundObject): - tgroup = self.mission.find_group(target_group.group_identifier) - if tgroup is not None: + tgroup = self.mission.find_group(target_group.group_identifier, search="match") # Match search is used due to TheaterGroundObject.name not matching + if tgroup is not None: # the Mission group name because of SkyNet prefixes. task = AttackGroup(tgroup.id) task.params["expend"] = "All" task.params["attackQtyLimit"] = False @@ -1289,6 +1304,36 @@ class SeadIngressBuilder(PydcsWaypointBuilder): task.params["weaponType"] = 268402702 # Guided Weapons task.params["groupAttack"] = True waypoint.tasks.append(task) + else: + logging.error(f"Could not find group for DEAD mission {target_group.group_identifier}") + + for i, t in enumerate(self.waypoint.targets): + if self.group.units[0].unit_type == JF_17 and i < 4: + self.group.add_nav_target_point(t.position, "PP" + str(i + 1)) + if self.group.units[0].unit_type == F_14B and i == 0: + self.group.add_nav_target_point(t.position, "ST") + if self.group.units[0].unit_type == AJS37 and i < 9: + self.group.add_nav_target_point(t.position, "M" + str(i + 1)) + return waypoint + + +class SeadIngressBuilder(PydcsWaypointBuilder): + def build(self) -> MovingPoint: + waypoint = super().build() + + target_group = self.package.target + if isinstance(target_group, TheaterGroundObject): + tgroup = self.mission.find_group(target_group.group_identifier, search="match") # Match search is used due to TheaterGroundObject.name not matching + if tgroup is not None: # the Mission group name because of SkyNet prefixes. + waypoint.add_task(EngageTargetsInZone( + position=tgroup.position, + radius=nm_to_meter(30), + targets=[ + Targets.All.GroundUnits.AirDefence, + ]) + ) + else: + logging.error(f"Could not find group for DEAD mission {target_group.group_identifier}") for i, t in enumerate(self.waypoint.targets): if self.group.units[0].unit_type == JF_17 and i < 4: diff --git a/gen/flights/flight.py b/gen/flights/flight.py index 48296635..d76347f3 100644 --- a/gen/flights/flight.py +++ b/gen/flights/flight.py @@ -60,6 +60,7 @@ class FlightWaypointType(Enum): SPLIT = 17 LOITER = 18 INGRESS_ESCORT = 19 + INGRESS_DEAD = 20 class FlightWaypoint: diff --git a/gen/flights/flightplan.py b/gen/flights/flightplan.py index 60fb32cf..8839b1af 100644 --- a/gen/flights/flightplan.py +++ b/gen/flights/flightplan.py @@ -36,6 +36,7 @@ INGRESS_TYPES = { FlightWaypointType.INGRESS_ESCORT, FlightWaypointType.INGRESS_SEAD, FlightWaypointType.INGRESS_STRIKE, + FlightWaypointType.INGRESS_DEAD, } @@ -545,7 +546,7 @@ class FlightPlanBuilder: elif task == FlightType.CAS: return self.generate_cas(flight) elif task == FlightType.DEAD: - return self.generate_sead(flight, custom_targets) + return self.generate_dead(flight, custom_targets) elif task == FlightType.ESCORT: return self.generate_escort(flight) elif task == FlightType.SEAD: @@ -734,9 +735,34 @@ class FlightPlanBuilder: land=land ) + def generate_dead(self, flight: Flight, + custom_targets: Optional[List[Unit]]) -> StrikeFlightPlan: + """Generate a DEAD flight at a given location. + + Args: + flight: The flight to generate the flight plan for. + custom_targets: Specific radar equipped units selected by the user. + """ + location = self.package.target + + if not isinstance(location, TheaterGroundObject): + logging.exception(f"Invalid Objective Location for DEAD flight {flight=} at {location=}") + raise InvalidObjectiveLocation(flight.flight_type, location) + + # TODO: Unify these. + # There doesn't seem to be any reason to treat the UI fragged missions + # different from the automatic missions. + targets: Optional[List[StrikeTarget]] = None + if custom_targets is not None: + targets = [] + for target in custom_targets: + targets.append(StrikeTarget(location.name, target)) + + return self.strike_flightplan(flight, location, targets) + def generate_sead(self, flight: Flight, custom_targets: Optional[List[Unit]]) -> StrikeFlightPlan: - """Generate a SEAD/DEAD flight at a given location. + """Generate a SEAD flight at a given location. Args: flight: The flight to generate the flight plan for. @@ -884,10 +910,14 @@ class FlightPlanBuilder: assert self.package.waypoints is not None builder = WaypointBuilder(self.game.conditions, flight, self.doctrine, targets) - sead_types = {FlightType.DEAD, FlightType.SEAD} - if flight.flight_type in sead_types: + # sead_types = {FlightType.DEAD, FlightType.SEAD} + if flight.flight_type is FlightType.SEAD: ingress = builder.ingress_sead(self.package.waypoints.ingress, location) + + elif flight.flight_type is FlightType.DEAD: + ingress = builder.ingress_dead(self.package.waypoints.ingress, + location) else: ingress = builder.ingress_strike(self.package.waypoints.ingress, location) diff --git a/gen/flights/waypointbuilder.py b/gen/flights/waypointbuilder.py index 1e081ee7..ddc76b5f 100644 --- a/gen/flights/waypointbuilder.py +++ b/gen/flights/waypointbuilder.py @@ -168,6 +168,11 @@ class WaypointBuilder: objective: MissionTarget) -> FlightWaypoint: return self._ingress(FlightWaypointType.INGRESS_ESCORT, position, objective) + + def ingress_dead(self, position:Point, + objective: MissionTarget) -> FlightWaypoint: + return self._ingress(FlightWaypointType.INGRESS_DEAD, position, + objective) def ingress_sead(self, position: Point, objective: MissionTarget) -> FlightWaypoint: