mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix client/player detection.
Client needs to be used if there are other player slots in *any* flight, not just the same group. Fixes https://github.com/Khopa/dcs_liberation/issues/297
This commit is contained in:
parent
eff9c77c9a
commit
dde74af6b5
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
## Fixes :
|
## Fixes :
|
||||||
* **[Campaign generator]** Ship group and offshore buildings should not be generated on land anymore
|
* **[Campaign generator]** Ship group and offshore buildings should not be generated on land anymore
|
||||||
|
* **[Mission Generator]** Fixed player/client confusion when a flight had only one player slot.
|
||||||
* **[UI]** Missing TER weapons in custom payload now selectable.
|
* **[UI]** Missing TER weapons in custom payload now selectable.
|
||||||
|
|
||||||
# 2.1.5
|
# 2.1.5
|
||||||
|
|||||||
@ -4,7 +4,8 @@ import logging
|
|||||||
import random
|
import random
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Dict, List, Optional, Type, Union
|
from functools import cached_property
|
||||||
|
from typing import Dict, List, Optional, Type, Union, TYPE_CHECKING
|
||||||
|
|
||||||
from dcs import helicopters
|
from dcs import helicopters
|
||||||
from dcs.action import AITaskPush, ActivateGroup
|
from dcs.action import AITaskPush, ActivateGroup
|
||||||
@ -90,6 +91,9 @@ from .flights.traveltime import TotEstimator
|
|||||||
from .naming import namegen
|
from .naming import namegen
|
||||||
from .runways import RunwayAssigner
|
from .runways import RunwayAssigner
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from game import Game
|
||||||
|
|
||||||
WARM_START_HELI_AIRSPEED = 120
|
WARM_START_HELI_AIRSPEED = 120
|
||||||
WARM_START_HELI_ALT = 500
|
WARM_START_HELI_ALT = 500
|
||||||
WARM_START_ALTITUDE = 3000
|
WARM_START_ALTITUDE = 3000
|
||||||
@ -551,7 +555,7 @@ AIRCRAFT_DATA["P-47D-30"] = AIRCRAFT_DATA["P-51D"]
|
|||||||
|
|
||||||
class AircraftConflictGenerator:
|
class AircraftConflictGenerator:
|
||||||
def __init__(self, mission: Mission, conflict: Conflict, settings: Settings,
|
def __init__(self, mission: Mission, conflict: Conflict, settings: Settings,
|
||||||
game, radio_registry: RadioRegistry):
|
game: Game, radio_registry: RadioRegistry):
|
||||||
self.m = mission
|
self.m = mission
|
||||||
self.game = game
|
self.game = game
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
@ -559,6 +563,21 @@ class AircraftConflictGenerator:
|
|||||||
self.radio_registry = radio_registry
|
self.radio_registry = radio_registry
|
||||||
self.flights: List[FlightData] = []
|
self.flights: List[FlightData] = []
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def use_client(self) -> bool:
|
||||||
|
"""True if Client should be used instead of Player."""
|
||||||
|
blue_clients = self.client_slots_in_ato(self.game.blue_ato)
|
||||||
|
red_clients = self.client_slots_in_ato(self.game.red_ato)
|
||||||
|
return blue_clients + red_clients > 1
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def client_slots_in_ato(ato: AirTaskingOrder) -> int:
|
||||||
|
total = 0
|
||||||
|
for package in ato.packages:
|
||||||
|
for flight in package.flights:
|
||||||
|
total += flight.client_count
|
||||||
|
return total
|
||||||
|
|
||||||
def get_intra_flight_channel(self, airframe: UnitType) -> RadioFrequency:
|
def get_intra_flight_channel(self, airframe: UnitType) -> RadioFrequency:
|
||||||
"""Allocates an intra-flight channel to a group.
|
"""Allocates an intra-flight channel to a group.
|
||||||
|
|
||||||
@ -608,13 +627,12 @@ class AircraftConflictGenerator:
|
|||||||
for unit_instance in group.units:
|
for unit_instance in group.units:
|
||||||
unit_instance.livery_id = db.PLANE_LIVERY_OVERRIDES[unit_type]
|
unit_instance.livery_id = db.PLANE_LIVERY_OVERRIDES[unit_type]
|
||||||
|
|
||||||
single_client = flight.client_count == 1
|
|
||||||
for idx in range(0, min(len(group.units), flight.client_count)):
|
for idx in range(0, min(len(group.units), flight.client_count)):
|
||||||
unit = group.units[idx]
|
unit = group.units[idx]
|
||||||
if single_client:
|
if self.use_client:
|
||||||
unit.set_player()
|
|
||||||
else:
|
|
||||||
unit.set_client()
|
unit.set_client()
|
||||||
|
else:
|
||||||
|
unit.set_player()
|
||||||
|
|
||||||
# Do not generate player group with late activation.
|
# Do not generate player group with late activation.
|
||||||
if group.late_activation:
|
if group.late_activation:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user