mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Possible to spawn manpads on frontline even if infantry squads are disabled.
This commit is contained in:
parent
948c1d0bb0
commit
cdf28700cf
56
game/db.py
56
game/db.py
@ -1234,29 +1234,41 @@ 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]
|
return [x for x in UNIT_BY_TASK[for_task] if x in FACTIONS[country_name].units]
|
||||||
|
|
||||||
|
|
||||||
def find_infantry(country_name: str, allow_manpad: bool = False) -> List[UnitType]:
|
MANPADS: List[VehicleType] = [
|
||||||
inf = [
|
AirDefence.SAM_SA_18_Igla_MANPADS,
|
||||||
Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS,
|
AirDefence.SAM_SA_18_Igla_S_MANPADS,
|
||||||
Infantry.Paratrooper_AKS,
|
AirDefence.Stinger_MANPADS
|
||||||
Infantry.Soldier_RPG,
|
]
|
||||||
Infantry.Infantry_M4, Infantry.Infantry_M4, Infantry.Infantry_M4, Infantry.Infantry_M4, Infantry.Infantry_M4,
|
|
||||||
Infantry.Soldier_M249,
|
INFANTRY: List[VehicleType] = [
|
||||||
Infantry.Soldier_AK, Infantry.Soldier_AK, Infantry.Soldier_AK, Infantry.Soldier_AK, Infantry.Soldier_AK,
|
Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS, Infantry.Paratrooper_AKS,
|
||||||
Infantry.Paratrooper_RPG_16,
|
Infantry.Paratrooper_AKS,
|
||||||
Infantry.Georgian_soldier_with_M4, Infantry.Georgian_soldier_with_M4, Infantry.Georgian_soldier_with_M4,
|
Infantry.Soldier_RPG,
|
||||||
Infantry.Georgian_soldier_with_M4,
|
Infantry.Infantry_M4, Infantry.Infantry_M4, Infantry.Infantry_M4, Infantry.Infantry_M4, Infantry.Infantry_M4,
|
||||||
Infantry.Infantry_Soldier_Rus, Infantry.Infantry_Soldier_Rus, Infantry.Infantry_Soldier_Rus,
|
Infantry.Soldier_M249,
|
||||||
Infantry.Infantry_Soldier_Rus,
|
Infantry.Soldier_AK, Infantry.Soldier_AK, Infantry.Soldier_AK, Infantry.Soldier_AK, Infantry.Soldier_AK,
|
||||||
Infantry.Infantry_SMLE_No_4_Mk_1, Infantry.Infantry_SMLE_No_4_Mk_1, Infantry.Infantry_SMLE_No_4_Mk_1,
|
Infantry.Paratrooper_RPG_16,
|
||||||
Infantry.Infantry_Mauser_98, Infantry.Infantry_Mauser_98, Infantry.Infantry_Mauser_98,
|
Infantry.Georgian_soldier_with_M4, Infantry.Georgian_soldier_with_M4, Infantry.Georgian_soldier_with_M4,
|
||||||
Infantry.Infantry_Mauser_98,
|
Infantry.Georgian_soldier_with_M4,
|
||||||
Infantry.Infantry_M1_Garand, Infantry.Infantry_M1_Garand, Infantry.Infantry_M1_Garand,
|
Infantry.Infantry_Soldier_Rus, Infantry.Infantry_Soldier_Rus, Infantry.Infantry_Soldier_Rus,
|
||||||
Infantry.Infantry_Soldier_Insurgents, Infantry.Infantry_Soldier_Insurgents, Infantry.Infantry_Soldier_Insurgents
|
Infantry.Infantry_Soldier_Rus,
|
||||||
]
|
Infantry.Infantry_SMLE_No_4_Mk_1, Infantry.Infantry_SMLE_No_4_Mk_1, Infantry.Infantry_SMLE_No_4_Mk_1,
|
||||||
|
Infantry.Infantry_Mauser_98, Infantry.Infantry_Mauser_98, Infantry.Infantry_Mauser_98,
|
||||||
|
Infantry.Infantry_Mauser_98,
|
||||||
|
Infantry.Infantry_M1_Garand, Infantry.Infantry_M1_Garand, Infantry.Infantry_M1_Garand,
|
||||||
|
Infantry.Infantry_Soldier_Insurgents, Infantry.Infantry_Soldier_Insurgents, Infantry.Infantry_Soldier_Insurgents
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def find_manpad(country_name: str) -> List[VehicleType]:
|
||||||
|
return [x for x in MANPADS if x in FACTIONS[country_name].infantry_units]
|
||||||
|
|
||||||
|
|
||||||
|
def find_infantry(country_name: str, allow_manpad: bool = False) -> List[VehicleType]:
|
||||||
if allow_manpad:
|
if allow_manpad:
|
||||||
inf.append(AirDefence.SAM_SA_18_Igla_MANPADS)
|
inf = INFANTRY + MANPADS
|
||||||
inf.append(AirDefence.SAM_SA_18_Igla_S_MANPADS)
|
else:
|
||||||
inf.append(AirDefence.Stinger_MANPADS)
|
inf = INFANTRY
|
||||||
return [x for x in inf if x in FACTIONS[country_name].infantry_units]
|
return [x for x in inf if x in FACTIONS[country_name].infantry_units]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
gen/armor.py
21
gen/armor.py
@ -165,10 +165,6 @@ class GroundConflictGenerator:
|
|||||||
|
|
||||||
def gen_infantry_group_for_group(self, group, is_player, side:Country, forward_heading):
|
def gen_infantry_group_for_group(self, group, is_player, side:Country, forward_heading):
|
||||||
|
|
||||||
# Disable infantry unit gen if disabled
|
|
||||||
if not self.game.settings.perf_infantry:
|
|
||||||
return
|
|
||||||
|
|
||||||
infantry_position = group.points[0].position.random_point_within(250, 50)
|
infantry_position = group.points[0].position.random_point_within(250, 50)
|
||||||
|
|
||||||
if side == self.conflict.attackers_country:
|
if side == self.conflict.attackers_country:
|
||||||
@ -181,6 +177,23 @@ class GroundConflictGenerator:
|
|||||||
else:
|
else:
|
||||||
faction = self.game.enemy_name
|
faction = self.game.enemy_name
|
||||||
|
|
||||||
|
# Disable infantry unit gen if disabled
|
||||||
|
if not self.game.settings.perf_infantry:
|
||||||
|
if self.game.settings.manpads:
|
||||||
|
# 50% of armored units protected by manpad
|
||||||
|
if random.choice([True, False]):
|
||||||
|
u = random.choice(db.find_manpad(faction))
|
||||||
|
self.mission.vehicle_group(
|
||||||
|
side,
|
||||||
|
namegen.next_infantry_name(side, cp, u), u,
|
||||||
|
position=infantry_position,
|
||||||
|
group_size=1,
|
||||||
|
heading=forward_heading,
|
||||||
|
move_formation=PointAction.OffRoad)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
possible_infantry_units = db.find_infantry(faction, allow_manpad=self.game.settings.manpads)
|
possible_infantry_units = db.find_infantry(faction, allow_manpad=self.game.settings.manpads)
|
||||||
if len(possible_infantry_units) == 0:
|
if len(possible_infantry_units) == 0:
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user