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

82 lines
2.6 KiB
Python

from __future__ import annotations
from dataclasses import dataclass, field
from enum import Enum
from game.data.groups import GroupTask
from game.utils import Distance
class IadsRole(Enum):
#: A radar SAM that should be controlled by Skynet.
SAM = "Sam"
#: A radar SAM that should be controlled and used as an EWR by Skynet.
SAM_AS_EWR = "SamAsEwr"
#: An air defense unit that should be used as point defense by Skynet.
POINT_DEFENSE = "PD"
#: An ewr unit that should provide information to the Skynet IADS.
EWR = "Ewr"
#: IADS Elements which allow the advanced functions of Skynet.
CONNECTION_NODE = "ConnectionNode"
POWER_SOURCE = "PowerSource"
COMMAND_CENTER = "CommandCenter"
#: All other types of groups that might be present in a SAM TGO. This includes
#: SHORADS, AAA, supply trucks, etc. Anything that shouldn't be controlled by Skynet
#: should use this role.
NO_BEHAVIOR = "NoBehavior"
@classmethod
def for_task(cls, task: GroupTask) -> IadsRole:
if task == GroupTask.COMMS:
return cls.CONNECTION_NODE
elif task == GroupTask.POWER:
return cls.POWER_SOURCE
elif task == GroupTask.COMMAND_CENTER:
return cls.COMMAND_CENTER
elif task == GroupTask.POINT_DEFENSE:
return cls.POINT_DEFENSE
elif task == GroupTask.LORAD:
return cls.SAM_AS_EWR
elif task == GroupTask.MERAD:
return cls.SAM
elif task in [
GroupTask.EARLY_WARNING_RADAR,
GroupTask.NAVY,
GroupTask.AIRCRAFT_CARRIER,
GroupTask.HELICOPTER_CARRIER,
]:
return cls.EWR
return cls.NO_BEHAVIOR
@classmethod
def for_category(cls, category: str) -> IadsRole:
if category == "comms":
return cls.CONNECTION_NODE
elif category == "power":
return cls.POWER_SOURCE
elif category == "commandcenter":
return cls.COMMAND_CENTER
return cls.NO_BEHAVIOR
@property
def connection_range(self) -> Distance:
if self == IadsRole.CONNECTION_NODE:
return Distance(27780) # 15nm
elif self == IadsRole.POWER_SOURCE:
return Distance(64820) # 35nm
return Distance(0)
@property
def participate(self) -> bool:
# Returns true if the Role participates in the skynet
# This will exclude NoBehaviour and PD for the time beeing
return self not in [
IadsRole.NO_BEHAVIOR,
IadsRole.POINT_DEFENSE,
]