mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Improved Strike mission generation.
- B52, A-20, and Tu-22 will level bomb targets - When there is an unit group as target, all the units are now engaged instead of only the first unit of the group
This commit is contained in:
parent
040db055fd
commit
d9511a7edd
29
game/db.py
29
game/db.py
@ -955,23 +955,10 @@ COMMON_OVERRIDE = {
|
||||
|
||||
PLANE_PAYLOAD_OVERRIDES: Dict[Type[PlaneType], Dict[Type[Task], str]] = {
|
||||
|
||||
B_1B: {
|
||||
CAS: "GBU-38*16, CBU-97*20",
|
||||
PinpointStrike: "GBU-31*8, GBU-38*32",
|
||||
GroundAttack: "GBU-31*8, GBU-38*32",
|
||||
},
|
||||
B_52H: {
|
||||
PinpointStrike: "AGM-86C*20",
|
||||
GroundAttack: "Mk 82*51",
|
||||
},
|
||||
F_117A: {
|
||||
PinpointStrike: "GBU-10*2",
|
||||
},
|
||||
F_15E: {
|
||||
CAS: "AIM-120B*2,AIM-9M*2,FUEL,GBU-12*4,GBU-38*4,AGM-65D*2",
|
||||
GroundAttack: "AIM-120B*2,AIM-9M*2,FUEL*3,CBU-97*12",
|
||||
PinpointStrike: "AIM-120B*2,AIM-9M*2,FUEL,GBU-31*4,AGM-154C*2",
|
||||
},
|
||||
B_1B: COMMON_OVERRIDE,
|
||||
B_52H: COMMON_OVERRIDE,
|
||||
F_117A: COMMON_OVERRIDE,
|
||||
F_15E: COMMON_OVERRIDE,
|
||||
FA_18C_hornet: {
|
||||
CAP: "CAP HEAVY",
|
||||
Intercept: "CAP HEAVY",
|
||||
@ -995,12 +982,8 @@ PLANE_PAYLOAD_OVERRIDES: Dict[Type[PlaneType], Dict[Type[Task], str]] = {
|
||||
Tu_160: {
|
||||
PinpointStrike: "Kh-65*12",
|
||||
},
|
||||
Tu_22M3: {
|
||||
GroundAttack: "FAB-500*33, FAB-250*36",
|
||||
},
|
||||
Tu_95MS: {
|
||||
PinpointStrike: "Kh-65*6",
|
||||
},
|
||||
Tu_22M3: COMMON_OVERRIDE,
|
||||
Tu_95MS: COMMON_OVERRIDE,
|
||||
A_10A: COMMON_OVERRIDE,
|
||||
A_10C: COMMON_OVERRIDE,
|
||||
A_10C_2: COMMON_OVERRIDE,
|
||||
|
||||
@ -29,7 +29,7 @@ from dcs.planes import (
|
||||
P_51D_30_NA,
|
||||
SpitfireLFMkIX,
|
||||
SpitfireLFMkIXCW,
|
||||
Su_33,
|
||||
Su_33, A_20G, Tu_22M3, B_52H,
|
||||
)
|
||||
from dcs.point import MovingPoint, PointAction
|
||||
from dcs.task import (
|
||||
@ -54,7 +54,7 @@ from dcs.task import (
|
||||
SEAD,
|
||||
StartCommand,
|
||||
Targets,
|
||||
Task,
|
||||
Task, WeaponType,
|
||||
)
|
||||
from dcs.terrain.terrain import Airport
|
||||
from dcs.translation import String
|
||||
@ -1054,7 +1054,7 @@ class AircraftConflictGenerator:
|
||||
def configure_strike(self, group: FlyingGroup, package: Package,
|
||||
flight: Flight,
|
||||
dynamic_runways: Dict[str, RunwayData]) -> None:
|
||||
group.task = PinpointStrike.name
|
||||
group.task = GroundAttack.name
|
||||
self._setup_group(group, GroundAttack, package, flight, dynamic_runways)
|
||||
self.configure_behavior(
|
||||
group,
|
||||
@ -1347,7 +1347,7 @@ class SeadIngressBuilder(PydcsWaypointBuilder):
|
||||
|
||||
class StrikeIngressBuilder(PydcsWaypointBuilder):
|
||||
def build(self) -> MovingPoint:
|
||||
if self.group.units[0].unit_type == B_17G:
|
||||
if self.group.units[0].unit_type in [B_17G, A_20G, B_52H, Tu_22M3]:
|
||||
return self.build_bombing()
|
||||
else:
|
||||
return self.build_strike()
|
||||
@ -1370,7 +1370,7 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
|
||||
bombing.params["attackQtyLimit"] = False
|
||||
bombing.params["directionEnabled"] = False
|
||||
bombing.params["altitudeEnabled"] = False
|
||||
bombing.params["weaponType"] = 2032
|
||||
bombing.params["weaponType"] = WeaponType.Bombs.value
|
||||
bombing.params["groupAttack"] = True
|
||||
waypoint.tasks.append(bombing)
|
||||
return waypoint
|
||||
@ -1378,14 +1378,38 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
|
||||
def build_strike(self) -> MovingPoint:
|
||||
waypoint = super().build()
|
||||
|
||||
for i, t in enumerate(self.waypoint.targets):
|
||||
waypoint.tasks.append(Bombing(t.position))
|
||||
if self.group.units[0].unit_type == JF_17 and i < 4:
|
||||
self.group.add_nav_target_point(t.position, "PP" + str(i + 1))
|
||||
if self.group.units[0].unit_type == F_14B and i == 0:
|
||||
self.group.add_nav_target_point(t.position, "ST")
|
||||
if self.group.units[0].unit_type == AJS37 and i < 9:
|
||||
self.group.add_nav_target_point(t.position, "M" + str(i + 1))
|
||||
i = 0
|
||||
for target in self.waypoint.targets:
|
||||
|
||||
targets = [target]
|
||||
# If the target type is a group of units,
|
||||
# then target each unit in the group with a Bombing task on their position
|
||||
# (It is not perfect, we should have an engage Group task instead,
|
||||
# but we don't have the group ref in the model there)
|
||||
# TODO : for building group, engage all the buildings as well
|
||||
if isinstance(target, TheaterGroundObject):
|
||||
if len(target.units) > 0:
|
||||
targets = target.units
|
||||
|
||||
for t in targets:
|
||||
bombing = Bombing(t.position)
|
||||
# If there is only one target, drop all ordnance in one pass
|
||||
if len(self.waypoint.targets) == 1 and len(targets) == 1:
|
||||
bombing.params["expend"] = "All"
|
||||
bombing.params["weaponType"] = WeaponType.Auto.value
|
||||
bombing.params["groupAttack"] = True
|
||||
waypoint.tasks.append(bombing)
|
||||
print(bombing)
|
||||
|
||||
# Register special waypoints
|
||||
if self.group.units[0].unit_type == JF_17 and i < 4:
|
||||
self.group.add_nav_target_point(t.position, "PP" + str(i + 1))
|
||||
if self.group.units[0].unit_type == F_14B and i == 0:
|
||||
self.group.add_nav_target_point(t.position, "ST")
|
||||
if self.group.units[0].unit_type == AJS37 and i < 9:
|
||||
self.group.add_nav_target_point(t.position, "M" + str(i + 1))
|
||||
i = i + 1
|
||||
|
||||
return waypoint
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ from typing import Dict, List, Optional, TYPE_CHECKING
|
||||
|
||||
from dcs.mapping import Point
|
||||
from dcs.point import MovingPoint, PointAction
|
||||
from dcs.unittype import UnitType
|
||||
from dcs.unittype import FlyingType
|
||||
|
||||
from game import db
|
||||
from theater.controlpoint import ControlPoint, MissionTarget
|
||||
@ -128,7 +128,7 @@ class FlightWaypoint:
|
||||
|
||||
class Flight:
|
||||
|
||||
def __init__(self, package: Package, unit_type: UnitType, count: int,
|
||||
def __init__(self, package: Package, unit_type: FlyingType, count: int,
|
||||
from_cp: ControlPoint, flight_type: FlightType,
|
||||
start_type: str) -> None:
|
||||
self.package = package
|
||||
|
||||
@ -15,7 +15,8 @@
|
||||
"Ka_50",
|
||||
"Mi_8MT",
|
||||
"Mi_24V",
|
||||
"Tu_22M3"
|
||||
"Tu_22M3",
|
||||
"Tu_95MS"
|
||||
],
|
||||
"awacs": [
|
||||
"A_50"
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
from typing import List, TYPE_CHECKING
|
||||
|
||||
from dcs.mapping import Point
|
||||
from dcs.unit import Unit
|
||||
from dcs.unitgroup import Group
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -93,6 +95,13 @@ class TheaterGroundObject(MissionTarget):
|
||||
def group_identifier(self) -> str:
|
||||
return "{}|{}".format(self.category, self.group_id)
|
||||
|
||||
@property
|
||||
def units(self) -> List[Unit]:
|
||||
"""
|
||||
:return: all the units at this location
|
||||
"""
|
||||
return list(itertools.chain.from_iterable([g.units for g in self.groups]))
|
||||
|
||||
@property
|
||||
def name_abbrev(self) -> str:
|
||||
return ABBREV_NAME[self.category]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user