mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Handle map reset when the game is loaded/unloaded.
https://github.com/dcs-liberation/dcs_liberation/issues/2039 Partial fix for https://github.com/dcs-liberation/dcs_liberation/issues/2045 (now works in the new map, old one not fixed yet).
This commit is contained in:
@@ -10,15 +10,10 @@ router: APIRouter = APIRouter(prefix="/tgos")
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def list_tgos(game: Game = Depends(GameContext.get)) -> list[TgoJs]:
|
||||
tgos = []
|
||||
for control_point in game.theater.controlpoints:
|
||||
for tgo in control_point.connected_objectives:
|
||||
if not tgo.is_control_point:
|
||||
tgos.append(TgoJs.for_tgo(tgo))
|
||||
return tgos
|
||||
def list_tgos(game: Game = Depends(GameContext.require)) -> list[TgoJs]:
|
||||
return TgoJs.all_in_game(game)
|
||||
|
||||
|
||||
@router.get("/{tgo_id}")
|
||||
def get_tgo(tgo_id: UUID, game: Game = Depends(GameContext.get)) -> TgoJs:
|
||||
def get_tgo(tgo_id: UUID, game: Game = Depends(GameContext.require)) -> TgoJs:
|
||||
return TgoJs.for_tgo(game.db.tgos.get(tgo_id))
|
||||
|
||||
Reference in New Issue
Block a user