mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add option to limit squadron sizes and begin full.
Adding temporarily as an option to make sure it's not a terrible idea, but the old mode will probably go away. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1583. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2808.
This commit is contained in:
@@ -125,9 +125,9 @@ class AirWing:
|
||||
def squadron_at_index(self, index: int) -> Squadron:
|
||||
return list(self.iter_squadrons())[index]
|
||||
|
||||
def populate_for_turn_0(self) -> None:
|
||||
def populate_for_turn_0(self, squadrons_start_full: bool) -> None:
|
||||
for squadron in self.iter_squadrons():
|
||||
squadron.populate_for_turn_0()
|
||||
squadron.populate_for_turn_0(squadrons_start_full)
|
||||
|
||||
def end_turn(self) -> None:
|
||||
for squadron in self.iter_squadrons():
|
||||
|
||||
@@ -30,6 +30,7 @@ class Squadron:
|
||||
country: str
|
||||
role: str
|
||||
aircraft: AircraftType
|
||||
max_size: int
|
||||
livery: Optional[str]
|
||||
primary_task: FlightType
|
||||
auto_assignable_mission_types: set[FlightType]
|
||||
@@ -160,10 +161,12 @@ class Squadron:
|
||||
self.current_roster.extend(new_pilots)
|
||||
self.available_pilots.extend(new_pilots)
|
||||
|
||||
def populate_for_turn_0(self) -> None:
|
||||
def populate_for_turn_0(self, squadrons_start_full: bool) -> None:
|
||||
if any(p.status is not PilotStatus.Active for p in self.pilot_pool):
|
||||
raise ValueError("Squadrons can only be created with active pilots.")
|
||||
self._recruit_pilots(self.settings.squadron_pilot_limit)
|
||||
if squadrons_start_full:
|
||||
self.owned_aircraft = self.max_size
|
||||
|
||||
def end_turn(self) -> None:
|
||||
if self.destination is not None:
|
||||
@@ -201,7 +204,7 @@ class Squadron:
|
||||
return [p for p in self.current_roster if p.status != status]
|
||||
|
||||
@property
|
||||
def max_size(self) -> int:
|
||||
def pilot_limit(self) -> int:
|
||||
return self.settings.squadron_pilot_limit
|
||||
|
||||
@property
|
||||
@@ -229,7 +232,7 @@ class Squadron:
|
||||
|
||||
@property
|
||||
def _number_of_unfilled_pilot_slots(self) -> int:
|
||||
return self.max_size - len(self.active_pilots)
|
||||
return self.pilot_limit - len(self.active_pilots)
|
||||
|
||||
@property
|
||||
def number_of_available_pilots(self) -> int:
|
||||
@@ -328,6 +331,12 @@ class Squadron:
|
||||
def expected_size_next_turn(self) -> int:
|
||||
return self.owned_aircraft + self.pending_deliveries
|
||||
|
||||
def has_aircraft_capacity_for(self, n: int) -> bool:
|
||||
if not self.settings.enable_squadron_aircraft_limits:
|
||||
return True
|
||||
remaining = self.max_size - self.owned_aircraft - self.pending_deliveries
|
||||
return remaining >= n
|
||||
|
||||
@property
|
||||
def arrival(self) -> ControlPoint:
|
||||
return self.location if self.destination is None else self.destination
|
||||
@@ -418,6 +427,7 @@ class Squadron:
|
||||
cls,
|
||||
squadron_def: SquadronDef,
|
||||
primary_task: FlightType,
|
||||
max_size: int,
|
||||
base: ControlPoint,
|
||||
coalition: Coalition,
|
||||
game: Game,
|
||||
@@ -429,6 +439,7 @@ class Squadron:
|
||||
squadron_def.country,
|
||||
squadron_def.role,
|
||||
squadron_def.aircraft,
|
||||
max_size,
|
||||
squadron_def.livery,
|
||||
primary_task,
|
||||
squadron_def.auto_assignable_mission_types,
|
||||
|
||||
Reference in New Issue
Block a user