Fixed mypy errors 😒

This commit is contained in:
Khopa 2021-08-03 01:00:56 +02:00
parent 399c739fd7
commit a831800a05

View File

@ -709,6 +709,7 @@ class AircraftConflictGenerator:
group = self._generate_inflight( group = self._generate_inflight(
name=name, side=country, flight=flight, origin=cp name=name, side=country, flight=flight, origin=cp
) )
return group
elif isinstance(cp, NavalControlPoint): elif isinstance(cp, NavalControlPoint):
group_name = cp.get_carrier_group_name() group_name = cp.get_carrier_group_name()
carrier_group = self.m.find_group(group_name) carrier_group = self.m.find_group(group_name)
@ -725,8 +726,8 @@ class AircraftConflictGenerator:
start_type=flight.start_type, start_type=flight.start_type,
at=carrier_group, at=carrier_group,
) )
return group
else: else:
# If the flight is an helicopter flight, then prioritize dedicated helipads # If the flight is an helicopter flight, then prioritize dedicated helipads
if flight.unit_type.helicopter: if flight.unit_type.helicopter:
helipad = cp.get_free_helipad() helipad = cp.get_free_helipad()
@ -748,26 +749,30 @@ class AircraftConflictGenerator:
group.points[0].type = "TakeOffGroundHot" group.points[0].type = "TakeOffGroundHot"
helipad.occupied = True helipad.occupied = True
group_generated = True
for i in range(flight.count - 1): for i in range(flight.count - 1):
helipad = cp.get_free_helipad() helipad = cp.get_free_helipad()
if helipad is not None: if helipad is not None:
helipad.occupied = True helipad.occupied = True
group.units[1 + i].position = Point(helipad.x, helipad.y) group.units[1 + i].position = Point(
helipad.x, helipad.y
)
return group
if group is None: if not isinstance(cp, Airfield):
if not isinstance(cp, Airfield): raise RuntimeError(
raise RuntimeError( f"Attempted to spawn at airfield for non-airfield {cp}"
f"Attempted to spawn at airfield for non-airfield {cp}"
)
group = self._generate_at_airport(
name=name,
side=country,
unit_type=flight.unit_type.dcs_unit_type,
count=flight.count,
start_type=flight.start_type,
airport=cp.airport,
) )
group = self._generate_at_airport(
name=name,
side=country,
unit_type=flight.unit_type.dcs_unit_type,
count=flight.count,
start_type=flight.start_type,
airport=cp.airport,
)
return group
except Exception as e: except Exception as e:
# Generated when there is no place on Runway or on Parking Slots # Generated when there is no place on Runway or on Parking Slots
logging.error(e) logging.error(e)
@ -779,8 +784,7 @@ class AircraftConflictGenerator:
name=name, side=country, flight=flight, origin=cp name=name, side=country, flight=flight, origin=cp
) )
group.points[0].alt = 1500 group.points[0].alt = 1500
return group
return group
@staticmethod @staticmethod
def set_reduced_fuel( def set_reduced_fuel(