mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Add (very!) rough simulation of frozen combat.
There are some TODOs here but th behavior is flagged off by default. The biggest TODO here is that the time spent frozen is not simulated, so flights that are engaged by SAMs will unfreeze, move slightly, then re- freeze. https://github.com/dcs-liberation/dcs_liberation/issues/1680
This commit is contained in:
@@ -2,8 +2,10 @@ from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Iterator
|
||||
from datetime import timedelta
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from game.ato.flightstate import InCombat, InFlight
|
||||
from .frozencombat import FrozenCombat
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -11,8 +13,8 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class JoinableCombat(FrozenCombat, ABC):
|
||||
def __init__(self, flights: list[Flight]) -> None:
|
||||
super().__init__()
|
||||
def __init__(self, freeze_duration: timedelta, flights: list[Flight]) -> None:
|
||||
super().__init__(freeze_duration)
|
||||
self.flights = flights
|
||||
|
||||
@abstractmethod
|
||||
@@ -20,7 +22,10 @@ class JoinableCombat(FrozenCombat, ABC):
|
||||
...
|
||||
|
||||
def join(self, flight: Flight) -> None:
|
||||
assert isinstance(flight.state, InFlight)
|
||||
assert not isinstance(flight.state, InCombat)
|
||||
self.flights.append(flight)
|
||||
flight.set_state(InCombat(flight.state, self))
|
||||
|
||||
def iter_flights(self) -> Iterator[Flight]:
|
||||
yield from self.flights
|
||||
|
||||
Reference in New Issue
Block a user