mirror of
https://github.com/spencershepard/RotorOps.git
synced 2025-11-10 15:45:30 +00:00
many more player aircraft, spawn planes at secondary airport
This commit is contained in:
parent
656d4b22fe
commit
d706a04f1f
@ -766,7 +766,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
new_slot.addItem(aircraftMods.UH_60L.id)
|
||||
|
||||
for plane_id in sorted(dcs.planes.plane_map):
|
||||
if dcs.planes.plane_map[plane_id].flyable and plane_id not in RotorOpsUnits.low_fidelity_aircraft_ids:
|
||||
if dcs.planes.plane_map[plane_id].flyable and plane_id not in RotorOpsUnits.excluded_player_aircraft:
|
||||
new_slot.addItem(plane_id)
|
||||
|
||||
new_slot.setCurrentIndex(0)
|
||||
|
||||
@ -5,9 +5,7 @@ import dcs.cloud_presets
|
||||
import os
|
||||
import random
|
||||
|
||||
import RotorOpsGroups
|
||||
import RotorOpsUnits
|
||||
import RotorOpsUtils
|
||||
import RotorOpsConflict
|
||||
import aircraftMods
|
||||
from RotorOpsImport import ImportObjects
|
||||
@ -411,7 +409,7 @@ class RotorOpsMission:
|
||||
|
||||
if options["time"] != "Default Time":
|
||||
self.m.random_daytime(options["time"].lower())
|
||||
print("Time set to " + options["time"])
|
||||
print("Time set to '" + options["time"] + "'")
|
||||
|
||||
# set the mission options
|
||||
if options["easy_comms"]:
|
||||
@ -529,7 +527,8 @@ class RotorOpsMission:
|
||||
def getCoalitionAirports(self, side: str):
|
||||
coalition_airports = []
|
||||
primary_airport = None
|
||||
shortest_dist = 1000000
|
||||
secondary_airport = None
|
||||
airports_by_distance = {}
|
||||
for airport_name in self.m.terrain.airports:
|
||||
airportobj = self.m.terrain.airports[airport_name]
|
||||
if airportobj.coalition == str.upper(side):
|
||||
@ -540,17 +539,21 @@ class RotorOpsMission:
|
||||
dist_from_start = dcs.mapping._distance(airportobj.position.x, airportobj.position.y, start.position.x,
|
||||
start.position.y)
|
||||
|
||||
if dist_from_start < shortest_dist:
|
||||
primary_airport = airportobj
|
||||
shortest_dist = dist_from_start
|
||||
airports_by_distance[dist_from_start] = airportobj
|
||||
|
||||
return coalition_airports, primary_airport
|
||||
if len(airports_by_distance) > 0:
|
||||
primary_airport = airports_by_distance[min(airports_by_distance)]
|
||||
airports_by_distance.pop(min(airports_by_distance))
|
||||
if len(airports_by_distance) > 0:
|
||||
secondary_airport = airports_by_distance[min(airports_by_distance)]
|
||||
|
||||
return coalition_airports, primary_airport, secondary_airport
|
||||
|
||||
def getParking(self, airport, aircraft, alt_airports=None, group_size=1):
|
||||
|
||||
if len(airport.free_parking_slots(aircraft)) >= group_size:
|
||||
if not (aircraft.id in dcs.planes.plane_map and (
|
||||
len(airport.runways) == 0 or not hasattr(airport.runways[0], "ils"))):
|
||||
len(airport.runways) == 0)):
|
||||
return airport
|
||||
|
||||
if alt_airports:
|
||||
@ -562,16 +565,12 @@ class RotorOpsMission:
|
||||
logger.warn("No parking available for " + aircraft.id)
|
||||
return None
|
||||
|
||||
# Find parking spots on FARPs and carriers
|
||||
def getUnitParking(self, aircraft):
|
||||
return
|
||||
|
||||
def swapSides(self, options):
|
||||
|
||||
# Swap airports
|
||||
|
||||
blue_airports, primary_blue = self.getCoalitionAirports("blue")
|
||||
red_airports, primary_red = self.getCoalitionAirports("red")
|
||||
blue_airports, primary_blue, secondary_blue = self.getCoalitionAirports("blue")
|
||||
red_airports, primary_red, secondary_red = self.getCoalitionAirports("red")
|
||||
|
||||
for airport in blue_airports:
|
||||
self.m.terrain.airports[airport.name].set_red()
|
||||
@ -680,7 +679,7 @@ class RotorOpsMission:
|
||||
farp_heading = farp.units[0].heading
|
||||
heading = farp_heading
|
||||
|
||||
friendly_airports, primary_f_airport = self.getCoalitionAirports("blue")
|
||||
friendly_airports, primary_f_airport, secondary_f_airport = self.getCoalitionAirports("blue")
|
||||
|
||||
|
||||
group_size = 1
|
||||
@ -706,21 +705,23 @@ class RotorOpsMission:
|
||||
|
||||
farp_helicopter_count = 1
|
||||
for helicopter_id in player_helicopters:
|
||||
plane = False
|
||||
fg = None
|
||||
helotype = None
|
||||
if helicopter_id in dcs.helicopters.helicopter_map:
|
||||
helotype = dcs.helicopters.helicopter_map[helicopter_id]
|
||||
elif helicopter_id in dcs.planes.plane_map:
|
||||
helotype = dcs.planes.plane_map[helicopter_id]
|
||||
plane = True
|
||||
else:
|
||||
continue
|
||||
if carrier:
|
||||
if carrier and not plane:
|
||||
fg = self.m.flight_group_from_unit(self.m.country(jtf_blue),
|
||||
"CARRIER " + start_type_string + helotype.id, helotype,
|
||||
carrier,
|
||||
dcs.task.CAS, group_size=group_size, start_type=start_type)
|
||||
|
||||
elif farp and farp_helicopter_count <= 4:
|
||||
elif farp and farp_helicopter_count <= 4 and not plane:
|
||||
|
||||
|
||||
#old ugly FARPs, or single player groups with wingman require fg from unit
|
||||
@ -753,11 +754,15 @@ class RotorOpsMission:
|
||||
fg.points[0].action = start_type_action
|
||||
fg.points[0].type = start_type_point_type
|
||||
else:
|
||||
parking = self.getParking(primary_f_airport, helotype, friendly_airports,
|
||||
if plane and secondary_f_airport:
|
||||
airport = secondary_f_airport
|
||||
else:
|
||||
airport = primary_f_airport
|
||||
parking = self.getParking(airport, helotype, friendly_airports,
|
||||
group_size=group_size)
|
||||
if parking:
|
||||
fg = self.m.flight_group_from_airport(self.m.country(jtf_blue),
|
||||
primary_f_airport.name + " " + start_type_string + helotype.id,
|
||||
airport.name + " " + start_type_string + helotype.id,
|
||||
helotype,
|
||||
parking, group_size=group_size, start_type=start_type)
|
||||
|
||||
@ -810,8 +815,8 @@ class RotorOpsMission:
|
||||
def addFlights(self, options, red_forces, blue_forces):
|
||||
combinedJointTaskForcesBlue = self.m.country(dcs.countries.CombinedJointTaskForcesBlue.name)
|
||||
combinedJointTaskForcesRed = self.m.country(dcs.countries.CombinedJointTaskForcesRed.name)
|
||||
friendly_airports, primary_f_airport = self.getCoalitionAirports("blue")
|
||||
enemy_airports, primary_e_airport = self.getCoalitionAirports("red")
|
||||
friendly_airports, primary_f_airport, secondary_f_airport = self.getCoalitionAirports("blue")
|
||||
enemy_airports, primary_e_airport, secondary_e_airport = self.getCoalitionAirports("red")
|
||||
|
||||
|
||||
# find enemy carriers and farps
|
||||
|
||||
@ -57,14 +57,41 @@ e_zone_sams = [
|
||||
]
|
||||
|
||||
#flaming cliffs aircraft
|
||||
low_fidelity_aircraft_ids = [
|
||||
excluded_player_aircraft = [
|
||||
dcs.planes.F_15C.id,
|
||||
dcs.planes.Su_27.id,
|
||||
dcs.planes.Su_33.id,
|
||||
dcs.planes.MiG_29A.id,
|
||||
dcs.planes.MiG_29S.id,
|
||||
dcs.planes.Su_25T.id,
|
||||
dcs.planes.Su_25TM.id
|
||||
dcs.planes.Su_25TM.id,
|
||||
dcs.planes.L_39C.id,
|
||||
dcs.planes.A_10C.id,
|
||||
dcs.planes.A_10A.id,
|
||||
dcs.planes.MB_339APAN.id,
|
||||
dcs.planes.Bf_109K_4.id,
|
||||
dcs.planes.C_101CC.id,
|
||||
dcs.planes.C_101EB.id,
|
||||
dcs.planes.Christen_Eagle_II.id,
|
||||
dcs.planes.F_86F_Sabre.id,
|
||||
dcs.planes.FW_190A8.id,
|
||||
dcs.planes.FW_190D9.id,
|
||||
dcs.planes.Hawk.id,
|
||||
dcs.planes.I_16.id,
|
||||
dcs.planes.J_11A.id,
|
||||
dcs.planes.MosquitoFBMkVI.id,
|
||||
dcs.planes.P_47D_30.id,
|
||||
dcs.planes.P_47D_40.id,
|
||||
dcs.planes.P_47D_30bl1.id,
|
||||
dcs.planes.P_51D.id,
|
||||
dcs.planes.P_51D_30_NA.id,
|
||||
dcs.planes.SpitfireLFMkIX.id,
|
||||
dcs.planes.SpitfireLFMkIXCW.id,
|
||||
dcs.planes.TF_51D.id,
|
||||
dcs.planes.Yak_52.id,
|
||||
dcs.planes.MiG_15bis.id,
|
||||
dcs.planes.MiG_19P.id,
|
||||
dcs.planes.Su_25.id
|
||||
]
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
-e git+https://github.com/spencershepard/dcs@0de3a707591d4f76244385cfe62808fd3ee34349#egg=pydcs
|
||||
-e git+https://github.com/spencershepard/dcs@5a192377494ea33a53e3b6385ef49d9cbd57cde1#egg=pydcs
|
||||
packaging==21.3
|
||||
PyQt5==5.15.9
|
||||
PyYAML==6.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user