Add gunfighter flag to aircraft data files.

This commit is contained in:
Mike Jones 2021-06-21 18:44:47 +01:00 committed by Dan Albert
parent a75688f89c
commit 08b7aff0d8
22 changed files with 27 additions and 54 deletions

View File

@ -1,51 +0,0 @@
from dcs.planes import (
Bf_109K_4,
C_101CC,
FW_190A8,
FW_190D9,
F_5E_3,
F_86F_Sabre,
I_16,
L_39ZA,
MiG_15bis,
MiG_19P,
MiG_21Bis,
P_47D_30,
P_47D_30bl1,
P_47D_40,
P_51D,
P_51D_30_NA,
SpitfireLFMkIX,
SpitfireLFMkIXCW,
)
from pydcs_extensions.a4ec.a4ec import A_4E_C
"""
This list contains the aircraft that do not use the guns as the last resort weapons, but as a main weapon
They'll RTB when they don't have gun ammo left
"""
GUNFIGHTERS = [
# Cold War
MiG_15bis,
MiG_19P,
MiG_21Bis,
F_86F_Sabre,
A_4E_C,
F_5E_3,
# Trainers
C_101CC,
L_39ZA,
# WW2
P_51D_30_NA,
P_51D,
P_47D_30,
P_47D_30bl1,
P_47D_40,
SpitfireLFMkIXCW,
SpitfireLFMkIX,
Bf_109K_4,
FW_190D9,
FW_190A8,
I_16,
]

View File

@ -110,6 +110,11 @@ class AircraftType(UnitType[FlyingType]):
carrier_capable: bool carrier_capable: bool
lha_capable: bool lha_capable: bool
always_keeps_gun: bool always_keeps_gun: bool
# If true, the aircraft does not use the guns as the last resort weapons, but as a main weapon.
# It'll RTB when it doesn't have gun ammo left.
gunfighter: bool
max_group_size: int max_group_size: int
patrol_altitude: Optional[Distance] patrol_altitude: Optional[Distance]
patrol_speed: Optional[Speed] patrol_speed: Optional[Speed]
@ -231,6 +236,7 @@ class AircraftType(UnitType[FlyingType]):
carrier_capable=data.get("carrier_capable", False), carrier_capable=data.get("carrier_capable", False),
lha_capable=data.get("lha_capable", False), lha_capable=data.get("lha_capable", False),
always_keeps_gun=data.get("always_keeps_gun", False), always_keeps_gun=data.get("always_keeps_gun", False),
gunfighter=data.get("gunfighter", False),
max_group_size=data.get("max_group_size", aircraft.group_size_max), max_group_size=data.get("max_group_size", aircraft.group_size_max),
patrol_altitude=patrol_config.altitude, patrol_altitude=patrol_config.altitude,
patrol_speed=patrol_config.speed, patrol_speed=patrol_config.speed,

View File

@ -66,7 +66,6 @@ from dcs.unitgroup import FlyingGroup, ShipGroup, StaticGroup
from dcs.unittype import FlyingType from dcs.unittype import FlyingType
from game import db from game import db
from game.data.cap_capabilities_db import GUNFIGHTERS
from game.data.weapons import Pylon from game.data.weapons import Pylon
from game.dcs.aircrafttype import AircraftType from game.dcs.aircrafttype import AircraftType
from game.factions.faction import Faction from game.factions.faction import Faction
@ -840,7 +839,7 @@ class AircraftConflictGenerator:
group.task = CAP.name group.task = CAP.name
self._setup_group(group, package, flight, dynamic_runways) self._setup_group(group, package, flight, dynamic_runways)
if flight.unit_type.dcs_unit_type not in GUNFIGHTERS: if not flight.unit_type.gunfighter:
ammo_type = OptRTBOnOutOfAmmo.Values.AAM ammo_type = OptRTBOnOutOfAmmo.Values.AAM
else: else:
ammo_type = OptRTBOnOutOfAmmo.Values.Cannon ammo_type = OptRTBOnOutOfAmmo.Values.Cannon
@ -857,7 +856,7 @@ class AircraftConflictGenerator:
group.task = FighterSweep.name group.task = FighterSweep.name
self._setup_group(group, package, flight, dynamic_runways) self._setup_group(group, package, flight, dynamic_runways)
if flight.unit_type.dcs_unit_type not in GUNFIGHTERS: if not flight.unit_type.gunfighter:
ammo_type = OptRTBOnOutOfAmmo.Values.AAM ammo_type = OptRTBOnOutOfAmmo.Values.AAM
else: else:
ammo_type = OptRTBOnOutOfAmmo.Values.Cannon ammo_type = OptRTBOnOutOfAmmo.Values.Cannon

View File

@ -11,5 +11,6 @@ manufacturer: Douglas
origin: USA origin: USA
price: 7 price: 7
role: Carrier-based Attack/Light Fighter role: Carrier-based Attack/Light Fighter
gunfighter: true
variants: variants:
A-4E Skyhawk: {} A-4E Skyhawk: {}

View File

@ -14,5 +14,6 @@ introduced: 1944
manufacturer: Messerschmitt manufacturer: Messerschmitt
price: 4 price: 4
role: Fighter role: Fighter
gunfighter: true
variants: variants:
"Bf 109 K-4 Kurf\xFCrst": {} "Bf 109 K-4 Kurf\xFCrst": {}

View File

@ -7,5 +7,6 @@ manufacturer: CASA
origin: Spain origin: Spain
price: 8 price: 8
role: Light Attack role: Light Attack
gunfighter: true
variants: variants:
C-101CC Aviojet: {} C-101CC Aviojet: {}

View File

@ -20,5 +20,6 @@ manufacturer: Northrop
origin: USA origin: USA
price: 12 price: 12
role: Light Fighter role: Light Fighter
gunfighter: true
variants: variants:
F-5E Tiger II: {} F-5E Tiger II: {}

View File

@ -11,5 +11,6 @@ manufacturer: North American
origin: USA origin: USA
price: 8 price: 8
role: Fighter role: Fighter
gunfighter: true
variants: variants:
F-86F Sabre: {} F-86F Sabre: {}

View File

@ -25,5 +25,6 @@ manufacturer: Focke-Wulf
origin: Germany origin: Germany
price: 3 price: 3
role: Fighter role: Fighter
gunfighter: true
variants: variants:
Fw 190 A-8 Anton: {} Fw 190 A-8 Anton: {}

View File

@ -14,5 +14,6 @@ manufacturer: Focke-Wulf
origin: Germany origin: Germany
price: 5 price: 5
role: Fighter role: Fighter
gunfighter: true
variants: variants:
Fw 190 D-9 Dora: {} Fw 190 D-9 Dora: {}

View File

@ -13,5 +13,6 @@ manufacturer: Polikarpov
origin: USSR/Russia origin: USSR/Russia
price: 2 price: 2
role: Fighter role: Fighter
gunfighter: true
variants: variants:
I-16 Ishak: {} I-16 Ishak: {}

View File

@ -9,5 +9,6 @@ manufacturer: Aero
origin: Czechoslovakia origin: Czechoslovakia
price: 10 price: 10
role: Light Attack role: Light Attack
gunfighter: true
variants: variants:
L-39ZA Albatros: {} L-39ZA Albatros: {}

View File

@ -15,6 +15,7 @@ manufacturer: Mikoyan-Gurevich
origin: USSR/Russia origin: USSR/Russia
price: 8 price: 8
role: Fighter role: Fighter
gunfighter: true
variants: variants:
MiG-15bis Fagot: {} MiG-15bis Fagot: {}
radios: radios:

View File

@ -14,6 +14,7 @@ manufacturer: Mikoyan-Gurevich
origin: USSR/Russia origin: USSR/Russia
price: 10 price: 10
role: Fighter role: Fighter
gunfighter: true
variants: variants:
J-6A: J-6A:
introduced: 1962 introduced: 1962

View File

@ -11,6 +11,7 @@ manufacturer: Mikoyan-Gurevich
origin: USSR/Russia origin: USSR/Russia
price: 12 price: 12
role: Fighter role: Fighter
gunfighter: true
variants: variants:
J-7B: J-7B:
introduced: 1992 introduced: 1992

View File

@ -19,6 +19,7 @@ manufacturer: Republic
origin: USA origin: USA
price: 5 price: 5
role: Fighter-Bomber role: Fighter-Bomber
gunfighter: true
variants: variants:
P-47D-30 Thunderbolt (Late): {} P-47D-30 Thunderbolt (Late): {}
Thunderbolt Mk.II (Mid): {} Thunderbolt Mk.II (Mid): {}

View File

@ -19,6 +19,7 @@ manufacturer: Republic
origin: USA origin: USA
price: 5 price: 5
role: Fighter-Bomber role: Fighter-Bomber
gunfighter: true
variants: variants:
P-47D-30 Thunderbolt (Early): {} P-47D-30 Thunderbolt (Early): {}
Thunderbolt Mk.II (Early): {} Thunderbolt Mk.II (Early): {}

View File

@ -19,6 +19,7 @@ manufacturer: Republic
origin: USA origin: USA
price: 6 price: 6
role: Fighter-Bomber role: Fighter-Bomber
gunfighter: true
variants: variants:
P-47D-40 Thunderbolt: {} P-47D-40 Thunderbolt: {}
Thunderbolt Mk.II (Late): {} Thunderbolt Mk.II (Late): {}

View File

@ -20,6 +20,7 @@ manufacturer: North American
origin: USA origin: USA
price: 5 price: 5
role: Fighter role: Fighter
gunfighter: true
variants: variants:
Mustang Mk.IV (Late): {} Mustang Mk.IV (Late): {}
P-51D-30-NA Mustang: {} P-51D-30-NA Mustang: {}

View File

@ -20,6 +20,7 @@ manufacturer: North American
origin: USA origin: USA
price: 4 price: 4
role: Fighter role: Fighter
gunfighter: true
variants: variants:
Mustang Mk.IV (Early): {} Mustang Mk.IV (Early): {}
P-51D-25-NA Mustang: {} P-51D-25-NA Mustang: {}

View File

@ -38,5 +38,6 @@ manufacturer: Supermarine
origin: UK origin: UK
price: 3 price: 3
role: Fighter role: Fighter
gunfighter: true
variants: variants:
Spitfire LF Mk IX: {} Spitfire LF Mk IX: {}

View File

@ -38,5 +38,6 @@ manufacturer: Supermarine
origin: UK origin: UK
price: 3 price: 3
role: Fighter role: Fighter
gunfighter: true
variants: variants:
Spitfire LF Mk IX (Clipped Wings): {} Spitfire LF Mk IX (Clipped Wings): {}