Add special fuel case for C101 #492

This commit is contained in:
walterroach 2020-12-08 18:25:58 -06:00
parent 473cda971a
commit 6296896471
2 changed files with 26 additions and 17 deletions

View File

@ -20,12 +20,15 @@ from dcs.planes import (
B_17G,
B_52H,
Bf_109K_4,
C_101EB,
C_101CC,
FW_190A8,
FW_190D9,
F_14B,
I_16,
JF_17,
Ju_88A4,
PlaneType,
P_47D_30,
P_47D_30bl1,
P_47D_40,
@ -791,14 +794,9 @@ class AircraftConflictGenerator:
joker_fuel=flight.flight_plan.joker_fuel
))
# Special case so Su 33 carrier take off
if unit_type is Su_33:
if flight.flight_type is not CAP:
for unit in group.units:
unit.fuel = Su_33.fuel_max / 2.2
else:
for unit in group.units:
unit.fuel = Su_33.fuel_max * 0.8
# Special case so Su 33 and C101 can take off
if unit_type in [Su_33, C_101EB, C_101CC]:
self.set_reduced_fuel(flight, group, unit_type)
def _generate_at_airport(self, name: str, side: Country,
unit_type: Type[FlyingType], count: int,
@ -1078,6 +1076,20 @@ class AircraftConflictGenerator:
return group
@staticmethod
def set_reduced_fuel(flight: Flight, group: FlyingGroup, unit_type: Type[PlaneType]) -> None:
if unit_type is Su_33:
for unit in group.units:
if flight.flight_type is not CAP:
unit.fuel = Su_33.fuel_max / 2.2
else:
unit.fuel = Su_33.fuel_max * 0.8
elif unit_type in [C_101EB, C_101CC]:
for unit in group.units:
unit.fuel = unit_type.fuel_max * 0.5
else:
raise RuntimeError(f"No reduced fuel case for type {unit_type}")
@staticmethod
def configure_behavior(
group: FlyingGroup,

View File

@ -193,12 +193,9 @@ class TriggersGenerator:
self._set_allegiances(player_coalition, enemy_coalition)
self._gen_markers()
self._generate_capture_triggers(player_coalition, enemy_coalition)
print("Test")
@classmethod
def get_capture_zone_flag(cls):
flag = cls.capture_zone_flag
cls.capture_zone_flag += 1
return flag