mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Will be used later to simulate combat. https://github.com/dcs-liberation/dcs_liberation/issues/1680
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
from datetime import datetime, timedelta
|
|
from typing import TYPE_CHECKING
|
|
|
|
from .flightstate import FlightState
|
|
from .takeoff import Takeoff
|
|
from ..starttype import StartType
|
|
|
|
if TYPE_CHECKING:
|
|
from game.ato.flight import Flight
|
|
from game.settings import Settings
|
|
|
|
|
|
class Taxi(FlightState):
|
|
def __init__(self, flight: Flight, settings: Settings, now: datetime) -> None:
|
|
super().__init__(flight, settings)
|
|
self.completion_time = now + flight.flight_plan.estimate_ground_ops()
|
|
|
|
def on_game_tick(self, time: datetime, duration: timedelta) -> None:
|
|
if time < self.completion_time:
|
|
return
|
|
self.flight.set_state(Takeoff(self.flight, self.settings, time))
|
|
|
|
@property
|
|
def is_waiting_for_start(self) -> bool:
|
|
return False
|
|
|
|
@property
|
|
def spawn_type(self) -> StartType:
|
|
return StartType.WARM
|
|
|
|
def should_halt_sim(self) -> bool:
|
|
if (
|
|
self.flight.client_count > 0
|
|
and self.settings.player_mission_interrupts_sim_at is StartType.WARM
|
|
):
|
|
logging.info(
|
|
f"Interrupting simulation because {self.flight} has players and has "
|
|
"reached taxi time"
|
|
)
|
|
return True
|
|
return False
|
|
|
|
@property
|
|
def description(self) -> str:
|
|
return "Taxiing"
|