diff --git a/changelog.md b/changelog.md index d0073763..901994cd 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ Saves from 13.x are not compatible with 14.0.0. * **[Engine]** Support for DCS 2.9.20 including MiG-29 Fulcrum (full fidelity version). * **[Mods]** A4EC mod version updated to 2.3. * **[UI]** Allow saving after fast forwarding manually with sim speed controls (--show-sim-speed-controls option). +* **[UI]** Add new option to fast forward until player is at the IP. ## Fixes diff --git a/game/ato/flightstate/inflight.py b/game/ato/flightstate/inflight.py index ad29b451..716f71a3 100644 --- a/game/ato/flightstate/inflight.py +++ b/game/ato/flightstate/inflight.py @@ -3,6 +3,7 @@ from __future__ import annotations from abc import ABC, abstractmethod from collections import deque from datetime import datetime, timedelta +import logging from typing import TYPE_CHECKING from dcs import Point @@ -13,6 +14,7 @@ from game.ato.flightstate.flightstate import FlightState from game.ato.flightwaypoint import FlightWaypoint from game.ato.flightwaypointtype import FlightWaypointType from game.ato.starttype import StartType +from game.settings.settings import FastForwardStopCondition from game.utils import Distance, LBS_TO_KG, Speed, pairwise if TYPE_CHECKING: @@ -164,3 +166,17 @@ class InFlight(FlightState, ABC): @property def spawn_type(self) -> StartType: return StartType.IN_FLIGHT + + def should_halt_sim(self) -> bool: + if ( + self.flight.client_count > 0 + and self.settings.fast_forward_stop_condition + == FastForwardStopCondition.PLAYER_AT_IP + and self.is_at_ip + ): + logging.info( + f"Interrupting simulation because {self.flight} has players and has " + "reached IP" + ) + return True + return False diff --git a/game/settings/settings.py b/game/settings/settings.py index 22f1e4bb..5e0d1072 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -35,6 +35,7 @@ class FastForwardStopCondition(Enum): PLAYER_TAKEOFF = "Player takeoff time" PLAYER_TAXI = "Player taxi time" PLAYER_STARTUP = "Player startup time" + PLAYER_AT_IP = "Player at IP" MANUAL = "Manual fast forward control" @@ -375,6 +376,7 @@ class Settings: "Player startup time": FastForwardStopCondition.PLAYER_STARTUP, "Player taxi time": FastForwardStopCondition.PLAYER_TAXI, "Player takeoff time": FastForwardStopCondition.PLAYER_TAKEOFF, + "Player at IP": FastForwardStopCondition.PLAYER_AT_IP, "First contact": FastForwardStopCondition.FIRST_CONTACT, "Manual": FastForwardStopCondition.MANUAL, },