Update the UI to show sim state.

https://github.com/dcs-liberation/dcs_liberation/issues/1704
This commit is contained in:
Dan Albert
2021-10-31 22:25:11 -07:00
parent 87bf3110c8
commit 03430a4df5
12 changed files with 188 additions and 39 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
import logging
from datetime import datetime
from pathlib import Path
from typing import Callable, TYPE_CHECKING
@@ -22,6 +23,10 @@ class GameLoop:
self.started = False
self.completed = False
@property
def current_time_in_sim(self) -> datetime:
return self.sim.time
def start(self) -> None:
if self.started:
raise RuntimeError("Cannot start game loop because it has already started")
@@ -67,7 +72,5 @@ class GameLoop:
self.pause()
logging.info(f"Simulation completed at {self.sim.time}")
self.on_complete()
else:
logging.info(f"Simulation continued at {self.sim.time}")
except SimulationAlreadyCompletedError:
logging.exception("Attempted to tick already completed sim")

View File

@@ -32,6 +32,7 @@ class MissionSimulation:
self.time = self.game.conditions.start_time
def begin_simulation(self) -> None:
self.time = self.game.conditions.start_time
self.aircraft_simulation.begin_simulation()
def tick(self) -> bool: