mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
This doesn't do anything yet, but sets up the data model handling for frozen combat. The next step is to show combat in the map view, since that will be helpful when debugging the step after that one: resolving frozen combat. This would benefit from caching the Shapely data for SAM threat zones. Right now it's generating them once per tick and the stuttering is visible at max speed. https://github.com/dcs-liberation/dcs_liberation/issues/1680
30 lines
811 B
Python
30 lines
811 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Iterator
|
|
from typing import Any, TYPE_CHECKING
|
|
|
|
from .frozencombat import FrozenCombat
|
|
|
|
if TYPE_CHECKING:
|
|
from game.ato import Flight
|
|
from game.theater import TheaterGroundObject
|
|
|
|
|
|
class DefendingSam(FrozenCombat):
|
|
def __init__(
|
|
self, flight: Flight, air_defenses: list[TheaterGroundObject[Any]]
|
|
) -> None:
|
|
super().__init__()
|
|
self.flight = flight
|
|
self.air_defenses = air_defenses
|
|
|
|
def because(self) -> str:
|
|
sams = ", ".join(str(d) for d in self.air_defenses)
|
|
return f"{self.flight} is engaged by enemy air defenses: {sams}"
|
|
|
|
def describe(self) -> str:
|
|
return f"engaged by enemy air defenses"
|
|
|
|
def iter_flights(self) -> Iterator[Flight]:
|
|
yield self.flight
|