mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
* Roadbase and ground spawn support Implemented support for roadbases and ground spawn slots at airfields and FOBs. The ground spawn slots can be inserted in campaigns by placing either an A-10A or an AJS37 at a runway or ramp. This will cause an invisible FARP, an ammo dump and a fuel dump to be placed (behind the slot in case of A-10A, to the side in case of AJS37) in the generated campaigns. The ground spawn slot can be used by human controlled aircraft in generated missions. Also allowed the use of the four-slot FARP and the single helipad in campaigns, in addition to the invisible FARP. The first waypoint of the placed aircraft will be the center of a Remove Statics trigger zone (which might or might not work in multiplayer due to a DCS limitation). Also implemented three new options in settings: - AI fixed-wing aircraft can use roadbases / bases with only ground spawns - This setting will allow the AI to use the roadbases for flights and transfers. AI flights will air-start from these bases, since the AI in DCS is not currently able to take off from ground spawns. - Spawn trucks at ground spawns in airbases instead of FARP statics - Spawn trucks at ground spawns in roadbases instead of FARP statics - These settings will replace the FARP statics with refueler and ammo trucks at roadbases. Enabling them might have a negative performance impact. * Modified calculate_parking_slots() so it now takes into account also helicopter slots on FARPs and also ground start slots (but only if the aircraft is flyable or the "AI fixed-wing aircraft can use roadbases / bases with only ground spawns" option is enabled in settings). * Improved the way parking slots are communicated on the basemenu window. * Refactored helipad and ground spawn appends to static methods _add_helipad and _add_ground_spawn in mizcampaignloader.py Added missing changelog entries. Fixed tgogenerator.py imports. Cleaned up ParkingType() construction. * Added test_control_point_parking for testing that the correct number of parking slots are returned for control point in test_controlpoint.py * Added test_parking_type_from_squadron to test the correct ParkingType object is returned for a squadron of Viggens in test_controlpoint.py * Added test_parking_type_from_aircraft to test the correct ParkingType object is returned for Viggen aircraft type in test_controlpoint.py --------- Co-authored-by: Raffson <Raffson@users.noreply.github.com>
108 lines
3.7 KiB
Python
108 lines
3.7 KiB
Python
from dcs import Point
|
|
from dcs.drawing import LineStyle, Rgba
|
|
from dcs.drawing.drawings import StandardLayer
|
|
from dcs.mission import Mission
|
|
|
|
from game import Game
|
|
from game.missiongenerator.frontlineconflictdescription import (
|
|
FrontLineConflictDescription,
|
|
)
|
|
|
|
# Misc config settings for objects drawn in ME mission file (and F10 map)
|
|
from game.theater import TRIGGER_RADIUS_CAPTURE
|
|
|
|
FRONTLINE_COLORS = Rgba(255, 0, 0, 255)
|
|
WHITE = Rgba(255, 255, 255, 255)
|
|
CP_RED = Rgba(255, 0, 0, 80)
|
|
CP_BLUE = Rgba(0, 0, 255, 80)
|
|
BLUE_PATH_COLOR = Rgba(0, 0, 255, 100)
|
|
RED_PATH_COLOR = Rgba(255, 0, 0, 100)
|
|
ACTIVE_PATH_COLOR = Rgba(255, 80, 80, 100)
|
|
|
|
|
|
class DrawingsGenerator:
|
|
"""
|
|
Generate drawn objects for the F10 map and mission editor
|
|
"""
|
|
|
|
def __init__(self, mission: Mission, game: Game) -> None:
|
|
self.mission = mission
|
|
self.game = game
|
|
self.player_layer = self.mission.drawings.get_layer(StandardLayer.Blue)
|
|
|
|
def generate_cps_markers(self) -> None:
|
|
"""
|
|
Generate cps as circles
|
|
"""
|
|
for cp in self.game.theater.controlpoints:
|
|
if cp.captured:
|
|
color = CP_BLUE
|
|
else:
|
|
color = CP_RED
|
|
shape = self.player_layer.add_circle(
|
|
cp.position,
|
|
TRIGGER_RADIUS_CAPTURE,
|
|
line_thickness=2,
|
|
color=WHITE,
|
|
fill=color,
|
|
line_style=LineStyle.Dot,
|
|
)
|
|
shape.name = cp.name
|
|
|
|
def generate_routes(self) -> None:
|
|
"""
|
|
Generate routes drawing between cps
|
|
"""
|
|
seen = set()
|
|
for cp in self.game.theater.controlpoints:
|
|
seen.add(cp)
|
|
for destination, convoy_route in cp.convoy_routes.items():
|
|
if destination in seen:
|
|
continue
|
|
else:
|
|
# Determine path color
|
|
if cp.captured and destination.captured:
|
|
color = BLUE_PATH_COLOR
|
|
elif not cp.captured and not destination.captured:
|
|
color = RED_PATH_COLOR
|
|
else:
|
|
color = ACTIVE_PATH_COLOR
|
|
|
|
# Add shape to layer
|
|
shape = self.player_layer.add_line_segments(
|
|
cp.position,
|
|
[Point(0, 0, self.game.theater.terrain)]
|
|
+ [p - cp.position for p in convoy_route]
|
|
+ [destination.position - cp.position],
|
|
line_thickness=6,
|
|
color=color,
|
|
line_style=LineStyle.Solid,
|
|
)
|
|
shape.name = "path from " + cp.name + " to " + destination.name
|
|
|
|
def generate_frontlines_drawing(self) -> None:
|
|
"""
|
|
Generate a frontline "line" for each active frontline
|
|
"""
|
|
for front_line in self.game.theater.conflicts():
|
|
bounds = FrontLineConflictDescription.frontline_bounds(
|
|
front_line, self.game.theater, self.game.settings
|
|
)
|
|
|
|
end_point = bounds.left_position.point_from_heading(
|
|
bounds.heading_from_left_to_right.degrees, bounds.length
|
|
)
|
|
shape = self.player_layer.add_line_segment(
|
|
bounds.left_position,
|
|
end_point - bounds.left_position,
|
|
line_thickness=16,
|
|
color=FRONTLINE_COLORS,
|
|
line_style=LineStyle.Triangle,
|
|
)
|
|
shape.name = front_line.name
|
|
|
|
def generate(self) -> None:
|
|
self.generate_frontlines_drawing()
|
|
self.generate_routes()
|
|
self.generate_cps_markers()
|