mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Default start type for player flights (#303)
* Implemented a new option in settings: Default start type for Player flights. * Updated changelog. * Removed unnecessary country parameter. * Restore missing parameter * on_pilot_changed should emit pilots_changed in its finally block, otherwise the start-type isn't updated if you have a single client pilot which you switch to a non-client pilot. Also implemented other changes suggested by @Raffson, such as a more streamlined start_type QComboBox handling and moving the pilots_changed Signal to FlightRosterEditor. * Decouple Signal from QFlighStartType --------- Co-authored-by: Raffson <Raffson@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,10 @@ class FlightRoster(IFlightRoster):
|
||||
def iter_pilots(self) -> Iterator[Pilot | None]:
|
||||
yield from self.pilots
|
||||
|
||||
@property
|
||||
def player_count(self) -> int:
|
||||
return len([p for p in self.pilots if p is not None and p.player])
|
||||
|
||||
def pilot_at(self, idx: int) -> Pilot | None:
|
||||
return self.pilots[idx]
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@ class IFlightRoster(ABC):
|
||||
def max_size(self) -> int:
|
||||
...
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def player_count(self) -> int:
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def resize(self, new_size: int) -> None:
|
||||
...
|
||||
|
||||
@@ -76,6 +76,12 @@ class PackageBuilder:
|
||||
member.assign_tgp_laser_code(
|
||||
self.laser_code_registry.alloc_laser_code()
|
||||
)
|
||||
# If this is a client flight, set the start_type again to match the configured default
|
||||
# https://github.com/dcs-liberation/dcs_liberation/issues/1567
|
||||
if flight.roster is not None and flight.roster.player_count > 0:
|
||||
flight.start_type = (
|
||||
squadron.coalition.game.settings.default_start_type_client
|
||||
)
|
||||
self.package.add_flight(flight)
|
||||
return True
|
||||
|
||||
|
||||
@@ -739,6 +739,14 @@ class Settings:
|
||||
"will not be included in automatically planned OCA packages."
|
||||
),
|
||||
)
|
||||
default_start_type_client: StartType = choices_option(
|
||||
"Default start type for Player flights",
|
||||
page=MISSION_GENERATOR_PAGE,
|
||||
section=GAMEPLAY_SECTION,
|
||||
choices={v.value: v for v in StartType},
|
||||
default=StartType.COLD,
|
||||
detail=("Default start type for flights containing Player/Client slots."),
|
||||
)
|
||||
nevatim_parking_fix: bool = boolean_option(
|
||||
"Force air-starts for aircraft at Nevatim and Ramon Airbase inoperable parking slots",
|
||||
page=MISSION_GENERATOR_PAGE,
|
||||
|
||||
Reference in New Issue
Block a user