mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Cap squadron size, limit replenishment rate.
This caps squadrons to 12 pilots and limits their replenishment rate to 1 pilot per turn. Should probably make those values configurable, but they aren't currently. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1136
This commit is contained in:
@@ -163,8 +163,6 @@ class AircraftAllocator:
|
||||
flight.max_distance
|
||||
)
|
||||
|
||||
# Prefer using squadrons with pilots first
|
||||
best_understaffed: Optional[Tuple[ControlPoint, Squadron]] = None
|
||||
for airfield in airfields_in_range:
|
||||
if not airfield.is_friendly(self.is_player):
|
||||
continue
|
||||
@@ -176,24 +174,14 @@ class AircraftAllocator:
|
||||
continue
|
||||
# Valid location with enough aircraft available. Find a squadron to fit
|
||||
# the role.
|
||||
for squadron in self.air_wing.squadrons_for(aircraft):
|
||||
if task not in squadron.auto_assignable_mission_types:
|
||||
continue
|
||||
if len(squadron.available_pilots) >= flight.num_aircraft:
|
||||
squadrons = self.air_wing.auto_assignable_for_task_with_type(
|
||||
aircraft, task
|
||||
)
|
||||
for squadron in squadrons:
|
||||
if squadron.number_of_available_pilots >= flight.num_aircraft:
|
||||
inventory.remove_aircraft(aircraft, flight.num_aircraft)
|
||||
return airfield, squadron
|
||||
|
||||
# A compatible squadron that doesn't have enough pilots. Remember it
|
||||
# as a fallback in case we find no better choices.
|
||||
if best_understaffed is None:
|
||||
best_understaffed = airfield, squadron
|
||||
|
||||
if best_understaffed is not None:
|
||||
airfield, squadron = best_understaffed
|
||||
self.global_inventory.for_control_point(airfield).remove_aircraft(
|
||||
squadron.aircraft, flight.num_aircraft
|
||||
)
|
||||
return best_understaffed
|
||||
return None
|
||||
|
||||
|
||||
class PackageBuilder:
|
||||
|
||||
Reference in New Issue
Block a user