108 Commits

Author SHA1 Message Date
Dan Albert
ef69275f34 Don't send the selected flight plan to the back.
We want the selected flight plan to show on top of all the other flight
plans, and because we can't properly z-order with the other elements of
the map (see the code comment), this is probably the best we can do.

This means that the selected flight will be drawn on top of the front
line again, and will in some cases intercept mouse clicks meant for the
front line, but it's much less of a problem than when all the paths were
drawn on top.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3305.
2023-12-21 15:43:12 -08:00
Dan Albert
1efce862fb Send flight plan paths to the back of the map.
This fixes the unusual case where the `interactive: false` property had
no effect, which would make it impossible to plan missions against UI
elements that were overflown by many flights (such as the front line).

As an added bonus, it looks a bit nicer.

This impacts the test in an odd way, but the cure for that is probably
rewriting the test to not use a mock now that we've figured out how to
do that.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3295.
2023-12-18 20:16:08 -08:00
Dan Albert
6b6c4f4112 Migrate IP placement to WaypointSolver. 2023-08-08 21:46:52 -07:00
Dan Albert
19976989ca Improve IP selection near threat zone centers.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2754.
2023-07-11 22:16:18 -07:00
Dan Albert
de8d42e3e5 Test (most of) the rest of WaypointMarker.
There isn't any UI observable behavior of the dragend of the waypoint,
but we can test that the backend was called. The only uncovered parts of
that component are now error paths, but the error handling in that
component is to just ignore errors, so there's also nothing to test
there.
2023-06-28 22:44:02 -07:00
Dan Albert
374759df0f Test most of WaypointMarker.
Unlike the other map tests which heavily rely on mocks, this one uses
React refs to inspect the constructed leaflet objects. The DOM itself
doesn't appear to contain anything worth testing against (react-leaflet
rendering doesn't work like typical React rendering).

This required some infrastructure changes:

1. Forwarded ref from WaypointMarker to Marker so the test can observe
   it. Added a mergeRefs helper (and its own tests) to make that easier.
2. Switched from identity-obj-proxy to jest-transform-stub, because the
   former doesn't produce a useable image for imports, and we need
   usable images for leaflet to be able to render.

This doesn't yet test drag and drop behavior since that requires mocking
the backend, and this commit is already complicated enough. That'll be
next.
2023-06-27 22:41:33 -07:00
Dan Albert
f1e9abd157 Test SupplyRoute. 2023-06-27 00:28:07 -07:00
Dan Albert
eeacc79cb6 Add test for SplitLines. 2023-06-26 23:53:38 -07:00
Dan Albert
cf985d3d37 Test NavMeshLayer. 2023-06-16 22:18:46 -07:00
Dan Albert
1044a1f45f Test FrontLinesLayer. 2023-06-16 22:05:12 -07:00
Dan Albert
09417322e7 Partial tests for FrontLine.
We need to mock the backend to usefully test the contextmenu handler.
I'd like to finish all the low hanging fruit before going for that.
2023-06-16 21:39:50 -07:00
Dan Albert
136a9b5f02 Test FlightPlansLayer. 2023-06-16 11:18:16 -07:00
Dan Albert
02f22d4930 Test CullingExclusionZones. 2023-06-16 10:35:31 -07:00
Dan Albert
b1af6dfbe1 Test ControlPointsLayer. 2023-06-15 22:50:39 -07:00
Dan Albert
647d1f57f9 Add tests for CombatLayer. 2023-06-15 22:50:39 -07:00
Dan Albert
3c8d0b023e Test Combat. 2023-06-15 22:24:37 -07:00
Dan Albert
adceb3a224 Add tests for AirDefenseRangeLayer. 2023-06-15 21:58:05 -07:00
Dan Albert
380d6551be Add tests for AircraftLayer. 2023-06-06 07:08:57 +00:00
Dan Albert
a7d2eca209 Add a test for the Aircraft component.
Leaflet (or maybe react-leaflet?) isn't very testable, so we can really
only test that mocks were called with the right props for the leaflet
components we expect, but that's still better than nothing.
2023-05-04 01:18:45 -07:00
Dan Albert
eee0039add Key the PrimaryMarker with destination presence.
This is how React recommend dealing with derived state that needs to be
reset:
https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html

The problem is that the new turn will give the component new props, but
new props will not cause the state to be reset. We can either do that
manually (which React recommends only for the cases where it is
absolutely necessary:
https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops),
or by forcing the component to be replaced by using a key.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2388.
2022-10-09 16:25:35 -07:00
Dan Albert
c9d49f6f40 Split up the ControlPoint.tsx monolith.
This is in need of some serious refactoring so that
https://github.com/dcs-liberation/dcs_liberation/issues/2388 can be
fixed.
2022-10-09 16:25:35 -07:00
Dan Albert
0f5e35a2eb Factor out control point location event behavior. 2022-10-09 16:25:35 -07:00
Dan Albert
979851aac9 Document primary/secondary CP marker behavior. 2022-10-09 16:25:35 -07:00
Dan Albert
3a2eb182f9 Fix the react app initialization.
ReactDOM.render is deprecated and using it forces react 17 behavior.
2022-10-09 16:25:35 -07:00
Dan Albert
c835cda5b6 Update NPM dependencies.
New versions of react and leaflet, along with a lot of other packages.
I'm hoping that the newest react-leaflet might let use solve the carrier
drag and drop issues in a less hacky way, since that's the cause of
https://github.com/dcs-liberation/dcs_liberation/issues/2388.
2022-10-07 13:33:53 -07:00
Dan Albert
6295f3fd71 Fix the react test.
It's still a useless test, but now it passes.
2022-10-07 13:33:53 -07:00
Dan Albert
67dcc6e7f5 Double the front line thickness.
Make it easier to click on.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2437.
2022-09-28 11:03:50 -07:00
Dan Albert
edd162c3d2 Add missing type annotation.
Caught by newer versions of typescript.
2022-09-27 22:07:58 -07:00
Dan Albert
cc5c625a99 Fix rendering of join permissible zones.
The zones themselves are supposed to be unstroked because we only want
to stroke the boundaries of the zone that are preferred.
2022-09-09 15:12:19 -07:00
Dan Albert
080782e011 Support polygons with holes in the API.
We don't have any of these yet because our landmaps suck, but we'll need
holes in the sea zones to mask islands correctly.
2022-09-07 14:22:26 -07:00
Dan Albert
643d1be6d7 Fix inclusion/exclusion zone reversal in UI. 2022-09-03 14:13:07 -07:00
Raffson
7355162d80
Fix combat updates in the front-end.
`setCombat` was never called, so old combats were never cleared on turn
end, game load, or unload.

https://github.com/dcs-liberation/dcs_liberation/issues/2253
2022-07-06 13:36:15 -07:00
Raffson
9823f7b96f
Push full navmesh/threatzone info in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2253
https://github.com/dcs-liberation/dcs_liberation/issues/2263
2022-07-06 13:27:06 -07:00
Raffson
a20b95bb26
Push full TGO information in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2263
2022-07-06 12:41:58 -07:00
Raffson
27dff95df5
Handle IADS updates properly.
This adds the missing events in the backend, and handles them properly in the front end.
2022-06-29 18:58:49 -07:00
Raffson
61488627a4
Push full control point information in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2263
2022-06-25 14:17:08 -07:00
Raffson
da90a40bc4
Push full front line information in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2263
2022-06-25 14:13:10 -07:00
Raffson
d578e763c0
Push full flight information in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2263
2022-06-25 14:09:51 -07:00
Raffson
289545e777
Push full unculled zone information in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2263
2022-06-25 21:09:07 +00:00
Raffson
76bc0fde33
Fix filter definitions for TGO layers.
https://github.com/dcs-liberation/dcs_liberation/issues/2253
2022-06-22 01:57:36 -07:00
Raffson
30bdcfac29 Fix eslint warning in CI 2022-06-16 09:38:29 -07:00
Raffson
ad7032064d
Add culling exclusion zones display to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2158
2022-06-14 18:57:04 -07:00
Raffson
70e5c578ae
Add the ruler to the new map.
https://github.com/dcs-liberation/dcs_liberation/issues/2158
2022-06-12 13:15:26 -07:00
Dan Albert
c5efc908de Ensure a unique ID for supply routes.
List indexes are not a reliable list key unless the list is static.
Indexes will be reused when games are loaded, which prevents the state
from updating reliably.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2167
2022-05-29 14:07:40 -07:00
RndName
5cdfe62e2d Implement advanced skynet functions
- factor out own class for the iadsnetwork within the conflicttheater
- This class will handle all Skynet related things - no specific group_name handling necessary in future
- make iadsbuilding own TGO class because SAM & EWRs are Vehicle Groups. IADS Elements dont have any groups attached.
- added command center, connection node and power source as Ground objects which can be added by the campaign designer
- adjust lua generator to support new iads units
- parse the campaign yaml to get the iads network information
- use the range as fallback if no yaml information was found
- complete rewrite of the skynet lua script
- allow destruction of iads network to be persistent over all rounds
- modified the presetlocation handling: the wrapper PresetLocation for PointWithHeading now stores the original name from the campaign miz to have the ability to process campaign yaml configurations based on the ground unit
- Implementation of the UI representation for the IADS Network
- Give user the option to enable or disable advanced iads
- Extended the layout system: Implement Sub task handling to support PD
2022-04-19 10:41:16 +02:00
Dan Albert
039ac9ec74 Replace CP integer ID with a UUID.
This allows unique identification across saves. The front-end needs to
be able to differentiate the first carrier in game A and the first
carrier in game B, but because carriers (and other non-airfield CPs) are
assigned IDs sequentially, collisions were to be expected. The front-end
can't tell the difference between a reloaded game and a new turn, so we
need to ensure different IDs across games.

This is a handy cleanup anyway, since callers constructing CPs no longer
need to manually track the CP ID counter.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2078.
2022-03-20 16:00:29 -07:00
Benjamin Fischer
e6a3bf9885
Round waypoint altitudes in tooltips.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2089.
2022-03-18 00:10:06 -07:00
Dan Albert
c5fd3df235 Fix caching behavior of flight plan data.
This is far from complete but it at least covers anything related to
flight plans.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2060
2022-03-08 18:49:41 -08:00
Dan Albert
4993353184 RTB canceled in-progress flights.
The UI won't stop you from aborting a flight that is already home, but
that should also result in it re-completing again on the next tick.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2022-03-08 01:04:19 -08:00
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