1339 Commits

Author SHA1 Message Date
Dan Albert
e36c62b30e Identify aircraft types based on their mission.
It would probably be more accurate to have the icon based on the
aircraft type and use the modifier to indicate the mission, but this
will do for now (I also might have that backwards, I can't find the
guidance because it's in STANAG 1241 which isn't free).

I also increased the icon size a bit in the UI because the longest icon
text ("SEAD") was hard to read.
2022-03-07 21:45:33 -08:00
Dan Albert
73a8ec02b2 Speed up game tick by caching TGO threat regions.
Still more could be done here by caching the merged poly at the theater
level, but this goes a long way.

Aircraft commit regions are already cached (in the FlightState), so
those are already fairly fast. The combined A2A commit boundary could
also potentially be cached at the theater level.
2022-03-07 21:19:04 -08:00
Dan Albert
453f6ac74a Include positions of dead aircraft for the UI. 2022-03-07 19:43:06 -08:00
Dan Albert
895a4eb0dc Make flight death chance not impossible.
The odds of random.random() returning exactly 1.0 are basically nil, and
that was the only way a non-solo flight could lose this.
2022-03-07 19:35:19 -08:00
Dan Albert
005090fbcd Support display of dead flights. 2022-03-07 19:34:51 -08:00
Dan Albert
053a1287c9 Fix missing key in combat display. 2022-03-07 19:33:11 -08:00
Dan Albert
f5955dafaf Roll over time in excess of the current waypoint. 2022-03-07 18:35:16 -08:00
Dan Albert
e95a9e0685 Stop ticking elapsed waypoints.
If the parent tick caused the flight to move to the next waypoint, we
shouldn't send events for the elapsed waypoint.
2022-03-07 18:19:09 -08:00
Dan Albert
ca640ebabe Move the default port to 16880.
1688 is used by MS KMS.
2022-03-07 17:56:10 -08:00
Dan Albert
baae65919f Enable configuration of the server bind address.
A serverconfig.env (or just environment variables) can be set to
override the default bind address/port for the backend. This is passed
to the front end as a query parameter.
2022-03-07 17:53:55 -08:00
Dan Albert
8c63274f57 Move the server off the default uvicorn port. 2022-03-07 00:05:45 -08:00
Dan Albert
d7e62d0b0b 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.
2022-03-06 23:44:15 -08:00
Dan Albert
6ee235545f Clean up leaflet polygon API surface. 2022-03-06 23:25:25 -08:00
Dan Albert
15176223fa Add navmesh support to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 23:07:24 -08:00
Dan Albert
dc4762a03b Add threat zone support to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 19:32:30 -08:00
Dan Albert
b7439cbd17 Add metadata to FastAPI endpoints for OpenAPI.
operation_ids give us better function names when generating the
typescript API from the openapi.json. BaseModel.Config.title does the
same for type names. Response models (or 204 status codes) need to be
explicit or the API will be declared as returning any.
2022-03-06 17:12:00 -08:00
Dan Albert
904602510d Remove API key auth; CORS is sufficient.
The React UI running in a browser can't connect to the backend without
punching a hole for CORS, which isn't done by default. We don't need the
API key to protect from browsers, and anything else running on the
user's machine that can access the backend (that's hosted on only
localhost) already has enough control to do damage without using
Liberation as an attack vector.

https://github.com/dcs-liberation/dcs_liberation
2022-03-06 01:57:12 -08:00
Dan Albert
3c9acea31c Fix CORS configuration.
We need to configure this always, but limit the allowed origins for non-
dev modes.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 01:52:06 -08:00
Dan Albert
605d8f057f Fix save loading.
https://stackoverflow.com/a/44888113/632035

Pickle can't deal with loading sets (and probably dicts) of objects with
custom __hash__ functions that depend on their state because __hash__
can be called before __setstate__. Make the hash function stupider (but
still correct) by just relying on the object ID.
2022-03-06 00:14:20 -08:00
Dan Albert
738cf1f381 Reset game state on new turn.
This may not be the way to do this long term, but it is how the old map
works so it's at least not a regression. It might be better to generate
events for the between-turn changes in state instead.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-06 00:02:25 -08:00
Dan Albert
73fcfcec7b 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).
2022-03-05 18:02:46 -08:00
Dan Albert
995e28cb32 Support mobile CPs in the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-05 15:41:58 -08:00
Dan Albert
811f46c289 Draggable waypoints with timing info.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-04 02:21:22 -08:00
Dan Albert
34111cfc67 Update all TGOs on capture.
We need to update all TGOs, not just the cleared ones, because the
captured buildings need to update their icon to show the new color.
2022-03-04 00:29:31 -08:00
Dan Albert
92236a5bc3 Update the react map for some new events. 2022-03-03 23:31:07 -08:00
Dan Albert
c5c596dc2f Move TGOs out of MapModel. 2022-03-03 17:11:01 -08:00
Dan Albert
ccb510fe47 Move front lines out of MapModel. 2022-03-03 02:17:13 -08:00
Dan Albert
e5f4974e9a Stop ad-hoc constructing FrontLines.
The UI needs to be able to identify these to the server and vice versa,
so they'll need IDs that don't change. Rather than constructing an ID
based on the control points names, make them an owned part of the
control point. The constructed ID would be fine, but a UUID will make
them more suitable for the database, and this was always fairly gross
anyway.

Some follow up work if anyone is interested: a bunch of the data that's
computed in the various properties can now probably be computed *once*
and persisted to the FrontLine type.
2022-03-03 00:38:52 -08:00
Dan Albert
d53fc46ffc All multiple event steam connections.
We don't support multi-client yet, but this is useful when debugging the
react UI in a browser instead of in the Liberation UI.
2022-03-02 23:51:12 -08:00
Dan Albert
b39a44ae37 Draw front lines on the react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 23:33:15 -08:00
Dan Albert
9a2c10a98f Draw supply routes on the react map.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 23:14:05 -08:00
Dan Albert
0bdb4ac894 Draw air defense threat/detection ranges.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 21:51:16 -08:00
Dan Albert
64b01c471b Partial implementation of TGO display.
No threat/detection circles yet.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-02 01:01:33 -08:00
Dan Albert
406a64ae3f Draw flight plan paths in the react UI.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
2022-03-01 01:14:21 -08:00
Dan Albert
4e348dd99a Add a server setting for disabling the API key.
Useful for development if you want to disable API key authentication for
debugging the server without having to pull the generated key out of the
log every time.
2022-02-28 00:31:56 -08:00
Dan Albert
0056747aee Add an endpoint for listing all control points. 2022-02-28 00:20:01 -08:00
Dan Albert
e3adcada52 Migrate air icons to milsymbol.
All NATO icons are now generated by the milsymbol library based on their
SIDC.
2022-02-27 22:25:45 -08:00
Dan Albert
02383763ec Update TGOs to use milsymbol for icons. 2022-02-27 22:13:06 -08:00
Dan Albert
e7398af877 Update ControlPoint UI to use milsymbol library.
This gets us out of the business of maintaining our own icons. The
milsymbol library generates the SVG data needed to display anything
covered by APP-6.
2022-02-27 19:10:22 -08:00
Dan Albert
41158543cf Add basic implementation for APP-6 SIDCs.
These will be used in conjunction with
https://github.com/spatialillusions/milsymbol to simplify the
specification of unit type to the front-end.
2022-02-27 18:38:59 -08:00
Dan Albert
2585dcc130 Add (very!) rough simulation of frozen combat.
There are some TODOs here but th behavior is flagged off by default. The
biggest TODO here is that the time spent frozen is not simulated, so
flights that are engaged by SAMs will unfreeze, move slightly, then re-
freeze.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2022-02-26 13:01:46 -08:00
RndName
a53812c0fb
Fix helipad creation
Only create a Farp StaticGroup when there are actual helipads. This prevents accidental creation of a helipad at the position of a carrier.
2022-02-26 21:56:42 +01:00
Dan Albert
af4a718fc7 Fix server shut down on exit.
If there's a websocket being waited on the shut down won't actually
happen. Add a new event for shut down and send it to break the websocket
out of its loop.
2022-02-25 17:12:00 -08:00
Dan Albert
2efe4f6c80 Add missing super() call. 2022-02-25 16:52:28 -08:00
Dan Albert
d6e82d44fc Fix FastAPI doc pages.
We can't directly use frozen dataclasses from pydcs in our interface
because pydantic can't process them. Pydantic is able to automatically
convert to our modelview type from the pydcs type though.
2022-02-25 16:47:41 -08:00
Dan Albert
45e76e12b6 Move FlightJs out of MapModel. 2022-02-25 01:31:07 -08:00
RndName
ad0d3412fb
Cleanup helipad creation and heli spawn 2022-02-24 23:21:17 +01:00
RndName
6f8c30ec81
Fix helicopter spawning inside each other
Also use NoParkingSlotError for better error handling if no helipads are available
2022-02-24 21:47:37 +01:00
RndName
c88fa6d2af
Fix error in mission caused by wrong farp creation 2022-02-24 21:46:05 +01:00
Dan Albert
b1356551c6 Move threat zones out of MapModel. 2022-02-22 19:59:29 -08:00