mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix unit type comparisons.
When comparing UnitType against a pydcs type, use .dcs_unit_type.
This commit is contained in:
parent
814519248c
commit
30763b5401
@ -840,7 +840,7 @@ class AircraftConflictGenerator:
|
||||
group.task = CAP.name
|
||||
self._setup_group(group, package, flight, dynamic_runways)
|
||||
|
||||
if flight.unit_type not in GUNFIGHTERS:
|
||||
if flight.unit_type.dcs_unit_type not in GUNFIGHTERS:
|
||||
ammo_type = OptRTBOnOutOfAmmo.Values.AAM
|
||||
else:
|
||||
ammo_type = OptRTBOnOutOfAmmo.Values.Cannon
|
||||
@ -857,7 +857,7 @@ class AircraftConflictGenerator:
|
||||
group.task = FighterSweep.name
|
||||
self._setup_group(group, package, flight, dynamic_runways)
|
||||
|
||||
if flight.unit_type not in GUNFIGHTERS:
|
||||
if flight.unit_type.dcs_unit_type not in GUNFIGHTERS:
|
||||
ammo_type = OptRTBOnOutOfAmmo.Values.AAM
|
||||
else:
|
||||
ammo_type = OptRTBOnOutOfAmmo.Values.Cannon
|
||||
@ -1182,7 +1182,7 @@ class AircraftConflictGenerator:
|
||||
# under the current flight plans.
|
||||
# TODO: Make this smarter, it currently selects a random unit in the group for target,
|
||||
# this could be updated to make it pick the "best" two targets in the group.
|
||||
if flight.unit_type is AJS37 and flight.client_count:
|
||||
if flight.unit_type.dcs_unit_type is AJS37 and flight.client_count:
|
||||
viggen_target_points = [
|
||||
(idx, point)
|
||||
for idx, point in enumerate(filtered_points)
|
||||
@ -1346,9 +1346,10 @@ class PydcsWaypointBuilder:
|
||||
"""Viggen player aircraft consider any waypoint with a TOT set to be a target ("M") waypoint.
|
||||
If the flight is a player controlled Viggen flight, no TOT should be set on any waypoint except actual target waypoints.
|
||||
"""
|
||||
if (self.flight.client_count > 0 and self.flight.unit_type == AJS37) and (
|
||||
self.waypoint.waypoint_type not in TARGET_WAYPOINTS
|
||||
):
|
||||
if (
|
||||
self.flight.client_count > 0
|
||||
and self.flight.unit_type.dcs_unit_type == AJS37
|
||||
) and (self.waypoint.waypoint_type not in TARGET_WAYPOINTS):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@ -1761,7 +1762,7 @@ class RaceTrackBuilder(PydcsWaypointBuilder):
|
||||
def configure_refueling_actions(self, waypoint: MovingPoint) -> None:
|
||||
waypoint.add_task(Tanker())
|
||||
|
||||
if self.flight.unit_type != IL_78M:
|
||||
if self.flight.unit_type.dcs_unit_type != IL_78M:
|
||||
tanker_info = self.air_support.tankers[-1]
|
||||
tacan = tanker_info.tacan
|
||||
tacan_callsign = {
|
||||
|
||||
@ -1093,13 +1093,13 @@ class FlightPlanBuilder:
|
||||
orbit_location = self.aewc_orbit(location)
|
||||
|
||||
# As high as possible to maximize detection and on-station time.
|
||||
if flight.unit_type == E_2C:
|
||||
if flight.unit_type.dcs_unit_type == E_2C:
|
||||
patrol_alt = feet(30000)
|
||||
elif flight.unit_type == E_3A:
|
||||
elif flight.unit_type.dcs_unit_type == E_3A:
|
||||
patrol_alt = feet(35000)
|
||||
elif flight.unit_type == A_50:
|
||||
elif flight.unit_type.dcs_unit_type == A_50:
|
||||
patrol_alt = feet(33000)
|
||||
elif flight.unit_type == KJ_2000:
|
||||
elif flight.unit_type.dcs_unit_type == KJ_2000:
|
||||
patrol_alt = feet(40000)
|
||||
else:
|
||||
patrol_alt = feet(25000)
|
||||
@ -1680,23 +1680,23 @@ class FlightPlanBuilder:
|
||||
builder = WaypointBuilder(flight, self.game, self.is_player)
|
||||
|
||||
tanker_type = flight.unit_type
|
||||
if tanker_type is KC_135:
|
||||
if tanker_type.dcs_unit_type is KC_135:
|
||||
# ~300 knots IAS.
|
||||
speed = knots(445)
|
||||
altitude = feet(24000)
|
||||
elif tanker_type is KC135MPRS:
|
||||
elif tanker_type.dcs_unit_type is KC135MPRS:
|
||||
# ~300 knots IAS.
|
||||
speed = knots(440)
|
||||
altitude = feet(23000)
|
||||
elif tanker_type is KC130:
|
||||
elif tanker_type.dcs_unit_type is KC130:
|
||||
# ~210 knots IAS, roughly the max for the KC-130 at altitude.
|
||||
speed = knots(370)
|
||||
altitude = feet(22000)
|
||||
elif tanker_type is S_3B_Tanker:
|
||||
elif tanker_type.dcs_unit_type is S_3B_Tanker:
|
||||
# ~265 knots IAS.
|
||||
speed = knots(320)
|
||||
altitude = feet(12000)
|
||||
elif tanker_type is IL_78M:
|
||||
elif tanker_type.dcs_unit_type is IL_78M:
|
||||
# ~280 knots IAS.
|
||||
speed = knots(400)
|
||||
altitude = feet(21000)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user