From fe4b241efce7f45b7ed1da27f401872d32519e19 Mon Sep 17 00:00:00 2001 From: spencer-ki Date: Wed, 2 Feb 2022 07:31:56 -0800 Subject: [PATCH] .. --- Generator/MissionGenerator.py | 8 +- Generator/MissionGeneratorUI.py | 121 +++++++------- Generator/MissionGeneratorUI.ui | 280 +++++++++++++++++--------------- Generator/RotorOpsMission.py | 108 ++++++++++-- Generator/RotorOpsUnits.py | 3 + Generator/build command.txt | 5 + Splash_Damage_2_0.lua | 1 + 7 files changed, 319 insertions(+), 207 deletions(-) create mode 100644 Generator/build command.txt diff --git a/Generator/MissionGenerator.py b/Generator/MissionGenerator.py index 15883be..ea688ee 100644 --- a/Generator/MissionGenerator.py +++ b/Generator/MissionGenerator.py @@ -150,10 +150,8 @@ class Window(QMainWindow, Ui_MainWindow): "blue_quantity": self.blueqty_spinBox.value(), "inf_spawn_qty": self.inf_spawn_spinBox.value(), "apc_spawns_inf": self.apcs_spawn_checkBox.isChecked(), - "e_transport": self.enemy_transport_checkBox.isChecked(), - "e_attack_helos": self.enemy_attack_helos_checkBox.isChecked(), - "e_fighters": self.enemy_fighters_checkBox.isChecked(), - "e_attack_planes": self.enemy_attack_planes_checkBox.isChecked(), + "e_attack_helos": self.e_attack_helos_spinBox.value(), + "e_attack_planes": self.e_attack_planes_spinBox.value(), "crates": self.logistics_crates_checkBox.isChecked(), "f_awacs": self.awacs_checkBox.isChecked(), "f_tankers": self.tankers_checkBox.isChecked(), @@ -163,6 +161,8 @@ class Window(QMainWindow, Ui_MainWindow): "game_display": self.game_status_checkBox.isChecked(), "defending": self.defense_checkBox.isChecked(), "slots": self.slot_template_comboBox.currentText(), + "smoke_zone": self.smoke_checkBox.isChecked(), + "zone_protect_sams": self.zone_sams_checkBox.isChecked(), } os.chdir(self.m.home_dir + '/Generator') n = ROps.RotorOpsMission() diff --git a/Generator/MissionGeneratorUI.py b/Generator/MissionGeneratorUI.py index c24a113..ae5fdd3 100644 --- a/Generator/MissionGeneratorUI.py +++ b/Generator/MissionGeneratorUI.py @@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(1140, 826) + MainWindow.resize(1209, 900) font = QtGui.QFont() font.setPointSize(10) MainWindow.setFont(font) @@ -39,7 +39,7 @@ class Ui_MainWindow(object): self.scenario_label.setFont(font) self.scenario_label.setObjectName("scenario_label") self.generateButton = QtWidgets.QPushButton(self.centralwidget) - self.generateButton.setGeometry(QtCore.QRect(940, 720, 141, 41)) + self.generateButton.setGeometry(QtCore.QRect(1020, 790, 141, 41)) self.generateButton.setStyleSheet("background-color: white;\n" "border-style: outset;\n" "border-width: 2px;\n" @@ -73,7 +73,7 @@ class Ui_MainWindow(object): self.redforces_comboBox.setGeometry(QtCore.QRect(170, 230, 291, 31)) self.redforces_comboBox.setObjectName("redforces_comboBox") self.background_label = QtWidgets.QLabel(self.centralwidget) - self.background_label.setGeometry(QtCore.QRect(10, 430, 801, 371)) + self.background_label.setGeometry(QtCore.QRect(-30, 490, 801, 371)) self.background_label.setAutoFillBackground(False) self.background_label.setStyleSheet("") self.background_label.setText("") @@ -113,7 +113,7 @@ class Ui_MainWindow(object): self.scenario_label_4.setAlignment(QtCore.Qt.AlignCenter) self.scenario_label_4.setObjectName("scenario_label_4") self.game_status_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.game_status_checkBox.setGeometry(QtCore.QRect(910, 510, 191, 16)) + self.game_status_checkBox.setGeometry(QtCore.QRect(1000, 590, 191, 16)) font = QtGui.QFont() font.setPointSize(9) self.game_status_checkBox.setFont(font) @@ -121,67 +121,39 @@ class Ui_MainWindow(object): self.game_status_checkBox.setTristate(False) self.game_status_checkBox.setObjectName("game_status_checkBox") self.voiceovers_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.voiceovers_checkBox.setGeometry(QtCore.QRect(910, 570, 191, 16)) + self.voiceovers_checkBox.setGeometry(QtCore.QRect(1000, 650, 191, 16)) font = QtGui.QFont() font.setPointSize(9) self.voiceovers_checkBox.setFont(font) self.voiceovers_checkBox.setChecked(True) self.voiceovers_checkBox.setObjectName("voiceovers_checkBox") self.logistics_crates_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.logistics_crates_checkBox.setGeometry(QtCore.QRect(910, 320, 251, 31)) + self.logistics_crates_checkBox.setGeometry(QtCore.QRect(970, 390, 251, 31)) font = QtGui.QFont() font.setPointSize(11) self.logistics_crates_checkBox.setFont(font) self.logistics_crates_checkBox.setObjectName("logistics_crates_checkBox") self.awacs_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.awacs_checkBox.setGeometry(QtCore.QRect(910, 350, 251, 31)) + self.awacs_checkBox.setGeometry(QtCore.QRect(970, 420, 251, 31)) font = QtGui.QFont() font.setPointSize(11) self.awacs_checkBox.setFont(font) self.awacs_checkBox.setStatusTip("") self.awacs_checkBox.setObjectName("awacs_checkBox") self.tankers_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.tankers_checkBox.setGeometry(QtCore.QRect(910, 380, 251, 31)) + self.tankers_checkBox.setGeometry(QtCore.QRect(970, 450, 251, 31)) font = QtGui.QFont() font.setPointSize(11) self.tankers_checkBox.setFont(font) self.tankers_checkBox.setObjectName("tankers_checkBox") self.apcs_spawn_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.apcs_spawn_checkBox.setGeometry(QtCore.QRect(470, 400, 251, 31)) + self.apcs_spawn_checkBox.setGeometry(QtCore.QRect(500, 400, 251, 31)) font = QtGui.QFont() font.setPointSize(10) self.apcs_spawn_checkBox.setFont(font) self.apcs_spawn_checkBox.setObjectName("apcs_spawn_checkBox") - self.enemy_transport_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.enemy_transport_checkBox.setEnabled(False) - self.enemy_transport_checkBox.setGeometry(QtCore.QRect(70, 320, 251, 31)) - font = QtGui.QFont() - font.setPointSize(11) - self.enemy_transport_checkBox.setFont(font) - self.enemy_transport_checkBox.setObjectName("enemy_transport_checkBox") - self.enemy_attack_helos_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.enemy_attack_helos_checkBox.setEnabled(True) - self.enemy_attack_helos_checkBox.setGeometry(QtCore.QRect(70, 350, 251, 31)) - font = QtGui.QFont() - font.setPointSize(11) - self.enemy_attack_helos_checkBox.setFont(font) - self.enemy_attack_helos_checkBox.setObjectName("enemy_attack_helos_checkBox") - self.enemy_fighters_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.enemy_fighters_checkBox.setEnabled(False) - self.enemy_fighters_checkBox.setGeometry(QtCore.QRect(70, 380, 251, 31)) - font = QtGui.QFont() - font.setPointSize(11) - self.enemy_fighters_checkBox.setFont(font) - self.enemy_fighters_checkBox.setObjectName("enemy_fighters_checkBox") - self.enemy_attack_planes_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.enemy_attack_planes_checkBox.setEnabled(True) - self.enemy_attack_planes_checkBox.setGeometry(QtCore.QRect(70, 410, 251, 31)) - font = QtGui.QFont() - font.setPointSize(11) - self.enemy_attack_planes_checkBox.setFont(font) - self.enemy_attack_planes_checkBox.setObjectName("enemy_attack_planes_checkBox") self.inf_spawn_spinBox = QtWidgets.QSpinBox(self.centralwidget) - self.inf_spawn_spinBox.setGeometry(QtCore.QRect(680, 360, 71, 31)) + self.inf_spawn_spinBox.setGeometry(QtCore.QRect(710, 360, 71, 31)) font = QtGui.QFont() font.setPointSize(12) self.inf_spawn_spinBox.setFont(font) @@ -190,7 +162,7 @@ class Ui_MainWindow(object): self.inf_spawn_spinBox.setProperty("value", 2) self.inf_spawn_spinBox.setObjectName("inf_spawn_spinBox") self.smoke_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.smoke_checkBox.setGeometry(QtCore.QRect(910, 540, 191, 16)) + self.smoke_checkBox.setGeometry(QtCore.QRect(1000, 620, 191, 16)) font = QtGui.QFont() font.setPointSize(9) self.smoke_checkBox.setFont(font) @@ -208,28 +180,28 @@ class Ui_MainWindow(object): self.forces_hint_label_2.setAlignment(QtCore.Qt.AlignCenter) self.forces_hint_label_2.setObjectName("forces_hint_label_2") self.label = QtWidgets.QLabel(self.centralwidget) - self.label.setGeometry(QtCore.QRect(470, 360, 191, 31)) + self.label.setGeometry(QtCore.QRect(500, 360, 191, 31)) font = QtGui.QFont() font.setPointSize(10) self.label.setFont(font) self.label.setObjectName("label") self.slot_template_comboBox = QtWidgets.QComboBox(self.centralwidget) - self.slot_template_comboBox.setGeometry(QtCore.QRect(790, 630, 291, 31)) + self.slot_template_comboBox.setGeometry(QtCore.QRect(870, 700, 291, 31)) self.slot_template_comboBox.setObjectName("slot_template_comboBox") self.label_2 = QtWidgets.QLabel(self.centralwidget) - self.label_2.setGeometry(QtCore.QRect(650, 630, 111, 31)) + self.label_2.setGeometry(QtCore.QRect(750, 700, 111, 31)) font = QtGui.QFont() font.setPointSize(11) self.label_2.setFont(font) self.label_2.setObjectName("label_2") self.scenario_label_6 = QtWidgets.QLabel(self.centralwidget) - self.scenario_label_6.setGeometry(QtCore.QRect(470, 320, 141, 31)) + self.scenario_label_6.setGeometry(QtCore.QRect(500, 320, 141, 31)) font = QtGui.QFont() font.setPointSize(11) self.scenario_label_6.setFont(font) self.scenario_label_6.setObjectName("scenario_label_6") self.force_offroad_checkBox = QtWidgets.QCheckBox(self.centralwidget) - self.force_offroad_checkBox.setGeometry(QtCore.QRect(910, 480, 191, 16)) + self.force_offroad_checkBox.setGeometry(QtCore.QRect(1000, 560, 191, 16)) font = QtGui.QFont() font.setPointSize(9) self.force_offroad_checkBox.setFont(font) @@ -242,6 +214,42 @@ class Ui_MainWindow(object): font.setPointSize(11) self.defense_checkBox.setFont(font) self.defense_checkBox.setObjectName("defense_checkBox") + self.e_attack_helos_spinBox = QtWidgets.QSpinBox(self.centralwidget) + self.e_attack_helos_spinBox.setGeometry(QtCore.QRect(70, 330, 51, 31)) + font = QtGui.QFont() + font.setPointSize(12) + self.e_attack_helos_spinBox.setFont(font) + self.e_attack_helos_spinBox.setMinimum(0) + self.e_attack_helos_spinBox.setMaximum(50) + self.e_attack_helos_spinBox.setProperty("value", 2) + self.e_attack_helos_spinBox.setObjectName("e_attack_helos_spinBox") + self.scenario_label_7 = QtWidgets.QLabel(self.centralwidget) + self.scenario_label_7.setGeometry(QtCore.QRect(140, 330, 231, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.scenario_label_7.setFont(font) + self.scenario_label_7.setObjectName("scenario_label_7") + self.scenario_label_8 = QtWidgets.QLabel(self.centralwidget) + self.scenario_label_8.setGeometry(QtCore.QRect(140, 370, 231, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.scenario_label_8.setFont(font) + self.scenario_label_8.setObjectName("scenario_label_8") + self.e_attack_planes_spinBox = QtWidgets.QSpinBox(self.centralwidget) + self.e_attack_planes_spinBox.setGeometry(QtCore.QRect(70, 370, 51, 31)) + font = QtGui.QFont() + font.setPointSize(12) + self.e_attack_planes_spinBox.setFont(font) + self.e_attack_planes_spinBox.setMinimum(0) + self.e_attack_planes_spinBox.setMaximum(50) + self.e_attack_planes_spinBox.setProperty("value", 2) + self.e_attack_planes_spinBox.setObjectName("e_attack_planes_spinBox") + self.zone_sams_checkBox = QtWidgets.QCheckBox(self.centralwidget) + self.zone_sams_checkBox.setGeometry(QtCore.QRect(970, 480, 201, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.zone_sams_checkBox.setFont(font) + self.zone_sams_checkBox.setObjectName("zone_sams_checkBox") self.background_label.raise_() self.scenario_comboBox.raise_() self.scenario_label.raise_() @@ -262,10 +270,6 @@ class Ui_MainWindow(object): self.awacs_checkBox.raise_() self.tankers_checkBox.raise_() self.apcs_spawn_checkBox.raise_() - self.enemy_transport_checkBox.raise_() - self.enemy_attack_helos_checkBox.raise_() - self.enemy_fighters_checkBox.raise_() - self.enemy_attack_planes_checkBox.raise_() self.inf_spawn_spinBox.raise_() self.smoke_checkBox.raise_() self.scenario_label_5.raise_() @@ -276,9 +280,14 @@ class Ui_MainWindow(object): self.scenario_label_6.raise_() self.force_offroad_checkBox.raise_() self.defense_checkBox.raise_() + self.e_attack_helos_spinBox.raise_() + self.scenario_label_7.raise_() + self.scenario_label_8.raise_() + self.e_attack_planes_spinBox.raise_() + self.zone_sams_checkBox.raise_() MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1140, 26)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1209, 26)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) @@ -329,14 +338,6 @@ class Ui_MainWindow(object): self.tankers_checkBox.setText(_translate("MainWindow", "Friendly Tankers")) self.apcs_spawn_checkBox.setStatusTip(_translate("MainWindow", "Friendly/enemy APCs will drop infantry when reaching a new conflict zone.")) self.apcs_spawn_checkBox.setText(_translate("MainWindow", "APCs Spawn Infantry")) - self.enemy_transport_checkBox.setStatusTip(_translate("MainWindow", "Not yet implemented.")) - self.enemy_transport_checkBox.setText(_translate("MainWindow", "Enemy Transport Helicopters")) - self.enemy_attack_helos_checkBox.setStatusTip(_translate("MainWindow", "Not yet implemented.")) - self.enemy_attack_helos_checkBox.setText(_translate("MainWindow", "Enemy Attack Helicopters")) - self.enemy_fighters_checkBox.setStatusTip(_translate("MainWindow", "Not yet implemented.")) - self.enemy_fighters_checkBox.setText(_translate("MainWindow", "Enemy Fighter Planes")) - self.enemy_attack_planes_checkBox.setStatusTip(_translate("MainWindow", "Not yet implemented.")) - self.enemy_attack_planes_checkBox.setText(_translate("MainWindow", "Enemy Ground Attack Planes")) self.inf_spawn_spinBox.setStatusTip(_translate("MainWindow", "This value is multiplied by the number of spawn zones in the mission template.")) self.smoke_checkBox.setStatusTip(_translate("MainWindow", "Not yet implemented.")) self.smoke_checkBox.setText(_translate("MainWindow", "Smoke Active Zone")) @@ -349,6 +350,12 @@ class Ui_MainWindow(object): self.force_offroad_checkBox.setStatusTip(_translate("MainWindow", "May help prevent long travel times or pathfinding issues. Tip: You can change this dynamically from mission triggers.")) self.force_offroad_checkBox.setText(_translate("MainWindow", "Force Offroad")) self.defense_checkBox.setText(_translate("MainWindow", "Defensive Mode")) + self.e_attack_helos_spinBox.setStatusTip(_translate("MainWindow", "This value is multiplied by the number of spawn zones in the mission template.")) + self.scenario_label_7.setText(_translate("MainWindow", "Enemy Attack Helicopters")) + self.scenario_label_8.setText(_translate("MainWindow", "Enemy Attack Planes")) + self.e_attack_planes_spinBox.setStatusTip(_translate("MainWindow", "This value is multiplied by the number of spawn zones in the mission template.")) + self.zone_sams_checkBox.setStatusTip(_translate("MainWindow", "Inactive conflict zones will be protected by SAMs. When a zone is cleared, SAMs at next active zone will be destroyed by a large explosion at zone center. ")) + self.zone_sams_checkBox.setText(_translate("MainWindow", "Inactive Zone SAMs")) self.action_generateMission.setText(_translate("MainWindow", "_generateMission")) self.action_scenarioSelected.setText(_translate("MainWindow", "_scenarioSelected")) self.action_blueforcesSelected.setText(_translate("MainWindow", "_blueforcesSelected")) diff --git a/Generator/MissionGeneratorUI.ui b/Generator/MissionGeneratorUI.ui index be27f4a..8470f3d 100644 --- a/Generator/MissionGeneratorUI.ui +++ b/Generator/MissionGeneratorUI.ui @@ -6,8 +6,8 @@ 0 0 - 1140 - 826 + 1209 + 900 @@ -75,8 +75,8 @@ - 940 - 720 + 1020 + 790 141 41 @@ -183,8 +183,8 @@ p, li { white-space: pre-wrap; } - 10 - 430 + -30 + 490 801 371 @@ -312,8 +312,8 @@ p, li { white-space: pre-wrap; } - 910 - 510 + 1000 + 590 191 16 @@ -339,8 +339,8 @@ p, li { white-space: pre-wrap; } - 910 - 570 + 1000 + 650 191 16 @@ -363,8 +363,8 @@ p, li { white-space: pre-wrap; } - 910 - 320 + 970 + 390 251 31 @@ -384,8 +384,8 @@ p, li { white-space: pre-wrap; } - 910 - 350 + 970 + 420 251 31 @@ -401,12 +401,15 @@ p, li { white-space: pre-wrap; } Friendly AWACS + + true + - 910 - 380 + 970 + 450 251 31 @@ -419,11 +422,14 @@ p, li { white-space: pre-wrap; } Friendly Tankers + + true + - 470 + 500 400 251 31 @@ -441,106 +447,10 @@ p, li { white-space: pre-wrap; } APCs Spawn Infantry - - - false - - - - 70 - 320 - 251 - 31 - - - - - 11 - - - - Not yet implemented. - - - Enemy Transport Helicopters - - - - - true - - - - 70 - 350 - 251 - 31 - - - - - 11 - - - - Not yet implemented. - - - Enemy Attack Helicopters - - - - - false - - - - 70 - 380 - 251 - 31 - - - - - 11 - - - - Not yet implemented. - - - Enemy Fighter Planes - - - - - true - - - - 70 - 410 - 251 - 31 - - - - - 11 - - - - Not yet implemented. - - - Enemy Ground Attack Planes - - - 680 + 710 360 71 31 @@ -567,8 +477,8 @@ p, li { white-space: pre-wrap; } - 910 - 540 + 1000 + 620 191 16 @@ -628,7 +538,7 @@ p, li { white-space: pre-wrap; } - 470 + 500 360 191 31 @@ -646,8 +556,8 @@ p, li { white-space: pre-wrap; } - 790 - 630 + 870 + 700 291 31 @@ -659,8 +569,8 @@ p, li { white-space: pre-wrap; } - 650 - 630 + 750 + 700 111 31 @@ -677,7 +587,7 @@ p, li { white-space: pre-wrap; } - 470 + 500 320 141 31 @@ -695,8 +605,8 @@ p, li { white-space: pre-wrap; } - 910 - 480 + 1000 + 560 191 16 @@ -737,6 +647,117 @@ p, li { white-space: pre-wrap; } Defensive Mode + + + + 70 + 330 + 51 + 31 + + + + + 12 + + + + This value is multiplied by the number of spawn zones in the mission template. + + + 0 + + + 50 + + + 2 + + + + + + 140 + 330 + 231 + 31 + + + + + 11 + + + + Enemy Attack Helicopters + + + + + + 140 + 370 + 231 + 31 + + + + + 11 + + + + Enemy Attack Planes + + + + + + 70 + 370 + 51 + 31 + + + + + 12 + + + + This value is multiplied by the number of spawn zones in the mission template. + + + 0 + + + 50 + + + 2 + + + + + + 970 + 480 + 201 + 31 + + + + + 11 + + + + Inactive conflict zones will be protected by SAMs. When a zone is cleared, SAMs at next active zone will be destroyed by a large explosion at zone center. + + + Inactive Zone SAMs + + background_label scenario_comboBox scenario_label @@ -757,10 +778,6 @@ p, li { white-space: pre-wrap; } awacs_checkBox tankers_checkBox apcs_spawn_checkBox - enemy_transport_checkBox - enemy_attack_helos_checkBox - enemy_fighters_checkBox - enemy_attack_planes_checkBox inf_spawn_spinBox smoke_checkBox scenario_label_5 @@ -771,13 +788,18 @@ p, li { white-space: pre-wrap; } scenario_label_6 force_offroad_checkBox defense_checkBox + e_attack_helos_spinBox + scenario_label_7 + scenario_label_8 + e_attack_planes_spinBox + zone_sams_checkBox 0 0 - 1140 + 1209 26 diff --git a/Generator/RotorOpsMission.py b/Generator/RotorOpsMission.py index 937c7f5..137f126 100644 --- a/Generator/RotorOpsMission.py +++ b/Generator/RotorOpsMission.py @@ -142,12 +142,36 @@ class RotorOpsMission: if red_forces: self.addGroundGroups(red_zones[zone_name], self.m.country('Russia'), red_forces, options["red_quantity"]) + if options["zone_protect_sams"]: + for zone_name in red_zones: + self.m.vehicle_group( + self.m.country('Russia'), + zone_name + " Protection SAM", + random.choice(RotorOpsUnits.e_zone_sams), + red_zones[zone_name].position, + heading=random.randint(0, 359), + group_size=6, + formation=dcs.unitgroup.VehicleGroup.Formation.Star + ) + #Add blue ground units for zone_name in blue_zones: if blue_forces: self.addGroundGroups(blue_zones[zone_name], self.m.country('USA'), blue_forces, options["blue_quantity"]) + if options["zone_protect_sams"]: + for zone_name in blue_zones: + self.m.vehicle_group( + self.m.country('USA'), + zone_name + " Protection SAM", + random.choice(RotorOpsUnits.e_zone_sams), + blue_zones[zone_name].position, + heading=random.randint(0, 359), + group_size=6, + formation=dcs.unitgroup.VehicleGroup.Formation.Star + ) + #Add player slots if options["slots"] == "Multiple Slots": self.addMultiplayerHelos() @@ -156,6 +180,7 @@ class RotorOpsMission: if helicopter == options["slots"]: self.addSinglePlayerHelos(dcs.helicopters.helicopter_map[helicopter]) + #Add AI Flights self.addFlights(options) #Set the Editor Map View @@ -189,6 +214,7 @@ class RotorOpsMission: formation=dcs.unitgroup.VehicleGroup.Formation.Scattered, ) + def getCoalitionAirports(self, side: str): coalition_airports = [] for airport_name in self.m.terrain.airports: @@ -197,6 +223,14 @@ class RotorOpsMission: coalition_airports.append(airport_name) return coalition_airports + def getParking(self, airport, aircraft): + slot = airport.free_parking_slot(aircraft) + if slot: + return airport + else: + print("No parking available for " + aircraft.id + " at " + airport.name) + return None + def addSinglePlayerHelos(self, helotype): friendly_airports = self.getCoalitionAirports("blue") @@ -211,7 +245,7 @@ class RotorOpsMission: for airport_name in friendly_airports: for helotype in RotorOpsUnits.client_helos: fg = self.m.flight_group_from_airport(self.m.country('USA'), airport_name + " " + helotype.id, helotype, - self.m.terrain.airports[airport_name], group_size=1) + self.getParking(self.m.terrain.airports[airport_name], helotype), group_size=1) fg.units[0].set_client() @@ -239,6 +273,8 @@ class RotorOpsMission: int(friendly_airport.position.x), int(friendly_airport.position.y - 100 * 1000), int(friendly_airport.position.x - 100 * 1000), int(friendly_airport.position.y)) + + if options["f_awacs"]: awacs_name = "AWACS" awacs_freq = 266 @@ -247,13 +283,20 @@ class RotorOpsMission: usa, awacs_name, plane_type=dcs.planes.E_3A, - airport=None, + airport=self.getParking(friendly_airport, dcs.planes.E_3A), position=pos, race_distance=race_dist, heading=heading, altitude=random.randrange(4000, 5500, 100), frequency=awacs_freq) - awacs_escort = self.m.escort_flight(usa, "AWACS Escort", dcs.countries.USA.Plane.F_15C, None, awacs, group_size=2) + awacs_escort = self.m.escort_flight( + usa, "AWACS Escort", + dcs.countries.USA.Plane.F_15C, + airport=self.getParking(friendly_airport, dcs.countries.USA.Plane.F_15C), + group_to_escort=awacs, + group_size=2) awacs_escort.load_loadout("Combat Air Patrol") #not working for f-15 + + #add text to mission briefing with radio freq briefing = self.m.description_text() + "\n\n" + awacs_name + " " + str(awacs_freq) + ".00 " + "\n" self.m.set_description_text(briefing) @@ -269,21 +312,30 @@ class RotorOpsMission: usa, t1_name, dcs.planes.KC130, - airport=None, + airport=self.getParking(friendly_airport, dcs.planes.KC130), position=pos, - race_distance=race_dist, heading=heading, - altitude=random.randrange(4000, 5500, 100), speed=750, frequency=t1_freq, tacanchannel=t1_tac) + race_distance=race_dist, + heading=heading, + altitude=random.randrange(4000, 5500, 100), + start_type=dcs.mission.StartType.Warm, + speed=750, + frequency=t1_freq, + tacanchannel=t1_tac) pos, heading, race_dist = self.TrainingScenario.random_orbit(orbit_rect) refuel_rod = self.m.refuel_flight( usa, t2_name, dcs.planes.KC_135, - airport=None, + airport=self.getParking(friendly_airport, dcs.planes.KC_135), position=pos, race_distance=race_dist, heading=heading, - altitude=random.randrange(4000, 5500, 100), frequency=t2_freq, tacanchannel=t2_tac) + altitude=random.randrange(4000, 5500, 100), + start_type=dcs.mission.StartType.Warm, + frequency=t2_freq, + tacanchannel=t2_tac) + #add text to mission briefing briefing = self.m.description_text() + "\n\n" + t1_name + " " + str(t1_freq) + ".00 " + t1_tac + "\n" + t2_name + " " + str(t2_freq) + ".00 " + t2_tac + "\n" self.m.set_description_text(briefing) @@ -377,20 +429,42 @@ class RotorOpsMission: self.m.triggerrules.triggers.append(mytrig) #Add all zone-based triggers - for index, c_zone in enumerate(self.conflict_zones): + for index, zone_name in enumerate(self.conflict_zones): - z_active_trig = dcs.triggers.TriggerOnce(comment= c_zone + " Active") + z_active_trig = dcs.triggers.TriggerOnce(comment= zone_name + " Active") z_active_trig.rules.append(dcs.condition.FlagEquals(game_flag, index + 1)) z_active_trig.actions.append(dcs.action.DoScript(dcs.action.String("--Add any action you want here!"))) + #Smoke action not working + # if options["smoke_zone"]: + # z_active_trig.actions.append(dcs.action.Smoke(zone=zone_name, density=1, preset=1)) + # if index > 0: + # previous_zone = list(self.conflict_zones)[index - 1] + # z_active_trig.actions.append(dcs.action.Smoke(zone=previous_zone, density=1, preset=0)) + #Zone protection SAMs + if options["zone_protect_sams"]: + z_active_trig.actions.append(dcs.action.DoScript(dcs.action.String("Group.destroy(Group.getByName('" + zone_name + " Protection SAM'))"))) self.m.triggerrules.triggers.append(z_active_trig) - zone_flag = self.conflict_zones[c_zone].flag - z_weak_trig = dcs.triggers.TriggerOnce(comment= c_zone + " Weak") - z_weak_trig.rules.append(dcs.condition.FlagIsMore(zone_flag, 10)) - z_weak_trig.rules.append(dcs.condition.FlagIsLess(zone_flag, random.randrange(20, 80))) - z_weak_trig.actions.append(dcs.action.DoScript(dcs.action.String("--Add any action you want here!\n\n--Flag value represents the percentage of defending ground units remaining. "))) - if options["e_attack_helos"]: - z_weak_trig.actions.append(dcs.action.DoScript(dcs.action.String("mist.respawnGroup('Enemy Attack Helicopters', true)"))) + #Add attack helos triggers + for index in range(options["e_attack_helos"]): + random_zone_obj = random.choice(list(self.conflict_zones.items())) + zone = random_zone_obj[1] + z_weak_trig = dcs.triggers.TriggerOnce(comment=zone.name + " Attack Helo") + z_weak_trig.rules.append(dcs.condition.FlagIsMore(zone.flag, 1)) + z_weak_trig.rules.append(dcs.condition.FlagIsLess(zone.flag, random.randrange(20, 90))) + z_weak_trig.actions.append(dcs.action.DoScript(dcs.action.String("---Flag value represents the percentage of defending ground units remaining in zone. "))) + z_weak_trig.actions.append(dcs.action.DoScript(dcs.action.String("mist.respawnGroup('Enemy Attack Helicopters', true)"))) + self.m.triggerrules.triggers.append(z_weak_trig) + + #Add attack plane triggers + for index in range(options["e_attack_planes"]): + random_zone_obj = random.choice(list(self.conflict_zones.items())) + zone = random_zone_obj[1] + z_weak_trig = dcs.triggers.TriggerOnce(comment=zone.name + " Attack Plane") + z_weak_trig.rules.append(dcs.condition.FlagIsMore(zone.flag, 1)) + z_weak_trig.rules.append(dcs.condition.FlagIsLess(zone.flag, random.randrange(20, 90))) + z_weak_trig.actions.append(dcs.action.DoScript(dcs.action.String("---Flag value represents the percentage of defending ground units remaining in zone. "))) + z_weak_trig.actions.append(dcs.action.DoScript(dcs.action.String("mist.respawnGroup('Enemy Attack Planes', true)"))) self.m.triggerrules.triggers.append(z_weak_trig) #Add game won/lost triggers diff --git a/Generator/RotorOpsUnits.py b/Generator/RotorOpsUnits.py index 9c79331..837d793 100644 --- a/Generator/RotorOpsUnits.py +++ b/Generator/RotorOpsUnits.py @@ -23,5 +23,8 @@ e_attack_planes = [ #{'type': dcs.planes.Su_34, 'loadout': "APU-8 Vikhr-M*2,Kh-25ML,R-73*2,SPPU-22*2,Mercury LLTV Pod,MPS-410"}, #{'type': dcs.planes.Su_25, 'loadout': "RKB-250*8,R-60M*2"}, {'type': dcs.planes.A_10C, 'loadout': ""} +] +e_zone_sams = [ + dcs.vehicles.AirDefence.Strela_10M3, ] \ No newline at end of file diff --git a/Generator/build command.txt b/Generator/build command.txt new file mode 100644 index 0000000..20fdd10 --- /dev/null +++ b/Generator/build command.txt @@ -0,0 +1,5 @@ +#build UI files +pyuic5 -x MissionGeneratorUI.ui -o MissionGeneratorUI.py + +#build exe +pyinstaller MissionGenerator.spec --distpath ..\ -i='assets\icon.ico' \ No newline at end of file diff --git a/Splash_Damage_2_0.lua b/Splash_Damage_2_0.lua index ea02520..1e2719a 100644 --- a/Splash_Damage_2_0.lua +++ b/Splash_Damage_2_0.lua @@ -438,6 +438,7 @@ end if (script_enable == 1) then gameMsg("SPLASH DAMAGE 2 SCRIPT RUNNING") + env.info("SPLASH DAMAGE 2 SCRIPT RUNNING") timer.scheduleFunction(function() protectedCall(track_wpns) return timer.getTime() + refreshRate