FARP spawn for helis on frontline cas; updated ground object placements

This commit is contained in:
Vasyl Horbachenko
2018-09-11 03:12:33 +03:00
parent ca521e7e51
commit d31876b65e
8 changed files with 97 additions and 54 deletions

View File

@@ -358,7 +358,8 @@ PLANE_PAYLOAD_OVERRIDES = {
},
Ka_50: {
"*": "12x9A4172, 40xS-8",
CAS: "12x9A4172, 40xS-8",
GroundAttack: "12x9A4172, 40xS-8",
},
M_2000C: {
@@ -483,6 +484,27 @@ def assigned_units_from(d: PlaneDict) -> AssignedUnitsDict:
return {k: (v, 0) for k, v in d.items()}
def assignedunits_split_to_count(dict: AssignedUnitsDict, count: int):
buffer_dict = {}
for unit_type, (unit_count, client_count) in dict.items():
for _ in range(unit_count):
new_count, new_client_count = buffer_dict.get(unit_type, (0, 0))
new_count += 1
if client_count > 0:
new_client_count += 1
client_count -= 1
buffer_dict[unit_type] = new_count, new_client_count
if new_count >= count:
yield buffer_dict
buffer_dict = {}
if len(buffer_dict):
yield buffer_dict
def unitdict_from(fd: AssignedUnitsDict) -> Dict:
return {k: v1 for k, (v1, v2) in fd.items()}

View File

@@ -2,7 +2,7 @@ import typing
import logging
from dcs.unittype import UnitType
from dcs.task import Task
from dcs.task import *
from dcs.unittype import UnitType
from game import *

View File

@@ -39,12 +39,15 @@ class FrontlineAttackOperation(Operation):
def generate(self):
self.armorgen.generate_vec(self.attackers, self.target)
planes_flights = {k: v for k, v in self.strikegroup.items() if k in plane_map}
planes_flights = {k: v for k, v in self.strikegroup.items() if k in plane_map.values()}
self.airgen.generate_cas_strikegroup(*assigned_units_split(planes_flights), at=self.attackers_starting_position)
heli_flights = {k: v for k, v in self.strikegroup.items() if k in helicopters.helicopter_map}
heli_flights = {k: v for k, v in self.strikegroup.items() if k in helicopters.helicopter_map.values()}
if heli_flights:
self.airgen.generate_cas_strikegroup(*assigned_units_split(heli_flights), at=self.groundobjectgen.generate_farp())
self.briefinggen.append_frequency("FARP", "127.5 MHz AM")
for farp, dict in zip(self.groundobjectgen.generate_farps(sum([x[0] for x in heli_flights.values()])),
db.assignedunits_split_to_count(heli_flights, self.groundobjectgen.FARP_CAPACITY)):
self.airgen.generate_cas_strikegroup(*assigned_units_split(dict), at=farp, escort=False)
self.briefinggen.title = "Frontline CAS"
self.briefinggen.description = "Provide CAS for the ground forces attacking enemy lines. Operation will be considered successful if total number of enemy units will be lower than your own by a factor of 1.5 (i.e. with 12 units from both sides, enemy forces need to be reduced to at least 8), meaning that you (and, probably, your wingmans) should concentrate on destroying the enemy units. Target base strength will be lowered as a result. Be advised that your flight will not attack anything until you explicitly tell them so by comms menu."