dcs-retribution/game/theater/presetlocation.py
RndName 5cdfe62e2d Implement advanced skynet functions
- factor out own class for the iadsnetwork within the conflicttheater
- This class will handle all Skynet related things - no specific group_name handling necessary in future
- make iadsbuilding own TGO class because SAM & EWRs are Vehicle Groups. IADS Elements dont have any groups attached.
- added command center, connection node and power source as Ground objects which can be added by the campaign designer
- adjust lua generator to support new iads units
- parse the campaign yaml to get the iads network information
- use the range as fallback if no yaml information was found
- complete rewrite of the skynet lua script
- allow destruction of iads network to be persistent over all rounds
- modified the presetlocation handling: the wrapper PresetLocation for PointWithHeading now stores the original name from the campaign miz to have the ability to process campaign yaml configurations based on the ground unit
- Implementation of the UI representation for the IADS Network
- Give user the option to enable or disable advanced iads
- Extended the layout system: Implement Sub task handling to support PD
2022-04-19 10:41:16 +02:00

35 lines
1.1 KiB
Python

from __future__ import annotations
from typing import TypeVar
from dcs.mapping import Point
from dcs.unitgroup import StaticGroup, ShipGroup, VehicleGroup
from game.point_with_heading import PointWithHeading
from game.utils import Heading
GroupT = TypeVar("GroupT", StaticGroup, ShipGroup, VehicleGroup)
class PresetLocation(PointWithHeading):
"""Store information about the Preset Location set by the campaign designer"""
# This allows to store original name and force a specific type or template
original_name: str # Store the original name from the campaign miz
def __init__(
self, name: str, position: Point, heading: Heading = Heading.from_degrees(0)
) -> None:
super().__init__(position.x, position.y, heading, position._terrain)
self.original_name = name
@classmethod
def from_group(cls, group: GroupT) -> PresetLocation:
"""Creates a PresetLocation from a placeholder group in the campaign miz"""
preset = PresetLocation(
group.name,
group.position,
Heading.from_degrees(group.units[0].heading),
)
return preset