Merge remote-tracking branch 'remotes/dcs-retribution/dcs-retribution/dev' into pretense-generator

This commit is contained in:
MetalStormGhost
2024-07-20 19:21:06 +03:00
18 changed files with 457 additions and 233 deletions

View File

@@ -24,13 +24,13 @@ from game.theater import (
TheaterGroundObject,
TheaterUnit,
)
from game.theater.theatergroup import TheaterGroup
from game.utils import Distance, meters, nautical_miles, feet
AGL_TRANSITION_ALT = 5000
if TYPE_CHECKING:
from game.transfers import MultiGroupTransport
from game.theater.theatergroup import TheaterGroup
from game.ato.flight import Flight
@@ -323,7 +323,9 @@ class WaypointBuilder:
return FlightWaypoint(
target.name,
FlightWaypointType.TARGET_POINT,
target.target.position,
target.target.ground_object.position
if isinstance(target.target, (TheaterGroup, TheaterUnit))
else target.target.position,
meters(0),
"RADIO",
description=description,

View File

@@ -10,6 +10,8 @@ from dcs import Mission, Point
from dcs.coalition import Coalition
from dcs.countries import country_dict
from dcs.task import OptReactOnThreat
from dcs.terrain import Airport
from dcs.unit import Static
from game.atcdata import AtcData
from game.dcs.beacons import Beacons
@@ -112,8 +114,8 @@ class MissionGenerator:
self.notify_info_generators()
# TODO: Shouldn't this be first?
namegen.reset_numbers()
self.generate_warehouses()
self.mission.save(output)
return self.unit_map
@@ -347,3 +349,33 @@ class MissionGenerator:
self.mission.groundControl.blue_tactical_commander = commanders
self.mission.groundControl.blue_jtac = settings.jtac_count
self.mission.groundControl.blue_observer = settings.observer_count
def generate_warehouses(self) -> None:
settings = self.game.settings
for tmu in self.unit_map.theater_objects.values():
if (
tmu.theater_unit.is_ship
or isinstance(tmu.dcs_unit, Static)
and tmu.dcs_unit.category in ["Warehouses", "Heliports"]
):
# We'll serialize more than is actually necessary
# DCS will filter out warehouses as dynamic spawns so no need to worry there
# thus, if we serialize a ship as a warehouse that's not supported, DCS will filter it out
warehouse = Airport(
tmu.theater_unit.position,
self.mission.terrain,
).dict()
warehouse["coalition"] = (
"blue" if tmu.theater_unit.ground_object.coalition.player else "red"
)
warehouse["dynamicCargo"] = settings.dynamic_cargo
if tmu.theater_unit.is_ship or tmu.dcs_unit.category == "Heliports": # type: ignore
warehouse["dynamicSpawn"] = settings.dynamic_slots
warehouse["allowHotStart"] = settings.dynamic_slots_hot
self.mission.warehouses.warehouses[tmu.dcs_unit.id] = warehouse
# configure dynamic spawn, hot start of DS & dynamic cargo for airfields
for ap in self.mission.terrain.airports.values():
ap.dynamic_spawn = settings.dynamic_slots
ap.allow_hot_start = settings.dynamic_slots_hot
ap.dynamic_cargo = settings.dynamic_cargo

View File

@@ -38,6 +38,7 @@ from dcs.task import (
FireAtPoint,
OptAlarmState,
)
from dcs.terrain import Airport
from dcs.translation import String
from dcs.triggers import (
Event,
@@ -859,6 +860,14 @@ class HelipadGenerator:
cull_farp_statics = False
if not cull_farp_statics:
warehouse = Airport(
pad.position,
self.m.terrain,
).dict()
warehouse["coalition"] = "blue" if self.cp.coalition.player else "red"
# configure dynamic spawn + hot start of DS, plus dynamic cargo?
self.m.warehouses.warehouses[pad.id] = warehouse
# Generate a FARP Ammo and Fuel stack for each pad
self.m.static_group(
country=country,
@@ -1095,6 +1104,14 @@ class GroundSpawnLargeGenerator:
country.id
)
warehouse = Airport(
pad.position,
self.m.terrain,
).dict()
warehouse["coalition"] = "blue" if self.cp.coalition.player else "red"
# configure dynamic spawn + hot start of DS, plus dynamic cargo?
self.m.warehouses.warehouses[pad.id] = warehouse
# Generate a FARP Ammo and Fuel stack for each pad
if self.game.settings.ground_start_trucks:
self.m.vehicle_group(
@@ -1231,6 +1248,14 @@ class GroundSpawnGenerator:
cull_farp_statics = False
if not cull_farp_statics:
warehouse = Airport(
pad.position,
self.m.terrain,
).dict()
warehouse["coalition"] = "blue" if self.cp.coalition.player else "red"
# configure dynamic spawn + hot start of DS, plus dynamic cargo?
self.m.warehouses.warehouses[pad.id] = warehouse
# Generate a FARP Ammo and Fuel stack for each pad
if self.game.settings.ground_start_trucks:
self.m.vehicle_group(

View File

@@ -238,7 +238,13 @@ RADIOS: List[Radio] = [
# MiG-19P
Radio("RSIU-4V", (RadioRange(MHz(100), MHz(150), kHz(25), Modulation.AM),)),
# MiG-21bis
Radio("RSIU-5V", (RadioRange(MHz(118), MHz(140), kHz(25), Modulation.AM),)),
Radio(
"R-832",
(
RadioRange(MHz(118), MHz(140), kHz(100), Modulation.AM),
RadioRange(MHz(220), MHz(390), kHz(100), Modulation.AM),
),
),
# Ka-50
# Note: Also capable of 100MHz-150MHz, but we can't model gaps.
Radio("R-800L1", (RadioRange(MHz(220), MHz(400), kHz(25), Modulation.AM),)),

View File

@@ -921,6 +921,29 @@ class Settings:
" and reapplied at split/racetrack end for applicable flights. "
),
)
dynamic_slots: bool = boolean_option(
"Dynamic slots",
MISSION_GENERATOR_PAGE,
GAMEPLAY_SECTION,
default=False,
detail=(
"Enables dynamic slots. Please note that losses from dynamic slots won't be registered."
),
)
dynamic_slots_hot: bool = boolean_option(
"Allow dynamic slot hot start",
MISSION_GENERATOR_PAGE,
GAMEPLAY_SECTION,
default=True,
detail=("Enables hot start for dynamic slots."),
)
dynamic_cargo: bool = boolean_option(
"Dynamic cargo",
MISSION_GENERATOR_PAGE,
GAMEPLAY_SECTION,
default=True,
detail=("Enables dynamic cargo for airfields, ships, FARPs & warehouses."),
)
# Performance
perf_smoke_gen: bool = boolean_option(