mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Remove another hand written API model.
There are still two more of these that don't show up in openapi.json because they don't show up in HTTP routes (only in the websocket): * GameUpdateEvents * FrozenCombat I'm not sure if there's a way to forcibly include those in the openapi.json, if I should add a no-op API to force it to happen, or if I should just ignore it. For now I'm going with option 3.
This commit is contained in:
parent
4b4336391a
commit
d7e62d0b0b
@ -1,4 +1,4 @@
|
||||
import Game from "./game";
|
||||
import { Game } from "./liberationApi";
|
||||
import { createAction } from "@reduxjs/toolkit";
|
||||
|
||||
export const gameLoaded = createAction<Game>("game/loaded");
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
import {
|
||||
ControlPoint,
|
||||
Flight,
|
||||
FrontLine,
|
||||
NavMeshes,
|
||||
SupplyRoute,
|
||||
Tgo,
|
||||
ThreatZoneContainer,
|
||||
} from "./liberationApi";
|
||||
import { LatLngLiteral } from "leaflet";
|
||||
|
||||
export default interface Game {
|
||||
control_points: ControlPoint[];
|
||||
tgos: Tgo[];
|
||||
supply_routes: SupplyRoute[];
|
||||
front_lines: FrontLine[];
|
||||
flights: Flight[];
|
||||
threat_zones: ThreatZoneContainer;
|
||||
navmeshes: NavMeshes;
|
||||
map_center: LatLngLiteral | null;
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
import { AppDispatch } from "../app/store";
|
||||
import { gameLoaded, gameUnloaded } from "./actions";
|
||||
import backend from "./backend";
|
||||
import Game from "./game";
|
||||
import { Game } from "./liberationApi";
|
||||
|
||||
export default function reloadGameState(
|
||||
dispatch: AppDispatch,
|
||||
@ -17,7 +17,7 @@ export default function reloadGameState(
|
||||
}
|
||||
const game = response.data as Game;
|
||||
if (ignoreRecenter) {
|
||||
game.map_center = null;
|
||||
game.map_center = undefined;
|
||||
}
|
||||
dispatch(gameLoaded(game));
|
||||
});
|
||||
|
||||
@ -443,7 +443,7 @@ export type Game = {
|
||||
flights: Flight[];
|
||||
threat_zones: ThreatZoneContainer;
|
||||
navmeshes: NavMeshes;
|
||||
map_center: LatLng;
|
||||
map_center?: LatLng;
|
||||
};
|
||||
export type MapZones = {
|
||||
inclusion: LatLng[][];
|
||||
|
||||
@ -25,7 +25,7 @@ class GameJs(BaseModel):
|
||||
flights: list[FlightJs]
|
||||
threat_zones: ThreatZoneContainerJs
|
||||
navmeshes: NavMeshesJs
|
||||
map_center: LeafletPoint
|
||||
map_center: LeafletPoint | None
|
||||
|
||||
class Config:
|
||||
title = "Game"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user