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
68 lines
1.8 KiB
Python
68 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime, timedelta
|
|
from typing import TYPE_CHECKING
|
|
|
|
from dcs import Point
|
|
|
|
from game.utils import Distance, Speed
|
|
from .inflight import InFlight
|
|
from ..starttype import StartType
|
|
|
|
if TYPE_CHECKING:
|
|
from game.sim.combat import FrozenCombat
|
|
|
|
|
|
class InCombat(InFlight):
|
|
def __init__(self, previous_state: InFlight, combat: FrozenCombat) -> None:
|
|
super().__init__(
|
|
previous_state.flight,
|
|
previous_state.settings,
|
|
previous_state.waypoint_index,
|
|
)
|
|
self.previous_state = previous_state
|
|
self.combat = combat
|
|
|
|
def estimate_position(self) -> Point:
|
|
return self.previous_state.estimate_position()
|
|
|
|
def estimate_altitude(self) -> tuple[Distance, str]:
|
|
return self.previous_state.estimate_altitude()
|
|
|
|
def estimate_speed(self) -> Speed:
|
|
return self.previous_state.estimate_speed()
|
|
|
|
def on_game_tick(self, time: datetime, duration: timedelta) -> None:
|
|
raise RuntimeError("Cannot simulate combat")
|
|
|
|
@property
|
|
def is_at_ip(self) -> bool:
|
|
return False
|
|
|
|
@property
|
|
def is_waiting_for_start(self) -> bool:
|
|
return False
|
|
|
|
def should_halt_sim(self) -> bool:
|
|
return True
|
|
|
|
@property
|
|
def vulnerable_to_intercept(self) -> bool:
|
|
# Interception results in the interceptor joining the existing combat rather
|
|
# than creating a new combat.
|
|
return False
|
|
|
|
@property
|
|
def vulnerable_to_sam(self) -> bool:
|
|
# SAM contact results in the SAM joining the existing combat rather than
|
|
# creating a new combat.
|
|
return False
|
|
|
|
@property
|
|
def spawn_type(self) -> StartType:
|
|
return StartType.IN_FLIGHT
|
|
|
|
@property
|
|
def description(self) -> str:
|
|
return self.combat.describe()
|