Update Anti Air and Naval Layouts

- Break down the remaining Anti Air Layouts. Now each layout.miz only contains 1 layout
- Added a python script which can fix the orientation of a layout
- Fix layout orientation. Now all aa layouts are oriented to the north.
- Add small change so that whole carrier group will be rotated correctly with the BRC

closes #2215
This commit is contained in:
RndName 2022-05-12 12:01:48 +02:00
parent 7acc418489
commit f20d0effe9
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0
51 changed files with 119 additions and 106 deletions

13
.vscode/launch.json vendored
View File

@ -51,6 +51,17 @@
"PYTHONPATH": ".;./pydcs" "PYTHONPATH": ".;./pydcs"
}, },
"preLaunchTask": "Prepare Environment" "preLaunchTask": "Prepare Environment"
} },
{
"name": "Fix Layout orientation",
"type": "python",
"request": "launch",
"program": "resources\\tools\\fix_layout_orientation.py",
"console": "integratedTerminal",
"env": {
"PYTHONPATH": ".;./pydcs"
},
"args": ["resources/layouts/anti_air/S-300_Site.miz"]
},
] ]
} }

View File

@ -417,7 +417,8 @@ class GenericCarrierGenerator(GroundObjectGenerator):
if self.game.theater.is_in_sea(point): if self.game.theater.is_in_sea(point):
group.points[0].speed = carrier_speed.meters_per_second group.points[0].speed = carrier_speed.meters_per_second
group.add_waypoint(point, carrier_speed.kph) group.add_waypoint(point, carrier_speed.kph)
return brc # Rotate the whole ground object to the new course
self.ground_object.rotate(brc)
return None return None
def tacan_callsign(self) -> str: def tacan_callsign(self) -> str:

View File

@ -6,4 +6,4 @@ units:
- SAM NASAMS SR MPQ64F1 - SAM NASAMS SR MPQ64F1
- SAM NASAMS LN AIM-120B - SAM NASAMS LN AIM-120B
layouts: layouts:
- NASAMS Site - 4 Launcher Circle

View File

@ -6,4 +6,4 @@ units:
- SAM NASAMS SR MPQ64F1 - SAM NASAMS SR MPQ64F1
- SAM NASAMS LN AIM-120C - SAM NASAMS LN AIM-120C
layouts: layouts:
- NASAMS Site - 4 Launcher Circle

View File

@ -6,4 +6,4 @@ units:
- SAM SA-11 Buk "Gadfly" C2 - SAM SA-11 Buk "Gadfly" C2
- SAM SA-17 Buk M1-2 LN 9A310M1-2 - SAM SA-17 Buk M1-2 LN 9A310M1-2
layouts: layouts:
- SA-17 Grizzly Battery - 4 Launcher Site

View File

@ -5,4 +5,4 @@ units:
- SAM SA-6 Kub "Straight Flush" STR - SAM SA-6 Kub "Straight Flush" STR
- SAM SA-6 Kub "Gainful" TEL - SAM SA-6 Kub "Gainful" TEL
layouts: layouts:
- SA-6 Kub Site - 4 Launcher Circle

Binary file not shown.

View File

@ -0,0 +1,32 @@
name: 4 Launcher Circle
tasks:
- SHORAD
- MERAD
groups:
- SAM:
- name: Search Radar
unit_count:
- 1
unit_classes:
- SearchRadar
- SearchTrackRadar
- name: Command Post
optional: true
fill: false # Do not fill with faction possible units
unit_count:
- 1
unit_classes:
- CommandPost
- name: Launcher
unit_count:
- 4
unit_classes:
- Launcher
- TELAR
- name: Logistics
optional: true
unit_count:
- 1
- 2
unit_classes:
- Logistics

Binary file not shown.

View File

@ -1,21 +0,0 @@
name: AAA Mobile
description: A standard AAA template
generic: true # This Layout will be used to generate ForceGroups
tasks:
- AAA
groups:
- AAA: # Group Name
- name: AAA Mobile 0 # Sub group which will be merged into the group
unit_count:
- 2
- 6
unit_classes:
- AAA
- name: AAA Mobile 1 # Sub group which will be merged into the group
optional: true
unit_count:
- 1
- 2
unit_classes:
- Logistics
layout_file: resources/layouts/anti_air/AAA.miz

View File

@ -5,22 +5,22 @@ tasks:
- AAA - AAA
groups: groups:
- AAA: - AAA:
- name: AAA Radar Site 0 - name: AAA Site Radar
unit_count: unit_count:
- 1 - 1
unit_classes: unit_classes:
- SearchRadar - SearchRadar
- name: AAA Radar Site 1 - name: AAA Site
unit_count: unit_count:
- 2 - 2
- 6 - 6
unit_classes: unit_classes:
- AAA - AAA
- name: AAA Radar Site 2 - name: AAA Site Logistics
optional: true optional: true
unit_count: unit_count:
- 1 - 1
- 2 - 2
unit_classes: unit_classes:
- Logistics - Logistics
layout_file: resources/layouts/anti_air/AAA.miz layout_file: resources/layouts/anti_air/AAA_Site.miz

Binary file not shown.

View File

@ -5,17 +5,16 @@ tasks:
- AAA - AAA
groups: groups:
- AAA: - AAA:
- name: AAA Site 0 - name: AAA Site
unit_count: unit_count:
- 2 - 2
- 6 - 6
unit_classes: unit_classes:
- AAA - AAA
- name: AAA Site 1 - name: AAA Site Logistics
optional: true optional: true
unit_count: unit_count:
- 1 - 1
- 2 - 2
unit_classes: unit_classes:
- Logistics - Logistics
layout_file: resources/layouts/anti_air/AAA.miz

Binary file not shown.

View File

@ -34,4 +34,3 @@ groups:
- 2 - 2
unit_classes: unit_classes:
- Logistics - Logistics
layout_file: resources/layouts/anti_air/flak.miz

Binary file not shown.

View File

@ -12,4 +12,3 @@ groups:
fallback_classes: fallback_classes:
- SearchRadar - SearchRadar
- SearchTrackRadar - SearchTrackRadar
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

Binary file not shown.

View File

@ -48,4 +48,3 @@ groups:
- 4 - 4
unit_types: unit_types:
- Blitz_36-6700A - Blitz_36-6700A
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

Binary file not shown.

View File

@ -48,4 +48,3 @@ groups:
- 3 - 3
unit_types: unit_types:
- soldier_mauser98 - soldier_mauser98
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

View File

@ -1,21 +0,0 @@
name: NASAMS Site
tasks:
- MERAD
groups:
- NASAMS:
- name: SR
unit_count:
- 1
unit_types:
- NASAMS_Radar_MPQ64F1
- name: CC
unit_count:
- 1
unit_types:
- NASAMS_Command_Post
- name: LN
unit_count:
- 4
unit_types:
- NASAMS_LN_B
- NASAMS_LN_C

Binary file not shown.

View File

@ -49,4 +49,3 @@ groups:
- 2 - 2
unit_classes: unit_classes:
- SHORAD - SHORAD
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

View File

@ -1,21 +0,0 @@
name: SA-17 Grizzly Battery
tasks:
- MERAD
groups:
- SA-17:
- name: SA-17 Grizzly Battery 0
unit_count:
- 1
unit_types:
- SA-11 Buk SR 9S18M1
- name: SA-17 Grizzly Battery 1
unit_count:
- 1
unit_types:
- SA-11 Buk CC 9S470M1
- name: SA-17 Grizzly Battery 2
unit_count:
- 3
unit_types:
- SA-17 Buk M1-2 LN 9A310M1-2
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

Binary file not shown.

View File

@ -24,4 +24,3 @@ groups:
- 6 - 6
unit_types: unit_types:
- S-200_Launcher - S-200_Launcher
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

View File

@ -1,16 +0,0 @@
name: SA-6 Kub Site
tasks:
- MERAD
groups:
- SA-6:
- name: SA-6 Kub Site 0
unit_count:
- 1
unit_types:
- Kub 1S91 str
- name: SA-6 Kub Site 1
unit_count:
- 4
unit_types:
- Kub 2P25 ln
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

Binary file not shown.

View File

@ -38,4 +38,3 @@ groups:
- 1 - 1
unit_types: unit_types:
- Bedford_MWD - Bedford_MWD
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

Binary file not shown.

View File

@ -13,4 +13,3 @@ groups:
- 1 - 1
unit_types: unit_types:
- Blitz_36-6700A - Blitz_36-6700A
layout_file: resources/layouts/anti_air/legacy_ground_templates.miz

Binary file not shown.

Binary file not shown.

View File

@ -15,4 +15,3 @@ groups:
- 4 - 4
unit_classes: unit_classes:
- Destroyer - Destroyer
layout_file: resources/layouts/naval/legacy_naval_templates.miz

Binary file not shown.

View File

@ -20,4 +20,3 @@ groups:
- 1 - 1
unit_types: unit_types:
- TICONDEROG - TICONDEROG
layout_file: resources/layouts/naval/legacy_naval_templates.miz

Binary file not shown.

View File

@ -15,4 +15,3 @@ groups:
- 2 - 2
unit_classes: unit_classes:
- Destroyer - Destroyer
layout_file: resources/layouts/naval/legacy_naval_templates.miz

Binary file not shown.

View File

@ -20,4 +20,3 @@ groups:
- 1 - 1
unit_classes: unit_classes:
- Cruiser - Cruiser
layout_file: resources/layouts/naval/naval.miz

Binary file not shown.

View File

@ -14,4 +14,3 @@ groups:
- Boat - Boat
- Submarine - Submarine
- LandingShip - LandingShip
layout_file: resources/layouts/naval/naval.miz

Binary file not shown.

View File

@ -14,4 +14,3 @@ groups:
- 3 - 3
unit_types: unit_types:
- LST_Mk2 - LST_Mk2
layout_file: resources/layouts/naval/legacy_naval_templates.miz

Binary file not shown.

View File

@ -0,0 +1,63 @@
# Script to update a layout.miz which is not created with an orientation of Heading=0
# It loads the miz as and reorientates all objects
# Requirement: Only ONE Group has to be within the miz file.
# Load miz
# Determine Center and current heading (use first unit for that)
# Rotate everything around the center with the difference to heading 0
# Save the miz
import argparse
import itertools
from typing import Any
import dcs
from game.point_with_heading import PointWithHeading
from game.utils import Heading
def fix_orientation(miz_file: str) -> None:
mission = dcs.Mission()
mission.load_file(miz_file)
groups = []
# Load all units from the miz
for country in itertools.chain(
mission.coalition["red"].countries.values(),
mission.coalition["blue"].countries.values(),
):
for dcs_group in itertools.chain(
mission.country(country.name).vehicle_group,
mission.country(country.name).ship_group,
mission.country(country.name).static_group,
):
groups.append(dcs_group)
# Get the center which will be used as origin for the rotation
center_unit = groups[0].units[0]
# Calculate the rotation
rotation = Heading.from_degrees(360 - int(center_unit.heading))
# Rotate all units
for group in groups:
for unit in group.units:
unit.position = PointWithHeading.from_point(
unit.position, Heading.from_degrees(int(unit.heading)) + rotation
)
unit.heading = unit.position.heading.degrees
unit.position.rotate(center_unit.position, rotation)
group.points[0].position = group.units[0].position
# Save the miz
mission.save()
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("mission", type=str, help="The mission which will be fixed")
args = parser.parse_args()
fix_orientation(args.mission)
main()