1574 Commits

Author SHA1 Message Date
Nosajthedevil
8523c11357
Support for the updated F-4B/C mod (#2769)
Updated the F4.py pydcs extension to match the updated F-4B/C mod and
reworked the standard payloads to add "clean" to new F-4B pylons 11 and
12.

This includes a workaround to allow Liberation to use the new VSN F-4B
weapons with combined 2x Aim-9js on pylons 3 and 9 underslung with bombs
on ters on new pylons 11 and 12. In mission editor the combined weapons
are selected in pylons 3 and 9 and their under-slung counterparts are
forced onto 11 and 12 using "required" arguments in the mod's lua. All
other pylon 3 and 9 weapons use "required clean" arguments. Liberation
doesn't have a way to force these linkages onto pylons 11 and 12 and
without them, even without clean, no weapons will load on 3 and 9 or 11
and 12.

The workaround for normal weapons on the F-4B is to set the standard
load-outs to "clean" on pylons 11 and 12. This allows all normal weapons
to work on pylons 3 and 9 so long as pylons 11 and 12 are left as Clean.
It also allows Clean into the Liberation dropdown so it can be selected
later if necessary.

The workaround for the 4 new weapons that combines pylons 3 with 11 and
9 with 12 is that the user has to use the matching pair on each set of
pylons. For example - if F4B_LAU105_AIM9J_2_BRU42A_MK82_3 is selected
for pylon 3, BRU 42A MK823 LAU105 AIM9J2 must be selected for pylon 11.
Failure to do this correctly doesn't crash liberation or DCS, the result
will just be either no weapons at all on either pylon or the underslung
weapons on 11 and 12 floating without a pylon attaching it to the plane.

When updating f4.py in the future, note that running the pydcs database
export doesn't pull any data for Pylons 11 and 12. Those matching
weapons / classes have to be manually defined in those pylons for the
F-4B. This is noted in f4.py.
2023-03-24 18:41:03 -07:00
Dan Albert
b860d72c2d Prevent transfer splitting from leaving empty units.
If the transport were able to move exactly the quantity of units of the
given type remaining in the transfer without moving the whole order, the
transfer order would be left with instructions to transfer zero of that
unit. That's an invariant violation, and was resulting in _later_
transfers attempting to create a convoy with zero units, which pydcs
rightly rejects.

For example: if 2 Abrams and 2 Paladins are ordered to transfer from a
disconnected FOB to a distant location that is connected by road, and
only two cargo slots are available, that transfer could be split into:

```
{
    Abrams: 2
}
```

and

```
{
    Abrams: 0,
    Paladin: 2
}
```

Depending on the route, those airlifted units might end up still needing
road transit (we prefer short airlifts rather than direct routes because
it gives the player more opportunities to intercept enemy convoys). The
current turn would airlift the Abrams-only group and the Paladin group
would wait. On the next turn the Abrams would travel by road and the
Paladins would be airlifted. On the _third_ turn, the Paladins (and zero
Abrams) would generate an invalid convoy.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2761.
2023-03-18 14:03:41 -07:00
Dan Albert
bcb7d059c0 Tolerate saving when temp is on another FS.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2748.
2023-03-14 16:21:24 -07:00
Dan Albert
bc0dacf974 Fix saving of saves from other machines.
Need to reset the persisted save paths on load, since the file that was
loaded may have been moved since it was saved and the original location
may no longer be accessible.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2756.
2023-03-13 19:41:28 -07:00
Dan Albert
2d9b0177ec Add channel naming for the warthogs.
The manual for the legacy warthog usually calls these VHF 1/2 and UHF,
or VHF AM/FM and UHF. The AM/FM nomenclature is what I usually hear
people call them and it's clearer, so go with that.

For the A-10C II, that manual hasn't been updated for the AN/ARC-210
yet, so I'm not really sure what that ought to be called. The UFC calls
it COM 1 though, so I went with that. The alternative would be something
like VHF/UHF for the 210 and UHF for the 164, but I don't know if that's
actually better. Could be completely explicit and call them by their
full names, but that's probably less clear to people that aren't
fiddling with the radio implementation constantly (and even I confuse
the 164 and the 186 all the damn time).
2023-03-13 18:48:20 -07:00
Dan Albert
7b35a749e2 Prevent past startup when adding new flights.
When a new flight is added to a package, if the TOT is early enough the
new flight might have a startup time in the past. Clamp the TOT when
adding new flights to the package to avoid this.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2023-02-06 00:47:53 -08:00
Dan Albert
23ac510d26 Don't allow changing TOT for started packages.
https://github.com/dcs-liberation/dcs_liberation/issues/1680
2023-02-06 00:33:08 -08:00
Dan Albert
ba10298dbc Allow adjusting TOTs after sim start.
This makes the start time in WaitingForStart dynamic, which is more
expensive but probably still cheap enough.

It also checks that the new TOT will not result in a start time in the
past when the player changes the TOT.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2023-02-06 00:33:08 -08:00
Raffson
b41ef0ab13 Fix heli spawn/landing at FOB/FARP
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2719.

(cherry picked from commit 34de855b8f889b72406c101d0cea385988e24bf9)
2023-02-05 14:09:01 -08:00
Dan Albert
c33a0d5deb Don't generate runway data for heliports.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2710.
2023-02-05 13:19:18 -08:00
Nosajthedevil
70b9d4c174 Add VSN F-4 Mod Support
Added VSN F-4 Mod support
2023-02-02 17:15:21 -08:00
Dan Albert
eea98b01f6 Fix invalid tanker planning.
All three refueling missions share a common task type and differentiate
their behavior based on the type and allegiance of the package target.
This means that if the theater commander identifies a carrier as the
best location for a theater refueling task, a recovery tanker will be
planned by mistake.

If this happens on a sunken carrier, mission generation will fail
because a recovery tanker cannot be generated for a sunken carrier.

Fix the crash and the misplanned theater tanker by preventing the
commander from choosing fleet control points as refueling targets.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2693.
2023-01-28 12:57:03 -08:00
Dan Albert
be2ad226f4 Export game.persistence.mission_path_for.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2699.
2023-01-27 16:52:45 -08:00
Dan Albert
0f34946127 Restructure save games into a zipped bundle.
This is the first step toward bundling all assets related to a save game
into a single item. That makes it easier to avoid clobbering "temporary"
assets from other games like the state.json, but also makes it easier
for players to file bug reports, since there's only a single asset to
upload.

This is only the first step because so far it only includes the various
save files: start of turn, end of last turn before results processing,
and "latest" (the game saved explicitly by the player).
2023-01-16 13:59:16 -08:00
Dan Albert
4b542b70ae Fix post-results "last turn" save. 2023-01-04 15:15:56 -08:00
Dan Albert
9cb641bddf Allow flights to self-initialize.
This makes it possible to add new packages to a running sim.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2023-01-04 12:58:36 -08:00
Dan Albert
7a8b3591cd Add locking to some UI actions.
This is by no means complete. The bugs that this solves were already in
6.x, but we'd hidden the speed controls for the sim in that release, and
have always said that anything done after pressing "go" the first time
is undefined behavior. This is the first step on making those mid-sim
actions behave correctly.

UI actions such as creating a new package need to be executed between
ticks of the sim. We can either do this synchronously by blocking the UI
until the tick is done executing, acquiring a lock on the sim, executing
the action, then releasing the lock; or asynchronously by queueing
events and letting the sim execute them when it completes the current
tick (or instantly if the sim is paused).

Anything that comes from the new UI (currently just the map) must be
asynchronous because it goes through the REST API, but for the old UI
it's simpler (and because the lock will only be acquired as quickly as
the user can act, shouldn't slow anything down) to do this
synchronously, since it's difficult to use coroutines in Qt.

https://github.com/dcs-liberation/dcs_liberation/issues/1680
2023-01-04 12:58:36 -08:00
Dan Albert
fd2ba6b2b2 Convert TOTs to datetime.
https://github.com/dcs-liberation/dcs_liberation/issues/1680
2023-01-04 12:58:36 -08:00
Dan Albert
a1af4e563a Python 3.11 compatibility.
https://docs.python.org/3/library/asyncio-task.html#asyncio.wait says:

> Changed in version 3.11: Passing coroutine objects to wait() directly
> is forbidden.
2022-12-29 17:47:49 -08:00
Dan Albert
306971230b Update to PySide6.
It sounds like PySide2 will not be moving to Python 3.11, so we're stuck
on 3.10 without this. Upgrading to a newer Qt also fixes some high DPI
bugs (the file browser dialog for save/load is no longer tiny on 4k).

https://github.com/pyinstaller/pyinstaller/issues/5414 previously
blocked this, but the bug appears to be fixed now.
2022-12-29 16:26:50 -08:00
Dan Albert
4aa42e6573 Remove isinstance use in flight support data.
mypy struggles to prove this cast correct when there are two or'd
isinstance checks where both types coincidentally have properties of the
same name (but no defined protocol making that explicit). I'm not really
sure why mypy is happy with this in its current state, but it isn't
after a change I'm making.

All our isinstance use is a bit of an anti-pattern anyway, so extract a
method that exposes the data we care about.

The start/end times for tankers aren't actually used, so this could be
simplified even more, but that data _should_ be used.
2022-12-28 14:02:31 -08:00
SnappyComebacks
321de8d4ec
Set units on the frontline to Hidden On MFD. (#2669)
All groups (friendly and enemy) that are part of the front line are set
to `Hidden On MFD`. This is a group level filter, and can not be applied
on a per unit basis.
2022-12-28 14:19:33 -07:00
Dan Albert
5db82f733f Revert "Fix for orbit's broken stop condition"
ED fixed the bug.

This reverts commit 73ee2ba4c0308f5dc00be27a1c1586c4696fda71.
2022-12-28 12:28:39 -08:00
RndName
f9903f1e19 Only check for ground units in capture trigger zone
requires pydcs update: https://github.com/pydcs/dcs/pull/279
2022-12-21 13:04:09 -08:00
RndName
4a4935f165 Change iads command unit type 2022-12-21 13:04:09 -08:00
RndName
09f92cc5e4 Only add skynet iads command unit when advanced iads is in use 2022-12-21 13:04:09 -08:00
Dan Albert
55037626a4 Add Blackshark 3 to the mission planning DB.
https://github.com/dcs-liberation/dcs_liberation/issues/2657
2022-12-21 12:29:45 -08:00
Dan Albert
fc3e72bacf Fix type-only import that needs to be real.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2660.
2022-12-21 12:26:41 -08:00
SnappyComebacks
0fd0f0e7c0
Recovery tanker follow up (#2659)
Fix timing issues for RecoveryTankerFlightPlan.

AEWC and Refueling can be planned on LHA.
2022-12-20 21:47:50 -07:00
Dan Albert
22503d4e95 Save the last turn for bug reports.
We often get save games uploaded with bug reports that are already in a
broken state with nothing we can do about it. This saves that turn to
`last_turn.liberation` so users are less likely to have clobbered the
useful data before filing the report.
2022-12-20 13:46:21 -08:00
SnappyComebacks
9a81121ac1
Recovery Tanker for carriers. (#2649)
Implement recovery tankers for carriers.

UnitMap gets a little more data to store.  Recovery tankers depend on the unit map.
2022-12-19 21:08:19 -07:00
Dan Albert
f3f5ab70ea Add HMS Invincible as a valid runway. 2022-12-13 00:05:44 -08:00
Dan Albert
20937815f8 Fix CAS not having landing waypoints.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2611.
2022-12-03 16:30:51 -08:00
SnappyComebacks
1b828b95b3 Add F-15E to DEAD_CAPABLE in AI flight planner. 2022-11-26 09:47:08 -07:00
Dan Albert
5e7e5e2636 Unfilter the custom waypoint targets.
There doesn't appear to be any reason for us to be poking at
implementation details here aside from changing the name from "unit" to
"building" for that case. Just iterate over the known strike targets.

Making this change uncovered some latent type errors.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2564.
2022-11-25 14:14:38 -08:00
Dan Albert
e208df16b2 Add radios for the MB-339A.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2511.
2022-11-25 14:07:56 -08:00
RndName
fc9ad5b519 Remove dcs capture event from state json
With the latest change we added capture zones and corresponding trigger rules for all Airfields as well so we do not need to rely on the dcs capture event S_EVENT_BASE_CAPTURED anymore.
2022-11-24 11:14:50 +01:00
RndName
40ddad1d9a Add Airfield to list of capture zone types
This will create capture zones and the trigger rules to check for a base capture. Will fix an issue where the dcs capture event is not fired and therefore the capture not recognized by liberation
2022-11-24 11:14:50 +01:00
RndName
eb997db703 Fix carrier group generation 2022-11-23 12:57:43 +01:00
MetalStormGhost
e53dc5b80b Attempt at fixing Carrier killed in state.json but not being removed from game, issue #2405. GenericCarrierGenerator.generate() will now generate the ship group with an array that only contains alive ship units, just like GroundObjectGenerator.generate() has previously done.
Carrier groups will now also show up as destroyed/damaged on the map when the carrier is sunk.
2022-11-23 12:57:43 +01:00
RndName
ab64655f05 Validate primary and secondary nodes for iads network 2022-11-21 12:13:49 +01:00
RndName
e1b530e4fc Fix IADS network error caused by dead groups
Fixed an error which would occur when dead units which are non static would be added as secondary node during the skynet lua data generation. This should in general not be possible as connection nodes and power sources are currently most of the time static.
2022-11-21 12:13:49 +01:00
Dan Albert
35adcd2c7f Move develop forward to 7.0. 2022-11-20 12:57:42 -08:00
Dan Albert
1a255969a7 Fix drop zone display for air assault.
Troops must be dropped inside this zone or they won't attack the target.
The zone needs to be drawn in the map so players don't break the flight
plan by accidentally moving the drop waypoint outside the DZ.

I've move the API for doing this out of `PatrollingFlightPlan` in favor
of a mixin so this is no longer presented as `engagement_distance` by
the flight plan. I don't love that it's still the `commit-boundary`
endpoint, but it's fine for now.

I don't know why mypy wasn't able to catch this. pycharm is also
struggling to understand this class.
2022-11-20 11:39:56 -08:00
Dan Albert
d5e91c7168 Add MB-339A to CAS and runway attack roles.
https://github.com/dcs-liberation/dcs_liberation/issues/2511
2022-11-19 19:24:50 -08:00
Dan Albert
670683b47f Fix typo. 2022-11-19 18:47:46 -08:00
Dan Albert
7b50894ca6 Fix adding and removing waypoints in the UI.
This moves more of the logic out of the UI so mypy can actually spot
these mistakes more often.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2495.
2022-11-19 15:39:41 -08:00
Dan Albert
7dfd99a0b0 Add bug link for refuelzonegeometry. 2022-11-19 15:20:08 -08:00
Dan Albert
c78e6dc231 Remove refueling from sweep flights.
The timing for these doesn't work. Sweep RTBs at the same time the
package reaches its TOT. The tanker won't be on station until 1m30s
before the package reaches the refueling point.
2022-11-19 13:23:36 -08:00
Dan Albert
93f3e81cfc Fix layout for TARCAP, Escort, and strike-like.
If there's a refuel point, nav from that, not from the patrol end/split.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1749.
2022-11-19 13:23:36 -08:00