mirror of
https://github.com/spencershepard/RotorOps.git
synced 2025-11-10 15:45:30 +00:00
Develop (#40)
For users: -Added KA-50 III and AV8BNA Harrier to slot selection -Changed message in mission generated success dialog -Zone protect SAMs now part of 'Advanced Defenses' feature -Late activated friendly/enemy CAP units are placed in mission as a template for Deployed CAP fighters (ie will not be active unless using Advanced Defenses or 'DEPLOY_FIGHTERS' name for radar ground unit) -improve idle troop behavior at bases/FARPs For Mission creators: -Updated pydcs library supports new units such as technicals -Updated pydcs library supports Falklands map -allow troop pickup from HELO_CARRIER -enemy units with radar can be designated to deploy intercept fighters on detection (see RotorOps.fighter options in RotorOps.lua for details) with options for min detection altitude and distance (min detection altitude allows helis to fly 'under the radar') -Insert RotorOpsServer.lua script and trigger actions if option set in scenario config: rotorops_server: true -scenario template triggers should now be 'untouched' after mission generation, allowing previously unsupported triggers and actions to be used, along with color coding -block adding player helicopters if slots locked in scenario config -Added RotorOps.draw_conflict_zones setting to give users the ability to disable or enable displaying of zones on the map. -allow disabling spinboxes in scenario config -mission ends 10 mins after mission success/fail -copy helicopter start type from templates Internal: -github actions workflow to automatically deploy to update server -Startup version check will ignore micro version -bypassing triggers and merging before save (to preserve unsupported triggers in pydcs). Our goal is to leave the trigrules and trig from the source mission untouched -if using random weather, set ice halo to auto and crystals to none -dont put planes at airports without ILS (to avoid putting planes at helicopter airports ie. Syria) -improved guardPosition task -refactored 'coalition' variables to 'coal' to help prevent introducing errors in RotorOps.lua
This commit is contained in:
@@ -32,6 +32,10 @@ class RotorOpsMission:
|
||||
self.res_map = {}
|
||||
self.config = None # not used
|
||||
self.imports = None
|
||||
self.red_zones = {}
|
||||
self.blue_zones = {}
|
||||
self.primary_e_airport = None
|
||||
|
||||
|
||||
class RotorOpsZone:
|
||||
def __init__(self, name: str, flag: int, position: dcs.point, size: int):
|
||||
@@ -132,7 +136,22 @@ class RotorOpsMission:
|
||||
|
||||
window.statusBar().showMessage("Loading scenario mission", 10000)
|
||||
|
||||
self.m.load_file(options["scenario_file"])
|
||||
# self.m.load_file(options["scenario_file"])
|
||||
|
||||
# Bypass trig, triggrules, and triggers. Then load triggers
|
||||
# manually. We want to get our zones from the template mission, but leave the existing trigger actions and
|
||||
# conditions the same, since pydcs cannot yet handle some of them well.
|
||||
|
||||
self.m.load_file(options["scenario_file"], True)
|
||||
self.m.triggers.load_from_dict(self.m.bypassed_triggers)
|
||||
|
||||
# Create some 'empty' triggerrules so that we can maintain indexing when we merge dictionaries on save
|
||||
for rule in self.m.bypassed_trigrules:
|
||||
trig = dcs.triggers.TriggerOnce(comment="Empty " + str(rule))
|
||||
trig.rules.append(dcs.condition.TimeAfter(1))
|
||||
trig.actions.append(dcs.action.DoScript(dcs.action.String("Filler " + str(rule))))
|
||||
self.m.triggerrules.triggers.append(trig)
|
||||
|
||||
# Add countries if they're missing
|
||||
if not self.m.country(jtf_red):
|
||||
self.m.coalition.get("red").add_country(dcs.countries.CombinedJointTaskForcesRed())
|
||||
@@ -200,11 +219,11 @@ class RotorOpsMission:
|
||||
elif zone.name.rfind("SPAWN") >= 0:
|
||||
self.addZone(self.spawn_zones, self.RotorOpsZone(zone.name, None, zone.position, zone.radius))
|
||||
|
||||
blue_zones = self.staging_zones
|
||||
red_zones = self.conflict_zones
|
||||
self.blue_zones = self.staging_zones
|
||||
self.red_zones = self.conflict_zones
|
||||
if options["defending"]:
|
||||
blue_zones = self.conflict_zones
|
||||
red_zones = self.staging_zones
|
||||
self.blue_zones = self.conflict_zones
|
||||
self.red_zones = self.staging_zones
|
||||
# swap airport sides
|
||||
self.swapSides(options)
|
||||
|
||||
@@ -214,119 +233,10 @@ class RotorOpsMission:
|
||||
if options["player_hotstart"]:
|
||||
start_type = dcs.mission.StartType.Warm
|
||||
|
||||
# Adds vehicles as a single group (for easy late activation), and helicopters if enabled in settings
|
||||
# def addZoneFARP(_zone_name, country, file):
|
||||
#
|
||||
# farp_flag = self.m.find_group(_zone_name)
|
||||
#
|
||||
# if farp_flag:
|
||||
# farp_position = farp_flag.units[0].position
|
||||
# farp_heading = farp_flag.units[0].heading
|
||||
# else:
|
||||
# farp_position = self.all_zones[_zone_name].position
|
||||
# farp_heading = 0
|
||||
#
|
||||
# # Add the basic invisible farp object
|
||||
# farp = self.m.farp(self.m.country(country), _zone_name + " FARP", farp_position,
|
||||
# hidden=False, dead=False,
|
||||
# farp_type=dcs.unit.InvisibleFARP)
|
||||
#
|
||||
# # Use alternate template file if it has been defined in scenario config
|
||||
# if options["zone_farp_file"]:
|
||||
#
|
||||
# for i in imports:
|
||||
# if i.filename.removesuffix('.miz') == options["zone_farp_file"]:
|
||||
# file = i.path
|
||||
# # if multiple files found, we want the latest file to override the first
|
||||
#
|
||||
# i = ImportObjects(file)
|
||||
# i.anchorByGroupName("ANCHOR")
|
||||
# farp_group = i.copyVehiclesAsGroup(self.m, country, _zone_name + " FARP Static", farp_position,
|
||||
# farp_heading)
|
||||
# # Add client helicopters
|
||||
# if options["farp_spawns"]:
|
||||
# helicopter_groups = i.copyHelicopters(self.m, jtf_blue, "ZONE " + _zone_name + " EMPTY ", farp_position, farp_heading)
|
||||
# for group in helicopter_groups:
|
||||
# self.all_zones[_zone_name].player_helo_spawns.append(group)
|
||||
#
|
||||
# return farp_group
|
||||
|
||||
# # Adds statics, vehicles, and helicopters. Late activation is not possible
|
||||
# def addLogisticsZone(_zone_name, country, file, config_name, helicopters=False):
|
||||
# flag = self.m.find_group(_zone_name)
|
||||
# if flag:
|
||||
# position = flag.units[0].position
|
||||
# heading = flag.units[0].heading
|
||||
# else:
|
||||
# position = self.all_zones[_zone_name].position
|
||||
# heading = 0
|
||||
#
|
||||
# # Use alternate template file if it has been defined in scenario config
|
||||
# if options[config_name]:
|
||||
#
|
||||
# for i in imports:
|
||||
# if i.filename.removesuffix('.miz') == options[config_name]:
|
||||
# file = i.path
|
||||
# # if multiple files found, we want the latest file to override the first
|
||||
#
|
||||
# # Import statics and vehicles
|
||||
# i = ImportObjects(file)
|
||||
# i.anchorByGroupName("ANCHOR")
|
||||
# i.copyStatics(self.m, country, _zone_name + " Logistics Zone",
|
||||
# position, heading)
|
||||
# i.copyVehicles(self.m, country, _zone_name + " Logistics Zone",
|
||||
# position, heading)
|
||||
#
|
||||
# # Add client helicopters
|
||||
# if helicopters:
|
||||
# helicopter_groups = i.copyHelicopters(self.m, jtf_blue, "ZONE " + _zone_name + " EMPTY ", position,
|
||||
# heading)
|
||||
# for group in helicopter_groups:
|
||||
# self.all_zones[_zone_name].player_helo_spawns.append(group)
|
||||
|
||||
# Adds statics, vehicles, and helicopters (if enabled). Late activation is not possible.
|
||||
# def addDefensiveFARP(_zone_name, country, file):
|
||||
#
|
||||
# farp_flag = self.m.find_group(_zone_name)
|
||||
#
|
||||
# if farp_flag:
|
||||
# farp_position = farp_flag.units[0].position
|
||||
# farp_heading = farp_flag.units[0].heading
|
||||
# else:
|
||||
# farp_position = self.all_zones[_zone_name].position
|
||||
# farp_heading = 0
|
||||
#
|
||||
# # Add the basic invisible farp object
|
||||
# farp = self.m.farp(self.m.country(country), _zone_name + " FARP", farp_position,
|
||||
# hidden=False, dead=False,
|
||||
# farp_type=dcs.unit.InvisibleFARP)
|
||||
#
|
||||
# # Use alternate template file if it has been defined in scenario config
|
||||
# if options["defensive_farp_file"]:
|
||||
#
|
||||
# for i in imports:
|
||||
# if i.filename.removesuffix('.miz') == options["defensive_farp_file"]:
|
||||
# file = i.path
|
||||
# # if multiple files found, we want the latest file to override the first
|
||||
#
|
||||
# # Import statics and vehicles
|
||||
# i = ImportObjects(file)
|
||||
# i.anchorByGroupName("ANCHOR")
|
||||
# i.copyStatics(self.m, country, _zone_name + " Logistics Zone",
|
||||
# farp_position, farp_heading)
|
||||
# i.copyVehicles(self.m, country, _zone_name + " Logistics Zone",
|
||||
# farp_position, farp_heading)
|
||||
#
|
||||
# # Import player helicopters
|
||||
# if options["farp_spawns"]:
|
||||
# helicopter_groups = i.copyHelicopters(self.m, jtf_blue, "ZONE " + _zone_name + " EMPTY ", farp_position,
|
||||
# farp_heading)
|
||||
# for group in helicopter_groups:
|
||||
# self.all_zones[_zone_name].player_helo_spawns.append(group)
|
||||
|
||||
for zone_name in red_zones:
|
||||
for zone_name in self.red_zones:
|
||||
if red_forces["vehicles"]:
|
||||
self.addGroundGroups(red_zones[zone_name], self.m.country(jtf_red), red_forces["vehicles"],
|
||||
self.addGroundGroups(self.red_zones[zone_name], self.m.country(jtf_red), red_forces["vehicles"],
|
||||
options["red_quantity"])
|
||||
|
||||
if options["zone_farps"] != "farp_never" and not options["defending"]:
|
||||
@@ -340,8 +250,8 @@ class RotorOpsMission:
|
||||
file=activated_farp,
|
||||
config_name="zone_farp_file",
|
||||
copy_helicopters=helicopters,
|
||||
helicopters_name="ZONE " + zone_name + " EMPTY",
|
||||
heli_start_type=dcs.mission.StartType.Cold,
|
||||
helicopters_name="ZONE " + zone_name,
|
||||
heli_start_type=None,
|
||||
copy_vehicles=True,
|
||||
vehicles_name=zone_name + " FARP Static",
|
||||
copy_statics=False,
|
||||
@@ -352,34 +262,21 @@ class RotorOpsMission:
|
||||
)
|
||||
vehicle_group.late_activation = True
|
||||
|
||||
# For SAMs: Add vehicles as a single group (for easy late activation)
|
||||
if options["zone_protect_sams"]:
|
||||
|
||||
if options["advanced_defenses"]:
|
||||
sam_group = self.addZoneBase(options, zone_name, jtf_red,
|
||||
file=zone_protect,
|
||||
config_name="zone_protect_file",
|
||||
copy_vehicles=True,
|
||||
vehicles_name=zone_name + " Protect Static",
|
||||
vehicles_single_group=True
|
||||
vehicles_name=zone_name + " Defense Static",
|
||||
vehicles_single_group=False
|
||||
)
|
||||
# farp_flag = self.m.find_group(zone_name)
|
||||
#
|
||||
# if farp_flag:
|
||||
# farp_position = farp_flag.units[0].position
|
||||
# farp_heading = farp_flag.units[0].heading
|
||||
# else:
|
||||
# farp_position = self.all_zones[zone_name].position
|
||||
# farp_heading = 0
|
||||
#
|
||||
# i = ImportObjects(zone_protect)
|
||||
# i.anchorByGroupName("ANCHOR")
|
||||
# farp_group = i.copyVehiclesAsGroup(self.m, jtf_red, "Static " + zone_name + " Protection SAM",
|
||||
# farp_position,
|
||||
# farp_heading)
|
||||
|
||||
|
||||
# Populate Blue zones with ground units
|
||||
for i, zone_name in enumerate(blue_zones):
|
||||
for i, zone_name in enumerate(self.blue_zones):
|
||||
if blue_forces["vehicles"]:
|
||||
self.addGroundGroups(blue_zones[zone_name], self.m.country(jtf_blue), blue_forces["vehicles"],
|
||||
self.addGroundGroups(self.blue_zones[zone_name], self.m.country(jtf_blue), blue_forces["vehicles"],
|
||||
options["blue_quantity"])
|
||||
|
||||
# Add blue zone FARPS (not late activated) for defensive mode
|
||||
@@ -389,7 +286,7 @@ class RotorOpsMission:
|
||||
if options["farp_spawns"]:
|
||||
helicopters = True
|
||||
|
||||
if options["crates"] and i == len(blue_zones) - 1:
|
||||
if options["crates"] and i == len(self.blue_zones) - 1:
|
||||
# add a logistics zone to the last conflict zone
|
||||
# addLogisticsZone(zone_name, jtf_blue, logistics_farp, "logistics_farp_file", helicopters)
|
||||
self.addZoneBase(options, zone_name, jtf_blue,
|
||||
@@ -397,7 +294,7 @@ class RotorOpsMission:
|
||||
config_name="logistics_farp_file",
|
||||
copy_helicopters=helicopters,
|
||||
helicopters_name="ZONE " + zone_name + " LOGISTICS",
|
||||
heli_start_type=start_type,
|
||||
heli_start_type=None,
|
||||
copy_vehicles=True,
|
||||
vehicles_name=zone_name + " Logistics FARP",
|
||||
copy_statics=True,
|
||||
@@ -413,7 +310,7 @@ class RotorOpsMission:
|
||||
config_name="defensive_farp_file",
|
||||
copy_helicopters=helicopters,
|
||||
helicopters_name="ZONE " + zone_name + " EMPTY",
|
||||
heli_start_type=dcs.mission.StartType.Cold,
|
||||
heli_start_type=None,
|
||||
copy_vehicles=True,
|
||||
vehicles_name=zone_name + " Defensive FARP",
|
||||
copy_statics=True,
|
||||
@@ -443,7 +340,9 @@ class RotorOpsMission:
|
||||
|
||||
# Add player slots
|
||||
window.statusBar().showMessage("Adding flights to mission...", 10000)
|
||||
if options["slots"] != "Locked to Scenario" and options["slots"] != "None":
|
||||
if options["slots"] == "Locked to Scenario" or options["slots"] == "None":
|
||||
pass
|
||||
else:
|
||||
self.addPlayerHelos(options)
|
||||
|
||||
# Add AI Flights
|
||||
@@ -482,11 +381,15 @@ class RotorOpsMission:
|
||||
self.m.weather.wind_at_8000.direction = (wind_dir + random.randrange(-90, 90) - 180) % 360
|
||||
self.m.weather.wind_at_8000.speed = wind_speed + random.randrange(-1, 10)
|
||||
|
||||
self.m.weather.halo.preset = dcs.weather.Halo.Preset.Auto
|
||||
self.m.weather.halo.crystals = None
|
||||
|
||||
logger.info("Cloud preset = " + cloud_preset.ui_name + ", ground windspeed = " + str(
|
||||
self.m.weather.wind_at_ground.speed))
|
||||
|
||||
if options["time"] != "Default Time":
|
||||
self.m.random_daytime(options["time"].lower())
|
||||
print("Time set to " + options["time"])
|
||||
|
||||
# Save the mission file
|
||||
window.statusBar().showMessage("Saving mission...", 10000)
|
||||
@@ -496,12 +399,22 @@ class RotorOpsMission:
|
||||
output_dir = directories.output # default dir
|
||||
os.chdir(output_dir)
|
||||
output_filename = options["scenario_name"] + " " + time.strftime('%a%H%M%S') + '.miz'
|
||||
|
||||
# dcs.mission.save will use the bypassed trig, trigrules, and triggers. Our goal is to leave the trigrules and
|
||||
# trig from the source mission untouched. See comments in self.m.load_file above
|
||||
|
||||
#merge dictionaries
|
||||
self.m.bypassed_trig = self.m.triggerrules.trig() | self.m.bypassed_trig
|
||||
self.m.bypassed_trigrules = self.m.triggerrules.trigrules() | self.m.bypassed_trigrules
|
||||
|
||||
self.m.bypassed_triggers = self.m.triggers.dict()
|
||||
|
||||
success = self.m.save(output_filename)
|
||||
return {"success": success, "filename": output_filename, "directory": output_dir} # let the UI know the result
|
||||
|
||||
# Use the ImportObjects class to place farps and bases
|
||||
def addZoneBase(self, options, _zone_name, country, file, config_name=None, copy_helicopters=False,
|
||||
helicopters_name="", heli_start_type=dcs.mission.StartType.Cold,
|
||||
helicopters_name="", heli_start_type=None,
|
||||
copy_vehicles=False, vehicles_name="", copy_statics=False, statics_names="",
|
||||
vehicles_single_group=False, trigger_name=None, trigger_radius=110, farp=True):
|
||||
|
||||
@@ -598,7 +511,7 @@ class RotorOpsMission:
|
||||
|
||||
if len(airport.free_parking_slots(aircraft)) >= group_size:
|
||||
if not (aircraft.id in dcs.planes.plane_map and (
|
||||
len(airport.runways) == 0 or airport.runways[0].ils is None)):
|
||||
len(airport.runways) == 0 or not hasattr(airport.runways[0], "ils"))):
|
||||
return airport
|
||||
|
||||
if alt_airports:
|
||||
@@ -703,7 +616,7 @@ class RotorOpsMission:
|
||||
for helicopter in dcs.helicopters.helicopter_map:
|
||||
if helicopter == options["slots"]:
|
||||
client_helos = [dcs.helicopters.helicopter_map[
|
||||
helicopter]] # if out ui slot option matches a specific helicopter type name
|
||||
helicopter]] # if our ui slot option matches a specific helicopter type name
|
||||
|
||||
# get loadouts from miz file and put into a simple dict
|
||||
default_loadouts = {}
|
||||
@@ -757,6 +670,8 @@ class RotorOpsMission:
|
||||
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]
|
||||
else:
|
||||
continue
|
||||
if carrier:
|
||||
@@ -846,7 +761,7 @@ class RotorOpsMission:
|
||||
heading = enemy_heading + random.randrange(70, 110)
|
||||
race_dist = random.randrange(40 * 1000, 80 * 1000)
|
||||
center_pt = dcs.mapping.point_from_heading(friendly_pt.x, friendly_pt.y,
|
||||
enemy_heading - random.randrange(140, 220), 10000)
|
||||
enemy_heading - random.randrange(140, 220), 20000)
|
||||
pt1 = dcs.mapping.point_from_heading(center_pt[0], center_pt[1], enemy_heading - 90,
|
||||
random.randrange(20 * 1000, 40 * 1000))
|
||||
return dcs.mapping.Point(pt1[0], pt1[1], terrain), heading, race_dist
|
||||
@@ -857,6 +772,7 @@ class RotorOpsMission:
|
||||
friendly_airports, primary_f_airport = self.getCoalitionAirports("blue")
|
||||
enemy_airports, primary_e_airport = self.getCoalitionAirports("red")
|
||||
|
||||
|
||||
# find enemy carriers and farps
|
||||
carrier = self.m.country(jtf_red).find_ship_group(name="HELO_CARRIER")
|
||||
if not carrier:
|
||||
@@ -876,6 +792,27 @@ class RotorOpsMission:
|
||||
primary_f_airport.position.y
|
||||
)
|
||||
|
||||
self.primary_e_airport = primary_e_airport
|
||||
self.m.triggers.add_triggerzone(primary_e_airport.position, 1500, hidden=True, name="RED_AIRBASE")
|
||||
|
||||
if options["red_cap"]:
|
||||
scenario_red_cap_spawn_zone = None
|
||||
for zone in self.m.triggers.zones():
|
||||
if zone.name == "RED_CAP_SPAWN":
|
||||
scenario_red_cap_spawn_zone = True
|
||||
if not scenario_red_cap_spawn_zone:
|
||||
e_cap_spawn_point = primary_e_airport.position.point_from_heading(e_airport_heading, 100000)
|
||||
self.m.triggers.add_triggerzone(e_cap_spawn_point, 30000, hidden=True, name="RED_CAP_SPAWN")
|
||||
|
||||
if options["blue_cap"]:
|
||||
scenario_blue_cap_spawn_zone = None
|
||||
for zone in self.m.triggers.zones():
|
||||
if zone.name == "BLUE_CAP_SPAWN":
|
||||
scenario_blue_cap_spawn_zone = True
|
||||
if not scenario_blue_cap_spawn_zone:
|
||||
f_cap_spawn_point = primary_f_airport.position.point_from_heading(e_airport_heading + 180, 100000)
|
||||
self.m.triggers.add_triggerzone(f_cap_spawn_point, 30000, hidden=True, name="BLUE_CAP_SPAWN")
|
||||
|
||||
if options["f_awacs"]:
|
||||
awacs_name = "AWACS"
|
||||
awacs_freq = 266
|
||||
@@ -962,6 +899,7 @@ class RotorOpsMission:
|
||||
t1_freq) + ".00 " + t1_tac + "\n" + t2_name + " " + str(t2_freq) + ".00 " + t2_tac + "\n\n"
|
||||
self.m.set_description_text(briefing)
|
||||
|
||||
|
||||
def zone_attack(fg, airport):
|
||||
fg.set_skill(dcs.unit.Skill.High)
|
||||
fg.late_activation = True
|
||||
@@ -1093,6 +1031,139 @@ class RotorOpsMission:
|
||||
unit.pylons = source_helo.pylons
|
||||
unit.livery_id = source_helo.livery_id
|
||||
|
||||
if False:
|
||||
for i in range(1,4):
|
||||
randzone = random.choice(list(self.red_zones))
|
||||
pt2 = self.red_zones[randzone].position
|
||||
source_plane = None
|
||||
if red_forces["fighter_planes"]:
|
||||
source_group = random.choice(red_forces["fighter_planes"])
|
||||
source_plane = source_group.units[0]
|
||||
plane_type = source_plane.unit_type
|
||||
group_size = random.randrange(1, 2)
|
||||
|
||||
else:
|
||||
group_size = random.randrange(1, 2)
|
||||
plane_type = random.choice(RotorOpsUnits.e_attack_helos)
|
||||
|
||||
airport = self.getParking(primary_e_airport, plane_type, enemy_airports, group_size)
|
||||
|
||||
enemy_cap = self.m.patrol_flight(airport=airport,
|
||||
name="Enemy CAP " + str(i),
|
||||
country=combinedJointTaskForcesRed,
|
||||
patrol_type=plane_type,
|
||||
pos1=primary_e_airport.position,
|
||||
pos2=pt2,
|
||||
altitude=3000,
|
||||
group_size=group_size,
|
||||
max_engage_distance=40 * 1000
|
||||
)
|
||||
|
||||
# enemy_cap.points[0].tasks[0] = dcs.task.EngageTargets(max_engage_distance, [dcs.task.Targets.All.Air.Planes])
|
||||
|
||||
for unit in enemy_cap.units:
|
||||
unit.skill = dcs.unit.Skill.Random
|
||||
|
||||
if source_plane:
|
||||
for unit in enemy_cap.units:
|
||||
unit.pylons = source_plane.pylons
|
||||
unit.livery_id = source_plane.livery_id
|
||||
|
||||
if options["red_cap"]:
|
||||
|
||||
if red_forces["fighter_planes"]:
|
||||
for fighter_plane_group in red_forces["fighter_planes"]:
|
||||
source_group = random.choice(red_forces["fighter_planes"])
|
||||
source_plane = source_group.units[0]
|
||||
plane_type = source_plane.unit_type
|
||||
|
||||
enemy_cap = self.m.flight_group(
|
||||
country=combinedJointTaskForcesRed,
|
||||
name="RED CAP",
|
||||
aircraft_type=plane_type,
|
||||
airport=None,
|
||||
maintask=dcs.task.CAP,
|
||||
group_size=1,
|
||||
position=e_cap_spawn_point,
|
||||
altitude=5000,
|
||||
speed=300
|
||||
)
|
||||
|
||||
enemy_cap.late_activation = True
|
||||
|
||||
for unit in enemy_cap.units:
|
||||
unit.skill = dcs.unit.Skill.Random
|
||||
unit.pylons = source_plane.pylons
|
||||
unit.livery_id = source_plane.livery_id
|
||||
|
||||
else:
|
||||
plane_type = random.choice(RotorOpsUnits.e_fighter_planes)
|
||||
|
||||
enemy_cap = self.m.flight_group(
|
||||
country=combinedJointTaskForcesRed,
|
||||
name="RED CAP",
|
||||
aircraft_type=plane_type,
|
||||
airport=None,
|
||||
maintask=dcs.task.CAP,
|
||||
group_size=1,
|
||||
position=e_cap_spawn_point,
|
||||
altitude=5000,
|
||||
speed=300
|
||||
)
|
||||
|
||||
enemy_cap.late_activation = True
|
||||
|
||||
for unit in enemy_cap.units:
|
||||
unit.skill = dcs.unit.Skill.Random
|
||||
|
||||
if options["blue_cap"]:
|
||||
|
||||
if blue_forces["fighter_planes"]:
|
||||
for fighter_plane_group in blue_forces["fighter_planes"]:
|
||||
source_group = random.choice(blue_forces["fighter_planes"])
|
||||
source_plane = source_group.units[0]
|
||||
plane_type = source_plane.unit_type
|
||||
|
||||
friendly_cap = self.m.flight_group(
|
||||
country=combinedJointTaskForcesBlue,
|
||||
name="BLUE CAP",
|
||||
aircraft_type=plane_type,
|
||||
airport=None,
|
||||
maintask=dcs.task.CAP,
|
||||
group_size=1,
|
||||
position=f_cap_spawn_point,
|
||||
altitude=5000,
|
||||
speed=300
|
||||
)
|
||||
|
||||
friendly_cap.late_activation = True
|
||||
|
||||
for unit in friendly_cap.units:
|
||||
unit.skill = dcs.unit.Skill.Random
|
||||
unit.pylons = source_plane.pylons
|
||||
unit.livery_id = source_plane.livery_id
|
||||
|
||||
else:
|
||||
plane_type = random.choice(RotorOpsUnits.f_fighter_planes)
|
||||
|
||||
friendly_cap = self.m.flight_group(
|
||||
country=combinedJointTaskForcesBlue,
|
||||
name="BLUE CAP",
|
||||
aircraft_type=plane_type,
|
||||
airport=None,
|
||||
maintask=dcs.task.CAP,
|
||||
group_size=1,
|
||||
position=f_cap_spawn_point,
|
||||
altitude=5000,
|
||||
speed=300
|
||||
)
|
||||
|
||||
friendly_cap.late_activation = True
|
||||
|
||||
for unit in friendly_cap.units:
|
||||
unit.skill = dcs.unit.Skill.Random
|
||||
|
||||
|
||||
def importObjects(self, data):
|
||||
|
||||
imports = data["objects"]["imports"]
|
||||
|
||||
Reference in New Issue
Block a user