mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Roll-over excess time from tasks.
This commit is contained in:
@@ -21,5 +21,5 @@ class ActionState:
|
||||
def is_finished(self) -> bool:
|
||||
return self._finished
|
||||
|
||||
def on_game_tick(self, time: datetime, duration: timedelta) -> None:
|
||||
self.action.update_state(self, time, duration)
|
||||
def on_game_tick(self, time: datetime, duration: timedelta) -> timedelta:
|
||||
return self.action.update_state(self, time, duration)
|
||||
|
||||
@@ -6,7 +6,6 @@ from datetime import datetime, timedelta
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dcs import Point
|
||||
from dcs.task import Task
|
||||
|
||||
from game.ato.flightstate import Completed
|
||||
from game.ato.flightstate.actionstate import ActionState
|
||||
@@ -111,11 +110,12 @@ class InFlight(FlightState, ABC):
|
||||
def on_game_tick(
|
||||
self, events: GameUpdateEvents, time: datetime, duration: timedelta
|
||||
) -> None:
|
||||
if (action := self.current_action) is not None:
|
||||
action.on_game_tick(time, duration)
|
||||
while (action := self.current_action) is not None:
|
||||
duration = action.on_game_tick(time, duration)
|
||||
if action.is_finished():
|
||||
self.pending_actions.popleft()
|
||||
return
|
||||
if duration <= timedelta():
|
||||
return
|
||||
|
||||
self.elapsed_time += duration
|
||||
if self.elapsed_time > self.total_time_to_next_waypoint:
|
||||
|
||||
Reference in New Issue
Block a user