Push full control point information in the event stream.

https://github.com/dcs-liberation/dcs_liberation/issues/2263
This commit is contained in:
Raffson
2022-06-25 23:17:08 +02:00
committed by GitHub
parent da90a40bc4
commit 61488627a4
5 changed files with 23 additions and 17 deletions

View File

@@ -6,10 +6,8 @@ from fastapi import APIRouter, Body, Depends, HTTPException, status
from game import Game
from .models import ControlPointJs
from .. import EventStream
from ..dependencies import GameContext
from ..leaflet import LeafletPoint
from ...sim import GameUpdateEvents
router: APIRouter = APIRouter(prefix="/control-points")
@@ -90,7 +88,10 @@ def set_destination(
f"{cp.max_move_distance.nautical_miles}nm.",
)
cp.target_position = point
EventStream.put_nowait(GameUpdateEvents().update_control_point(cp))
from .. import EventStream
with EventStream.event_context() as events:
events.update_control_point(cp)
@router.put(
@@ -113,4 +114,7 @@ def cancel_travel(cp_id: UUID, game: Game = Depends(GameContext.require)) -> Non
)
cp.target_position = None
EventStream.put_nowait(GameUpdateEvents().update_control_point(cp))
from .. import EventStream
with EventStream.event_context() as events:
events.update_control_point(cp)