mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Tweak ingress waypoint tasks for OCA-Runway, STRIKE & FighterSweep
This commit is contained in:
parent
962c64d065
commit
b318bc4941
@ -1,7 +1,7 @@
|
||||
import logging
|
||||
|
||||
from dcs.point import MovingPoint
|
||||
from dcs.task import BombingRunway, OptFormation
|
||||
from dcs.task import BombingRunway, OptFormation, WeaponType
|
||||
|
||||
from game.theater import Airfield
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
@ -10,6 +10,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
class OcaRunwayIngressBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
target = self.package.target
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
if not isinstance(target, Airfield):
|
||||
logging.error(
|
||||
"Unexpected target type for runway bombing mission: %s",
|
||||
@ -18,6 +19,17 @@ class OcaRunwayIngressBuilder(PydcsWaypointBuilder):
|
||||
return
|
||||
|
||||
waypoint.tasks.append(
|
||||
BombingRunway(airport_id=target.airport.id, group_attack=True)
|
||||
BombingRunway(
|
||||
airport_id=target.airport.id,
|
||||
weapon_type=WeaponType.Guided,
|
||||
altitude=waypoint.alt,
|
||||
group_attack=True,
|
||||
)
|
||||
)
|
||||
waypoint.tasks.append(
|
||||
BombingRunway(
|
||||
airport_id=target.airport.id,
|
||||
weapon_type=WeaponType.Bombs,
|
||||
group_attack=True,
|
||||
)
|
||||
)
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
|
||||
@ -34,13 +34,21 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
|
||||
for t in targets:
|
||||
avg_spacing += center.distance_to_point(t.position)
|
||||
avg_spacing /= len(targets)
|
||||
bombing = CarpetBombing(
|
||||
center,
|
||||
weapon_type=WeaponType.Bombs,
|
||||
expend=Expend.All,
|
||||
carpet_length=avg_spacing,
|
||||
altitude=waypoint.alt,
|
||||
)
|
||||
if self.group.task == "Ground Attack":
|
||||
bombing = CarpetBombing(
|
||||
center,
|
||||
weapon_type=WeaponType.Bombs,
|
||||
expend=Expend.All,
|
||||
carpet_length=avg_spacing,
|
||||
altitude=waypoint.alt,
|
||||
)
|
||||
else:
|
||||
bombing = Bombing(
|
||||
center,
|
||||
weapon_type=WeaponType.Bombs,
|
||||
expend=Expend.All,
|
||||
altitude=waypoint.alt,
|
||||
)
|
||||
waypoint.tasks.append(bombing)
|
||||
|
||||
def add_strike_tasks(
|
||||
|
||||
@ -10,6 +10,11 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
|
||||
class SweepIngressBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
if self.flight.count < 4:
|
||||
waypoint.tasks.append(OptFormation.line_abreast_open())
|
||||
else:
|
||||
waypoint.tasks.append(OptFormation.spread_four_open())
|
||||
|
||||
if not isinstance(self.flight.flight_plan, SweepFlightPlan):
|
||||
flight_plan_type = self.flight.flight_plan.__class__.__name__
|
||||
logging.error(
|
||||
@ -27,8 +32,3 @@ class SweepIngressBuilder(PydcsWaypointBuilder):
|
||||
],
|
||||
)
|
||||
)
|
||||
|
||||
if self.flight.count < 4:
|
||||
waypoint.tasks.append(OptFormation.line_abreast_open())
|
||||
else:
|
||||
waypoint.tasks.append(OptFormation.spread_four_open())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user