mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Wrap the pydcs FlyingType in our own AircraftType.
This is an attempt to remove a lot of our supposedly unnecessary error handling. Every aircraft should have a price, a description, a name, etc; and none of those should require carrying around the faction's country as context. This moves all the data for aircraft into yaml files (only one converted here as an example). Most of the "extended unit info" isn't actually being read yet. To replace the renaming of units based on the county, we instead generate multiple types of each unit when necessary. The CF-18 is just as much a first-class type as the F/A-18 is. This doesn't work in its current state because it does break all the existing names for aircraft that are used in the faction and squadron files, and we no longer let those errors go as a warning. It will be an annoying one time switch, but it allows us to define the names that get used in these files instead of being sensitive to changes as they happen in pydcs, and allows faction designers to specifically choose, for example, the Su-22 instead of the Su-17. One thing not handled by this is aircraft task capability. This is because the lists in ai_flight_planner_db.py are a priority list, and to move it out to a yaml file we'd need to assign a weight to it that would be used to stack rank each aircraft. That's doable, but it makes it much more difficult to see the ordering of aircraft at a glance, and much more annoying to move aircraft around in the priority list. I don't think this is worth doing, and the priority lists will remain in their own separate lists. This includes the converted I used to convert all the old unit info and factions to the new format. This doesn't need to live long, but we may want to reuse it in the future so we want it in the version history.
This commit is contained in:
87
game/db.py
87
game/db.py
@@ -133,7 +133,7 @@ from dcs.ships import (
|
||||
from dcs.terrain.terrain import Airport
|
||||
from dcs.unit import Ship, Unit, Vehicle
|
||||
from dcs.unitgroup import ShipGroup, StaticGroup
|
||||
from dcs.unittype import FlyingType, UnitType, VehicleType
|
||||
from dcs.unittype import UnitType, VehicleType
|
||||
from dcs.vehicles import (
|
||||
AirDefence,
|
||||
Armor,
|
||||
@@ -803,44 +803,6 @@ REWARDS = {
|
||||
"derrick": 8,
|
||||
}
|
||||
|
||||
CARRIER_CAPABLE = [
|
||||
FA_18C_hornet,
|
||||
F_14A_135_GR,
|
||||
F_14B,
|
||||
AV8BNA,
|
||||
Su_33,
|
||||
A_4E_C,
|
||||
S_3B,
|
||||
S_3B_Tanker,
|
||||
E_2C,
|
||||
UH_1H,
|
||||
Mi_8MT,
|
||||
Ka_50,
|
||||
AH_1W,
|
||||
OH_58D,
|
||||
UH_60A,
|
||||
SH_60B,
|
||||
SA342L,
|
||||
SA342M,
|
||||
SA342Minigun,
|
||||
SA342Mistral,
|
||||
]
|
||||
|
||||
LHA_CAPABLE = [
|
||||
AV8BNA,
|
||||
UH_1H,
|
||||
Mi_8MT,
|
||||
Ka_50,
|
||||
AH_1W,
|
||||
OH_58D,
|
||||
UH_60A,
|
||||
SH_60B,
|
||||
SA342L,
|
||||
SA342M,
|
||||
SA342Minigun,
|
||||
SA342Mistral,
|
||||
]
|
||||
|
||||
"""
|
||||
---------- END OF CONFIGURATION SECTION
|
||||
"""
|
||||
@@ -938,7 +900,9 @@ def unit_type_name_2(unit_type) -> str:
|
||||
return unit_type.name and unit_type.name or unit_type.id
|
||||
|
||||
|
||||
def unit_get_expanded_info(country_name: str, unit_type, request_type: str) -> str:
|
||||
def unit_get_expanded_info(
|
||||
country_name: str, unit_type: Type[UnitType], request_type: str
|
||||
) -> str:
|
||||
original_name = unit_type.name and unit_type.name or unit_type.id
|
||||
default_value = None
|
||||
faction_value = None
|
||||
@@ -980,13 +944,6 @@ def unit_type_from_name(name: str) -> Optional[Type[UnitType]]:
|
||||
return None
|
||||
|
||||
|
||||
def flying_type_from_name(name: str) -> Optional[Type[FlyingType]]:
|
||||
unit_type = plane_map.get(name)
|
||||
if unit_type is not None:
|
||||
return unit_type
|
||||
return helicopter_map.get(name)
|
||||
|
||||
|
||||
def unit_type_of(unit: Unit) -> UnitType:
|
||||
if isinstance(unit, Vehicle):
|
||||
return vehicle_map[unit.type]
|
||||
@@ -1013,39 +970,3 @@ F_16C_50.Liveries = DefaultLiveries
|
||||
P_51D_30_NA.Liveries = DefaultLiveries
|
||||
Ju_88A4.Liveries = DefaultLiveries
|
||||
B_17G.Liveries = DefaultLiveries
|
||||
|
||||
# List of airframes that rely on their gun as a primary weapon. We confiscate bullets
|
||||
# from most AI air-to-ground missions since they aren't smart enough to RTB when they're
|
||||
# out of everything other than bullets (DCS does not have an all-but-gun winchester
|
||||
# option) and we don't want to be attacking fully functional Tors with a Vulcan.
|
||||
#
|
||||
# These airframes are the exceptions. They probably should be using their gun regardless
|
||||
# of the mission type.
|
||||
GUN_RELIANT_AIRFRAMES: List[Type[FlyingType]] = [
|
||||
AH_1W,
|
||||
AH_64A,
|
||||
AH_64D,
|
||||
A_10A,
|
||||
A_10C,
|
||||
A_10C_2,
|
||||
A_20G,
|
||||
Bf_109K_4,
|
||||
FW_190A8,
|
||||
FW_190D9,
|
||||
F_86F_Sabre,
|
||||
Ju_88A4,
|
||||
Ka_50,
|
||||
MiG_15bis,
|
||||
MiG_19P,
|
||||
Mi_24V,
|
||||
Mi_28N,
|
||||
P_47D_30,
|
||||
P_47D_30bl1,
|
||||
P_47D_40,
|
||||
P_51D,
|
||||
P_51D_30_NA,
|
||||
SpitfireLFMkIX,
|
||||
SpitfireLFMkIXCW,
|
||||
Su_25,
|
||||
Su_25T,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user