Put manpads in modern faction's infantry squads. And added a setting to disable it.

This commit is contained in:
Khopa 2020-11-29 13:11:49 +01:00
parent 7daefa8ae5
commit 37e23f70d6
40 changed files with 95 additions and 51 deletions

View File

@ -1234,7 +1234,7 @@ def find_unittype(for_task: Task, country_name: str) -> List[Type[UnitType]]:
return [x for x in UNIT_BY_TASK[for_task] if x in FACTIONS[country_name].units]
def find_infantry(country_name: str) -> List[UnitType]:
def find_infantry(country_name: str, allow_manpad: bool = False) -> List[UnitType]:
inf = [
Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS,
Infantry.Paratrooper_AKS,
@ -1253,6 +1253,10 @@ def find_infantry(country_name: str) -> List[UnitType]:
Infantry.Infantry_M1_Garand, Infantry.Infantry_M1_Garand, Infantry.Infantry_M1_Garand,
Infantry.Infantry_Soldier_Insurgents, Infantry.Infantry_Soldier_Insurgents, Infantry.Infantry_Soldier_Insurgents
]
if allow_manpad:
inf.append(AirDefence.SAM_SA_18_Igla_MANPADS)
inf.append(AirDefence.SAM_SA_18_Igla_S_MANPADS)
inf.append(AirDefence.Stinger_MANPADS)
return [x for x in inf if x in FACTIONS[country_name].infantry_units]

View File

@ -26,6 +26,7 @@ class Settings:
multiplier: float = 1.0
generate_marks: bool = True
sams: bool = True # Legacy parameter do not use
manpads: bool = True
cold_start: bool = False # Legacy parameter do not use
version: Optional[str] = None

View File

@ -179,7 +179,7 @@ class GroundConflictGenerator:
else:
faction = self.game.enemy_name
possible_infantry_units = db.find_infantry(faction)
possible_infantry_units = db.find_infantry(faction, allow_manpad=self.game.settings.manpads)
if len(possible_infantry_units) == 0:
return
@ -203,7 +203,6 @@ class GroundConflictGenerator:
heading=forward_heading,
move_formation=PointAction.OffRoad)
def plan_action_for_groups(self, stance, ally_groups, enemy_groups, forward_heading, from_cp, to_cp):
if not self.game.settings.perf_moving_units:
@ -334,7 +333,6 @@ class GroundConflictGenerator:
dcs_group.add_waypoint(retreat_point, PointAction.OnRoad)
dcs_group.add_waypoint(reposition_point, PointAction.OffRoad)
def add_morale_trigger(self, dcs_group, forward_heading):
"""
This add a trigger to manage units fleeing whenever their group is hit hard, or being engaged by CAS
@ -371,7 +369,6 @@ class GroundConflictGenerator:
self.mission.triggerrules.triggers.append(fallback)
def find_retreat_point(self, dcs_group, frontline_heading, distance=RETREAT_DISTANCE):
"""
Find a point to retreat to
@ -438,7 +435,6 @@ class GroundConflictGenerator:
return potential_target.points[0].position
return None
def get_artilery_group_distance_from_frontline(self, group):
"""
For artilery group, decide the distance from frontline with the range of the unit
@ -450,7 +446,6 @@ class GroundConflictGenerator:
rg = DISTANCE_FROM_FRONTLINE[CombatGroupRole.TANK] + 100
return rg
def get_valid_position_for_group(
self,
conflict_position: Point,

View File

@ -151,6 +151,10 @@ class QSettingsWindow(QDialog):
self.enemyCoalitionSkill.currentIndexChanged.connect(self.applySettings)
self.enemyAASkill.currentIndexChanged.connect(self.applySettings)
self.manpads = QCheckBox()
self.manpads.setChecked(self.game.settings.manpads)
self.manpads.toggled.connect(self.applySettings)
self.difficultyLayout.addWidget(QLabel("Player coalition skill"), 0, 0)
self.difficultyLayout.addWidget(self.playerCoalitionSkill, 0, 1, Qt.AlignRight)
self.difficultyLayout.addWidget(QLabel("Enemy skill"), 1, 0)
@ -158,19 +162,22 @@ class QSettingsWindow(QDialog):
self.difficultyLayout.addWidget(QLabel("Enemy AA and vehicles skill"), 2, 0)
self.difficultyLayout.addWidget(self.enemyAASkill, 2, 1, Qt.AlignRight)
self.difficultyLayout.addWidget(QLabel("Manpads"), 3, 0)
self.difficultyLayout.addWidget(self.manpads, 3, 1, Qt.AlignRight)
self.difficultyLabel = QComboBox()
[self.difficultyLabel.addItem(t) for t in CONST.LABELS_OPTIONS]
self.difficultyLabel.setCurrentIndex(CONST.LABELS_OPTIONS.index(self.game.settings.labels))
self.difficultyLabel.currentIndexChanged.connect(self.applySettings)
self.difficultyLayout.addWidget(QLabel("In Game Labels"), 3, 0)
self.difficultyLayout.addWidget(self.difficultyLabel, 3, 1, Qt.AlignRight)
self.difficultyLayout.addWidget(QLabel("In Game Labels"), 4, 0)
self.difficultyLayout.addWidget(self.difficultyLabel, 4, 1, Qt.AlignRight)
self.noNightMission = QCheckBox()
self.noNightMission.setChecked(self.game.settings.night_disabled)
self.noNightMission.toggled.connect(self.applySettings)
self.difficultyLayout.addWidget(QLabel("No night missions"), 4, 0)
self.difficultyLayout.addWidget(self.noNightMission, 4, 1, Qt.AlignRight)
self.difficultyLayout.addWidget(QLabel("No night missions"), 5, 0)
self.difficultyLayout.addWidget(self.noNightMission, 5, 1, Qt.AlignRight)
self.mapVisibiitySelection = QComboBox()
self.mapVisibiitySelection.addItem("All", ForcedOptions.Views.All)
@ -189,14 +196,14 @@ class QSettingsWindow(QDialog):
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyMap:
self.mapVisibiitySelection.setCurrentIndex(4)
self.mapVisibiitySelection.currentIndexChanged.connect(self.applySettings)
self.difficultyLayout.addWidget(QLabel("Map visibility options"), 5, 0)
self.difficultyLayout.addWidget(self.mapVisibiitySelection, 5, 1, Qt.AlignRight)
self.difficultyLayout.addWidget(QLabel("Map visibility options"), 6, 0)
self.difficultyLayout.addWidget(self.mapVisibiitySelection, 6, 1, Qt.AlignRight)
self.ext_views = QCheckBox()
self.ext_views.setChecked(self.game.settings.external_views_allowed)
self.ext_views.toggled.connect(self.applySettings)
self.difficultyLayout.addWidget(QLabel("Allow external views"), 6, 0)
self.difficultyLayout.addWidget(self.ext_views, 6, 1, Qt.AlignRight)
self.difficultyLayout.addWidget(QLabel("Allow external views"), 7, 0)
self.difficultyLayout.addWidget(self.ext_views, 7, 1, Qt.AlignRight)
def initGeneratorLayout(self):
@ -353,6 +360,7 @@ class QSettingsWindow(QDialog):
self.game.settings.player_skill = CONST.SKILL_OPTIONS[self.playerCoalitionSkill.currentIndex()]
self.game.settings.enemy_skill = CONST.SKILL_OPTIONS[self.enemyCoalitionSkill.currentIndex()]
self.game.settings.enemy_vehicle_skill = CONST.SKILL_OPTIONS[self.enemyAASkill.currentIndex()]
self.game.settings.manpads = self.manpads.isChecked()
self.game.settings.labels = CONST.LABELS_OPTIONS[self.difficultyLabel.currentIndex()]
self.game.settings.night_disabled = self.noNightMission.isChecked()
self.game.settings.map_coalition_visibility = self.mapVisibiitySelection.currentData()

View File

@ -29,7 +29,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"HawkGenerator",

View File

@ -54,7 +54,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -29,7 +29,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -35,7 +35,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"HQ7Generator",

View File

@ -35,7 +35,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"RolandGenerator",

View File

@ -45,7 +45,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"RolandGenerator",

View File

@ -30,7 +30,8 @@
],
"infantry_units": [
"Paratrooper_AKS",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA3Generator",

View File

@ -31,7 +31,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"GepardGenerator",

View File

@ -34,7 +34,8 @@
],
"infantry_units": [
"Infantry_M4",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA3Generator",

View File

@ -21,7 +21,8 @@
],
"infantry_units": [
"Infantry_Soldier_Insurgents",
"Soldier_RPG"
"Soldier_RPG",
"SAM_SA_18_Igla_MANPADS"
],
"air_defenses": [
"SA9Generator",

View File

@ -22,7 +22,8 @@
],
"infantry_units": [
"Infantry_Soldier_Insurgents",
"Soldier_RPG"
"Soldier_RPG",
"SAM_SA_18_Igla_MANPADS"
],
"air_defenses": [
"SA9Generator",

View File

@ -40,7 +40,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Insurgents",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"HawkGenerator",

View File

@ -34,7 +34,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"ChaparralGenerator",

View File

@ -28,7 +28,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -29,7 +29,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -27,7 +27,8 @@
],
"artillery_units": [
"SPH_M109_Paladin",
"MLRS_M270"
"MLRS_M270",
"Stinger_MANPADS"
],
"logistics_units": [
"Transport_M818"

View File

@ -31,7 +31,8 @@
],
"infantry_units": [
"Infantry_Soldier_Insurgents",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_MANPADS"
],
"air_defenses": [
"HQ7Generator",

View File

@ -26,7 +26,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -38,7 +38,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA2Generator",

View File

@ -36,7 +36,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"Stinger_MANPADS"
],
"air_defenses": [
"HQ7Generator",

View File

@ -24,7 +24,8 @@
],
"infantry_units": [
"Paratrooper_AKS",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA9Generator",

View File

@ -20,7 +20,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator"

View File

@ -21,7 +21,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator"

View File

@ -42,7 +42,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA2Generator",

View File

@ -46,7 +46,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_MANPADS"
],
"air_defenses": [
"SA8Generator",

View File

@ -45,7 +45,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA8Generator",

View File

@ -26,7 +26,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -46,7 +46,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"ColdWarFlakGenerator",

View File

@ -32,7 +32,8 @@
"infantry_units": [
"Infantry_M4",
"Soldier_M249",
"Paratrooper_AKS"
"Paratrooper_AKS",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -28,7 +28,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"HawkGenerator",

View File

@ -32,7 +32,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -36,7 +36,8 @@
"infantry_units": [
"Paratrooper_AKS",
"Infantry_Soldier_Rus",
"Paratrooper_RPG_16"
"Paratrooper_RPG_16",
"SAM_SA_18_Igla_S_MANPADS"
],
"air_defenses": [
"SA3Generator",

View File

@ -43,7 +43,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -43,7 +43,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -44,7 +44,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"AvengerGenerator",

View File

@ -31,7 +31,8 @@
],
"infantry_units": [
"Infantry_M4",
"Soldier_M249"
"Soldier_M249",
"Stinger_MANPADS"
],
"air_defenses": [
"ChaparralGenerator",