Add hit points to unit yamls.

This PR:

- Introduces a new member of UnitType, hit_points, which is an abstract
representation of the durability of a unit, and loads it in from the
YAML files in the various subclasses (Ship, Ground etc).
- Adds scripts for populating/updating the unit YAML files with hit
point data from DCS. This script also gets the data for static objects,
but I'll leave the plugging in of static object data into Liberation for
another PR.
- Updates the unit YAML files by running the above scripts.

I did toy with the idea of adding this data to the unit definitions in
pydcs via an export from DCS, but it would be a more involved change,
since the current pydcs export script runs in the Hooks Lua environment
in DCS and AFAICT the hit points (via Unit.getLife()) is run in the
mission scripting environment.
This commit is contained in:
zhexu14 2024-01-04 19:49:33 +11:00 committed by GitHub
parent 5b858886c0
commit 5af4e56f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
384 changed files with 616 additions and 38 deletions

View File

@ -517,6 +517,7 @@ class AircraftType(UnitType[Type[FlyingType]]):
LaserCodeConfig.from_yaml(d) for d in data.get("laser_codes", []) LaserCodeConfig.from_yaml(d) for d in data.get("laser_codes", [])
], ],
use_f15e_waypoint_names=data.get("use_f15e_waypoint_names", False), use_f15e_waypoint_names=data.get("use_f15e_waypoint_names", False),
hit_points=data.get("hit_points", 1),
) )
def __hash__(self) -> int: def __hash__(self) -> int:

View File

@ -133,4 +133,5 @@ class GroundUnitType(UnitType[Type[VehicleType]]):
data.get("skynet_properties", {}) data.get("skynet_properties", {})
), ),
reversed_heading=data.get("reversed_heading", False), reversed_heading=data.get("reversed_heading", False),
hit_points=data.get("hit_points", 1),
) )

View File

@ -79,4 +79,5 @@ class ShipUnitType(UnitType[Type[ShipType]]):
manufacturer=data.get("manufacturer", "No data."), manufacturer=data.get("manufacturer", "No data."),
role=data.get("role", "No data."), role=data.get("role", "No data."),
price=data["price"], price=data["price"],
hit_points=data.get("hit_points", 1),
) )

View File

@ -27,6 +27,7 @@ class UnitType(ABC, Generic[DcsUnitTypeT]):
role: str role: str
price: int price: int
unit_class: UnitClass unit_class: UnitClass
hit_points: int
_loaded: ClassVar[bool] = False _loaded: ClassVar[bool] = False

View File

@ -20,3 +20,4 @@ tasks:
BAI: 680 BAI: 680
CAS: 680 CAS: 680
OCA/Aircraft: 680 OCA/Aircraft: 680
hit_points: 32

View File

@ -30,3 +30,4 @@ tasks:
OCA/Aircraft: 820 OCA/Aircraft: 820
OCA/Runway: 380 OCA/Runway: 380
Strike: 380 Strike: 380
hit_points: 32

View File

@ -34,3 +34,4 @@ tasks:
OCA/Aircraft: 830 OCA/Aircraft: 830
OCA/Runway: 390 OCA/Runway: 390
Strike: 390 Strike: 390
hit_points: 32

View File

@ -24,3 +24,4 @@ tasks:
OCA/Aircraft: 160 OCA/Aircraft: 160
OCA/Runway: 140 OCA/Runway: 140
Strike: 140 Strike: 140
hit_points: 18

View File

@ -8,3 +8,4 @@ variants:
A-50: null A-50: null
tasks: tasks:
AEW&C: 10 AEW&C: 10
hit_points: 60

View File

@ -23,3 +23,4 @@ tasks:
BAI: 480 BAI: 480
CAS: 480 CAS: 480
OCA/Aircraft: 480 OCA/Aircraft: 480
hit_points: 14

View File

@ -24,3 +24,4 @@ tasks:
BAI: 490 BAI: 490
CAS: 490 CAS: 490
OCA/Aircraft: 490 OCA/Aircraft: 490
hit_points: 14

View File

@ -25,3 +25,4 @@ tasks:
BAI: 500 BAI: 500
CAS: 500 CAS: 500
OCA/Aircraft: 500 OCA/Aircraft: 500
hit_points: 14

View File

@ -42,3 +42,4 @@ tasks:
OCA/Aircraft: 510 OCA/Aircraft: 510
default_overrides: default_overrides:
FCR_RFI_removed: false FCR_RFI_removed: false
hit_points: 20

View File

@ -43,3 +43,4 @@ tasks:
OCA/Aircraft: 620 OCA/Aircraft: 620
OCA/Runway: 620 OCA/Runway: 620
Strike: 630 Strike: 630
hit_points: 18

View File

@ -63,3 +63,4 @@ tasks:
SEAD: 70 SEAD: 70
SEAD Escort: 70 SEAD Escort: 70
Strike: 590 Strike: 590
hit_points: 18

View File

@ -5,3 +5,4 @@ variants:
An-26B: null An-26B: null
tasks: tasks:
Transport: 110 Transport: 110
hit_points: 45

View File

@ -3,3 +3,4 @@ price: 15
variants: variants:
An-30M: null An-30M: null
tasks: {} tasks: {}
hit_points: 45

View File

@ -23,3 +23,4 @@ variants:
tasks: tasks:
OCA/Runway: 150 OCA/Runway: 150
Strike: 150 Strike: 150
hit_points: 18

View File

@ -23,3 +23,4 @@ tasks:
OCA/Aircraft: 670 OCA/Aircraft: 670
OCA/Runway: 670 OCA/Runway: 670
Strike: 700 Strike: 700
hit_points: 60

View File

@ -17,3 +17,4 @@ tasks:
DEAD: 210 DEAD: 210
OCA/Runway: 660 OCA/Runway: 660
Strike: 690 Strike: 690
hit_points: 60

View File

@ -34,3 +34,4 @@ tasks:
OCA/Runway: 20 OCA/Runway: 20
Strike: 20 Strike: 20
TARCAP: 60 TARCAP: 60
hit_points: 18

View File

@ -30,3 +30,4 @@ tasks:
OCA/Runway: 170 OCA/Runway: 170
Strike: 170 Strike: 170
TARCAP: 130 TARCAP: 130
hit_points: 18

View File

@ -5,3 +5,4 @@ variants:
C-130: null C-130: null
tasks: tasks:
Transport: 130 Transport: 130
hit_points: 45

View File

@ -5,3 +5,4 @@ variants:
C-17A: null C-17A: null
tasks: tasks:
Transport: 150 Transport: 150
hit_points: 45

View File

@ -13,3 +13,4 @@ variants:
C-47 Dakota: null C-47 Dakota: null
tasks: tasks:
Transport: 90 Transport: 90
hit_points: 18

View File

@ -10,3 +10,4 @@ variants:
tasks: tasks:
Air Assault: 90 Air Assault: 90
Transport: 70 Transport: 70
hit_points: 20

View File

@ -10,3 +10,4 @@ variants:
tasks: tasks:
Air Assault: 100 Air Assault: 100
Transport: 80 Transport: 80
hit_points: 20

View File

@ -16,3 +16,4 @@ variants:
E-2D Advanced Hawkeye: {} E-2D Advanced Hawkeye: {}
tasks: tasks:
AEW&C: 20 AEW&C: 20
hit_points: 25

View File

@ -8,3 +8,4 @@ variants:
E-3A: null E-3A: null
tasks: tasks:
AEW&C: 30 AEW&C: 30
hit_points: 60

View File

@ -20,3 +20,4 @@ variants:
tasks: tasks:
Strike: 710 Strike: 710
has_built_in_target_pod: true has_built_in_target_pod: true
hit_points: 20

View File

@ -59,3 +59,4 @@ tasks:
SEAD Escort: 90 SEAD Escort: 90
Strike: 550 Strike: 550
TARCAP: 520 TARCAP: 520
hit_points: 20

View File

@ -59,3 +59,4 @@ tasks:
SEAD Escort: 100 SEAD Escort: 100
Strike: 560 Strike: 560
TARCAP: 530 TARCAP: 530
hit_points: 20

View File

@ -18,3 +18,4 @@ tasks:
Fighter sweep: 540 Fighter sweep: 540
Intercept: 540 Intercept: 540
TARCAP: 540 TARCAP: 540
hit_points: 20

View File

@ -25,3 +25,4 @@ tasks:
Strike: 640 Strike: 640
TARCAP: 240 TARCAP: 240
has_built_in_target_pod: true has_built_in_target_pod: true
hit_points: 20

View File

@ -51,3 +51,4 @@ laser_codes:
- property: - property:
id: Sta8LaserCode id: Sta8LaserCode
digits: 3 digits: 3
hit_points: 18

View File

@ -16,3 +16,4 @@ tasks:
OCA/Runway: 570 OCA/Runway: 570
Strike: 570 Strike: 570
TARCAP: 420 TARCAP: 420
hit_points: 14

View File

@ -78,3 +78,4 @@ laser_codes:
digit: 1 digit: 1
- id: LaserCode1 - id: LaserCode1
digit: 0 digit: 0
hit_points: 20

View File

@ -33,3 +33,4 @@ tasks:
SEAD Escort: 120 SEAD Escort: 120
Strike: 400 Strike: 400
TARCAP: 410 TARCAP: 410
hit_points: 20

View File

@ -48,3 +48,4 @@ tasks:
OCA/Runway: 190 OCA/Runway: 190
Strike: 200 Strike: 200
TARCAP: 200 TARCAP: 200
hit_points: 16

View File

@ -26,3 +26,4 @@ tasks:
OCA/Runway: 180 OCA/Runway: 180
Strike: 190 Strike: 190
TARCAP: 150 TARCAP: 150
hit_points: 15

View File

@ -68,3 +68,4 @@ tasks:
SEAD Escort: 160 SEAD Escort: 160
Strike: 600 Strike: 600
TARCAP: 450 TARCAP: 450
hit_points: 20

View File

@ -44,3 +44,4 @@ tasks:
OCA/Runway: 0 OCA/Runway: 0
Strike: 0 Strike: 0
TARCAP: 40 TARCAP: 40
hit_points: 18

View File

@ -33,3 +33,4 @@ tasks:
OCA/Runway: 10 OCA/Runway: 10
Strike: 10 Strike: 10
TARCAP: 50 TARCAP: 50
hit_points: 18

View File

@ -24,3 +24,4 @@ tasks:
OCA/Aircraft: 380 OCA/Aircraft: 380
OCA/Runway: 640 OCA/Runway: 640
Strike: 650 Strike: 650
hit_points: 18

View File

@ -28,3 +28,4 @@ tasks:
Intercept: 0 Intercept: 0
OCA/Aircraft: 60 OCA/Aircraft: 60
TARCAP: 0 TARCAP: 0
hit_points: 15

View File

@ -4,3 +4,4 @@ variants:
IL-76MD: null IL-76MD: null
tasks: tasks:
Transport: 120 Transport: 120
hit_points: 60

View File

@ -9,3 +9,4 @@ variants:
IL-78M: null IL-78M: null
tasks: tasks:
Refueling: 30 Refueling: 30
hit_points: 60

View File

@ -18,3 +18,4 @@ tasks:
Fighter sweep: 500 Fighter sweep: 500
Intercept: 500 Intercept: 500
TARCAP: 500 TARCAP: 500
hit_points: 18

View File

@ -53,3 +53,4 @@ tasks:
SEAD Escort: 180 SEAD Escort: 180
Strike: 580 Strike: 580
TARCAP: 440 TARCAP: 440
hit_points: 18

View File

@ -27,3 +27,4 @@ tasks:
OCA/Aircraft: 150 OCA/Aircraft: 150
OCA/Runway: 130 OCA/Runway: 130
Strike: 130 Strike: 130
hit_points: 18

View File

@ -17,3 +17,4 @@ variants:
KC-135 Stratotanker: {} KC-135 Stratotanker: {}
tasks: tasks:
Refueling: 50 Refueling: 50
hit_points: 60

View File

@ -15,3 +15,4 @@ variants:
KC-130: {} KC-130: {}
tasks: tasks:
Refueling: 10 Refueling: 10
hit_points: 18

View File

@ -17,3 +17,4 @@ variants:
KC-135 Stratotanker MPRS: {} KC-135 Stratotanker MPRS: {}
tasks: tasks:
Refueling: 40 Refueling: 40
hit_points: 18

View File

@ -6,3 +6,4 @@ variants:
KJ-2000: null KJ-2000: null
tasks: tasks:
AEW&C: 0 AEW&C: 0
hit_points: 18

View File

@ -29,3 +29,4 @@ tasks:
CAS: 430 CAS: 430
DEAD: 113 DEAD: 113
OCA/Aircraft: 430 OCA/Aircraft: 430
hit_points: 15

View File

@ -29,3 +29,4 @@ tasks:
CAS: 440 CAS: 440
DEAD: 114 DEAD: 114
OCA/Aircraft: 440 OCA/Aircraft: 440
hit_points: 15

View File

@ -30,3 +30,4 @@ tasks:
OCA/Runway: 160 OCA/Runway: 160
Strike: 160 Strike: 160
TARCAP: 120 TARCAP: 120
hit_points: 15

View File

@ -48,3 +48,4 @@ tasks:
OCA/Runway: 320 OCA/Runway: 320
Strike: 320 Strike: 320
TARCAP: 230 TARCAP: 230
hit_points: 18

View File

@ -26,3 +26,4 @@ tasks:
OCA/Aircraft: 240 OCA/Aircraft: 240
OCA/Runway: 200 OCA/Runway: 200
Strike: 180 Strike: 180
hit_points: 18

View File

@ -5,3 +5,4 @@ tasks:
BAI: 10 BAI: 10
CAS: 10 CAS: 10
OCA/Aircraft: 10 OCA/Aircraft: 10
hit_points: 18

View File

@ -31,3 +31,4 @@ tasks:
BAI: 410 BAI: 410
CAS: 410 CAS: 410
OCA/Aircraft: 410 OCA/Aircraft: 410
hit_points: 20

View File

@ -30,3 +30,4 @@ tasks:
BAI: 400 BAI: 400
CAS: 400 CAS: 400
OCA/Aircraft: 400 OCA/Aircraft: 400
hit_points: 16

View File

@ -7,3 +7,4 @@ variants:
tasks: tasks:
Air Assault: 30 Air Assault: 30
Transport: 0 Transport: 0
hit_points: 30

View File

@ -19,3 +19,4 @@ tasks:
BAI: 420 BAI: 420
CAS: 420 CAS: 420
OCA/Aircraft: 420 OCA/Aircraft: 420
hit_points: 15

View File

@ -21,3 +21,4 @@ tasks:
CAS: 390 CAS: 390
OCA/Aircraft: 390 OCA/Aircraft: 390
Transport: 10 Transport: 10
hit_points: 18

View File

@ -33,3 +33,4 @@ tasks:
OCA/Runway: 210 OCA/Runway: 210
Strike: 210 Strike: 210
TARCAP: 140 TARCAP: 140
hit_points: 15

View File

@ -44,3 +44,4 @@ tasks:
Intercept: 170 Intercept: 170
OCA/Aircraft: 370 OCA/Aircraft: 370
TARCAP: 170 TARCAP: 170
hit_points: 18

View File

@ -39,3 +39,4 @@ tasks:
OCA/Runway: 220 OCA/Runway: 220
Strike: 220 Strike: 220
TARCAP: 350 TARCAP: 350
hit_points: 20

View File

@ -25,3 +25,4 @@ tasks:
Fighter sweep: 360 Fighter sweep: 360
Intercept: 360 Intercept: 360
TARCAP: 360 TARCAP: 360
hit_points: 16

View File

@ -34,3 +34,4 @@ tasks:
Fighter sweep: 390 Fighter sweep: 390
Intercept: 390 Intercept: 390
TARCAP: 390 TARCAP: 390
hit_points: 24

View File

@ -29,3 +29,4 @@ max_range: 500
variants: variants:
MiG-25RBT Foxbat-B: {} MiG-25RBT Foxbat-B: {}
tasks: {} tasks: {}
hit_points: 24

View File

@ -25,3 +25,4 @@ tasks:
SEAD: 10 SEAD: 10
SEAD Escort: 10 SEAD Escort: 10
Strike: 230 Strike: 230
hit_points: 18

View File

@ -40,3 +40,4 @@ tasks:
OCA/Runway: 410 OCA/Runway: 410
Strike: 410 Strike: 410
TARCAP: 370 TARCAP: 370
hit_points: 16

View File

@ -37,3 +37,4 @@ tasks:
OCA/Runway: 420 OCA/Runway: 420
Strike: 420 Strike: 420
TARCAP: 380 TARCAP: 380
hit_points: 16

View File

@ -40,3 +40,4 @@ tasks:
OCA/Runway: 430 OCA/Runway: 430
Strike: 430 Strike: 430
TARCAP: 470 TARCAP: 470
hit_points: 16

View File

@ -24,3 +24,4 @@ tasks:
Fighter sweep: 400 Fighter sweep: 400
Intercept: 400 Intercept: 400
TARCAP: 400 TARCAP: 400
hit_points: 24

View File

@ -21,3 +21,4 @@ tasks:
Fighter sweep: 340 Fighter sweep: 340
Intercept: 340 Intercept: 340
TARCAP: 340 TARCAP: 340
hit_points: 16

View File

@ -25,3 +25,4 @@ tasks:
OCA/Runway: 310 OCA/Runway: 310
Strike: 310 Strike: 310
TARCAP: 330 TARCAP: 330
hit_points: 18

View File

@ -22,3 +22,4 @@ tasks:
OCA/Runway: 300 OCA/Runway: 300
Strike: 300 Strike: 300
TARCAP: 320 TARCAP: 320
hit_points: 18

View File

@ -17,3 +17,4 @@ tasks:
Fighter sweep: 260 Fighter sweep: 260
Intercept: 260 Intercept: 260
TARCAP: 260 TARCAP: 260
hit_points: 18

View File

@ -31,3 +31,4 @@ tasks:
OCA/Runway: 290 OCA/Runway: 290
Strike: 290 Strike: 290
TARCAP: 310 TARCAP: 310
hit_points: 18

View File

@ -32,3 +32,4 @@ tasks:
OCA/Runway: 240 OCA/Runway: 240
Strike: 240 Strike: 240
TARCAP: 250 TARCAP: 250
hit_points: 18

View File

@ -23,3 +23,4 @@ tasks:
OCA/Runway: 280 OCA/Runway: 280
Strike: 280 Strike: 280
TARCAP: 300 TARCAP: 300
hit_points: 18

View File

@ -22,3 +22,4 @@ tasks:
OCA/Runway: 270 OCA/Runway: 270
Strike: 270 Strike: 270
TARCAP: 290 TARCAP: 290
hit_points: 18

View File

@ -27,3 +27,4 @@ tasks:
OCA/Runway: 260 OCA/Runway: 260
Strike: 260 Strike: 260
TARCAP: 280 TARCAP: 280
hit_points: 18

View File

@ -27,3 +27,4 @@ tasks:
OCA/Runway: 250 OCA/Runway: 250
Strike: 250 Strike: 250
TARCAP: 270 TARCAP: 270
hit_points: 18

View File

@ -24,3 +24,4 @@ tasks:
OCA/Runway: 30 OCA/Runway: 30
Strike: 30 Strike: 30
TARCAP: 70 TARCAP: 70
hit_points: 48

View File

@ -24,3 +24,4 @@ tasks:
BAI: 470 BAI: 470
CAS: 470 CAS: 470
OCA/Aircraft: 470 OCA/Aircraft: 470
hit_points: 12

View File

@ -44,3 +44,4 @@ tasks:
OCA/Runway: 80 OCA/Runway: 80
Strike: 80 Strike: 80
TARCAP: 30 TARCAP: 30
hit_points: 24

View File

@ -44,3 +44,4 @@ tasks:
OCA/Runway: 90 OCA/Runway: 90
Strike: 90 Strike: 90
TARCAP: 20 TARCAP: 20
hit_points: 24

View File

@ -44,3 +44,4 @@ tasks:
OCA/Runway: 100 OCA/Runway: 100
Strike: 100 Strike: 100
TARCAP: 10 TARCAP: 10
hit_points: 24

View File

@ -43,3 +43,4 @@ tasks:
OCA/Runway: 70 OCA/Runway: 70
Strike: 70 Strike: 70
TARCAP: 110 TARCAP: 110
hit_points: 18

View File

@ -43,3 +43,4 @@ tasks:
OCA/Runway: 60 OCA/Runway: 60
Strike: 60 Strike: 60
TARCAP: 100 TARCAP: 100
hit_points: 18

View File

@ -5,3 +5,4 @@ tasks:
BAI: 0 BAI: 0
CAS: 0 CAS: 0
OCA/Aircraft: 0 OCA/Aircraft: 0
hit_points: 5

View File

@ -26,3 +26,4 @@ variants:
S-3B Tanker: {} S-3B Tanker: {}
tasks: tasks:
Refueling: 0 Refueling: 0
hit_points: 25

View File

@ -26,3 +26,4 @@ tasks:
OCA/Aircraft: 570 OCA/Aircraft: 570
OCA/Runway: 370 OCA/Runway: 370
Strike: 370 Strike: 370
hit_points: 25

View File

@ -24,3 +24,4 @@ tasks:
BAI: 450 BAI: 450
CAS: 450 CAS: 450
OCA/Aircraft: 450 OCA/Aircraft: 450
hit_points: 18

View File

@ -27,3 +27,4 @@ tasks:
BAI: 460 BAI: 460
CAS: 460 CAS: 460
OCA/Aircraft: 460 OCA/Aircraft: 460
hit_points: 18

View File

@ -6,3 +6,4 @@ variants:
SA342Minigun: null SA342Minigun: null
kneeboard_units: "metric" kneeboard_units: "metric"
tasks: {} tasks: {}
hit_points: 18

View File

@ -21,3 +21,4 @@ variants:
SA 342M Gazelle Mistral: {} SA 342M Gazelle Mistral: {}
kneeboard_units: "metric" kneeboard_units: "metric"
tasks: {} tasks: {}
hit_points: 18

Some files were not shown because too many files have changed in this diff Show More