Add setting to fast forward until player is at IP (#3530)

This commit is contained in:
zhexu14 2025-10-25 10:56:51 +11:00 committed by GitHub
parent 545990b16d
commit 2591a2b9a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

View File

@ -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). * **[Engine]** Support for DCS 2.9.20 including MiG-29 Fulcrum (full fidelity version).
* **[Mods]** A4EC mod version updated to 2.3. * **[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]** 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 ## Fixes

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from collections import deque from collections import deque
from datetime import datetime, timedelta from datetime import datetime, timedelta
import logging
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from dcs import Point from dcs import Point
@ -13,6 +14,7 @@ from game.ato.flightstate.flightstate import FlightState
from game.ato.flightwaypoint import FlightWaypoint from game.ato.flightwaypoint import FlightWaypoint
from game.ato.flightwaypointtype import FlightWaypointType from game.ato.flightwaypointtype import FlightWaypointType
from game.ato.starttype import StartType from game.ato.starttype import StartType
from game.settings.settings import FastForwardStopCondition
from game.utils import Distance, LBS_TO_KG, Speed, pairwise from game.utils import Distance, LBS_TO_KG, Speed, pairwise
if TYPE_CHECKING: if TYPE_CHECKING:
@ -164,3 +166,17 @@ class InFlight(FlightState, ABC):
@property @property
def spawn_type(self) -> StartType: def spawn_type(self) -> StartType:
return StartType.IN_FLIGHT 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

View File

@ -35,6 +35,7 @@ class FastForwardStopCondition(Enum):
PLAYER_TAKEOFF = "Player takeoff time" PLAYER_TAKEOFF = "Player takeoff time"
PLAYER_TAXI = "Player taxi time" PLAYER_TAXI = "Player taxi time"
PLAYER_STARTUP = "Player startup time" PLAYER_STARTUP = "Player startup time"
PLAYER_AT_IP = "Player at IP"
MANUAL = "Manual fast forward control" MANUAL = "Manual fast forward control"
@ -375,6 +376,7 @@ class Settings:
"Player startup time": FastForwardStopCondition.PLAYER_STARTUP, "Player startup time": FastForwardStopCondition.PLAYER_STARTUP,
"Player taxi time": FastForwardStopCondition.PLAYER_TAXI, "Player taxi time": FastForwardStopCondition.PLAYER_TAXI,
"Player takeoff time": FastForwardStopCondition.PLAYER_TAKEOFF, "Player takeoff time": FastForwardStopCondition.PLAYER_TAKEOFF,
"Player at IP": FastForwardStopCondition.PLAYER_AT_IP,
"First contact": FastForwardStopCondition.FIRST_CONTACT, "First contact": FastForwardStopCondition.FIRST_CONTACT,
"Manual": FastForwardStopCondition.MANUAL, "Manual": FastForwardStopCondition.MANUAL,
}, },