mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Improved the typing of game.pretense_air
This commit is contained in:
parent
47ee0e5340
commit
064d17aab0
@ -151,7 +151,10 @@ class Game:
|
||||
# Side, control point, mission type
|
||||
self.pretense_ground_supply: dict[int, dict[str, List[str]]] = {1: {}, 2: {}}
|
||||
self.pretense_ground_assault: dict[int, dict[str, List[str]]] = {1: {}, 2: {}}
|
||||
self.pretense_air: dict[int, dict[str, dict[str, List[str]]]] = {1: {}, 2: {}}
|
||||
self.pretense_air: dict[int, dict[str, dict[FlightType, List[str]]]] = {
|
||||
1: {},
|
||||
2: {},
|
||||
}
|
||||
|
||||
self.on_load(game_still_initializing=True)
|
||||
|
||||
|
||||
@ -603,7 +603,7 @@ class PretenseAircraftGenerator:
|
||||
cp: Control point to generate aircraft for.
|
||||
flight: The current flight being generated.
|
||||
"""
|
||||
flight_type = flight.flight_type.name
|
||||
flight_type = flight.flight_type
|
||||
cp_name_trimmed = "".join([i for i in cp.name.lower() if i.isalnum()])
|
||||
|
||||
for side in range(1, 3):
|
||||
|
||||
@ -84,7 +84,7 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
if self.start_type is StartType.IN_FLIGHT:
|
||||
if self.flight.client_count == 0:
|
||||
self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
self.flight.flight_type.name
|
||||
self.flight.flight_type
|
||||
].append(name)
|
||||
group = self._generate_over_departure(name, cp)
|
||||
return group
|
||||
@ -98,7 +98,7 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
)
|
||||
if self.flight.client_count == 0:
|
||||
self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
self.flight.flight_type.name
|
||||
self.flight.flight_type
|
||||
].append(name)
|
||||
return self._generate_at_group(name, carrier_group)
|
||||
elif isinstance(cp, Fob):
|
||||
@ -120,6 +120,10 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
f' spawns" setting is currently disabled.'
|
||||
)
|
||||
if cp.has_helipads and (is_heli or is_vtol):
|
||||
if self.flight.client_count == 0:
|
||||
self.flight.coalition.game.pretense_air[cp_side][
|
||||
cp_name_trimmed
|
||||
][self.flight.flight_type].append(name)
|
||||
pad_group = self._generate_at_cp_helipad(name, cp)
|
||||
if pad_group is not None:
|
||||
return pad_group
|
||||
@ -129,7 +133,7 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
return pad_group
|
||||
if self.flight.client_count == 0:
|
||||
self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
self.flight.flight_type.name
|
||||
self.flight.flight_type
|
||||
].append(name)
|
||||
return self._generate_over_departure(name, cp)
|
||||
elif isinstance(cp, Airfield):
|
||||
@ -150,7 +154,7 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
return pad_group
|
||||
if self.flight.client_count == 0:
|
||||
self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
self.flight.flight_type.name
|
||||
self.flight.flight_type
|
||||
].append(name)
|
||||
return self._generate_at_airfield(name, cp)
|
||||
else:
|
||||
@ -208,7 +212,7 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
self.mission_data.cp_stack[cp] += STACK_SEPARATION
|
||||
|
||||
self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
self.flight.flight_type.name
|
||||
self.flight.flight_type
|
||||
].append(name)
|
||||
group = self.mission.flight_group(
|
||||
country=self.country,
|
||||
|
||||
@ -80,7 +80,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ "'}),\n"
|
||||
)
|
||||
for mission_type in self.game.pretense_air[cp_side][cp_name_trimmed]:
|
||||
if mission_type == FlightType.AIR_ASSAULT.name:
|
||||
if mission_type == FlightType.AIR_ASSAULT:
|
||||
mission_name = "supply.helo"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -110,7 +110,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ "' }),\n"
|
||||
)
|
||||
for mission_type in self.game.pretense_air[cp_side][cp_name_trimmed]:
|
||||
if mission_type == FlightType.SEAD.name:
|
||||
if mission_type == FlightType.SEAD:
|
||||
mission_name = "attack.sead"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -121,7 +121,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=25000, expend=AI.Task.WeaponExpend.ALL}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.CAS.name:
|
||||
elif mission_type == FlightType.CAS:
|
||||
mission_name = "attack.cas"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -132,7 +132,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=15000, expend=AI.Task.WeaponExpend.ONE}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.BAI.name:
|
||||
elif mission_type == FlightType.BAI:
|
||||
mission_name = "attack.bai"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -143,7 +143,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=10000, expend=AI.Task.WeaponExpend.ONE}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.STRIKE.name:
|
||||
elif mission_type == FlightType.STRIKE:
|
||||
mission_name = "attack.strike"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -154,7 +154,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=20000, expend=AI.Task.WeaponExpend.ALL}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.BARCAP.name:
|
||||
elif mission_type == FlightType.BARCAP:
|
||||
mission_name = "patrol.aircraft"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -165,7 +165,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=25000, range=25}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.REFUELING.name:
|
||||
elif mission_type == FlightType.REFUELING:
|
||||
mission_name = "support.tanker"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -191,7 +191,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ tanker_variant
|
||||
+ "'}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.AEWC.name:
|
||||
elif mission_type == FlightType.AEWC:
|
||||
mission_name = "support.awacs"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -364,7 +364,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ "'}),\n"
|
||||
)
|
||||
for mission_type in self.game.pretense_air[cp_side][cp_name_trimmed]:
|
||||
if mission_type == FlightType.AIR_ASSAULT.name:
|
||||
if mission_type == FlightType.AIR_ASSAULT:
|
||||
mission_name = "supply.helo"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -388,7 +388,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ "-sam-blue' }),\n"
|
||||
)
|
||||
for mission_type in self.game.pretense_air[cp_side][cp_name_trimmed]:
|
||||
if mission_type == FlightType.SEAD.name:
|
||||
if mission_type == FlightType.SEAD:
|
||||
mission_name = "attack.sead"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -399,7 +399,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=25000, expend=AI.Task.WeaponExpend.ALL}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.CAS.name:
|
||||
elif mission_type == FlightType.CAS:
|
||||
mission_name = "attack.cas"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -410,7 +410,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=15000, expend=AI.Task.WeaponExpend.ONE}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.BAI.name:
|
||||
elif mission_type == FlightType.BAI:
|
||||
mission_name = "attack.bai"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -421,7 +421,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=10000, expend=AI.Task.WeaponExpend.ONE}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.STRIKE.name:
|
||||
elif mission_type == FlightType.STRIKE:
|
||||
mission_name = "attack.strike"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -432,7 +432,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=20000, expend=AI.Task.WeaponExpend.ALL}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.BARCAP.name:
|
||||
elif mission_type == FlightType.BARCAP:
|
||||
mission_name = "patrol.aircraft"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -443,7 +443,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ air_group
|
||||
+ "', altitude=25000, range=25}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.REFUELING.name:
|
||||
elif mission_type == FlightType.REFUELING:
|
||||
mission_name = "support.tanker"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -470,7 +470,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
+ tanker_variant
|
||||
+ "'}),\n"
|
||||
)
|
||||
elif mission_type == FlightType.AEWC.name:
|
||||
elif mission_type == FlightType.AEWC:
|
||||
mission_name = "support.awacs"
|
||||
for air_group in self.game.pretense_air[cp_side][cp_name_trimmed][
|
||||
mission_type
|
||||
@ -601,7 +601,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
continue
|
||||
cp_name_trimmed = "".join([i for i in cp.name.lower() if i.isalnum()])
|
||||
for mission_type in self.game.pretense_air[cp_side][cp_name_trimmed]:
|
||||
if mission_type == FlightType.PRETENSE_CARGO.name:
|
||||
if mission_type == FlightType.PRETENSE_CARGO:
|
||||
for air_group in self.game.pretense_air[cp_side][
|
||||
cp_name_trimmed
|
||||
][mission_type]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user