1006 Commits

Author SHA1 Message Date
Dan Albert
469b1e5efe Reimplement aircraft retreats for captured bases. 2021-08-28 18:02:11 -07:00
Dan Albert
5fae178081 Reduce squadron location bookkeeping. 2021-08-28 17:59:56 -07:00
Dan Albert
4715773bba Store the owning coalition in ControlPoint.
This is needed fairly often, and we have a lot of Game being passed
around to ControlPoint methods specifically to support this. Just store
the owning Coalition directly in the ControlPoint to clean up. I haven't
cleaned up *every* API here, but did that aircraft allocations as an
example.
2021-08-28 16:40:55 -07:00
Magnus Wolffelt
056e6b28da
Simplify and rename TACAN registry reserve function (#1559)
* Simplify and rename TACAN registry reserve function

* Remove unused tacan error
2021-08-18 14:46:55 +02:00
Magnus Wolffelt
34ff5fbc6a Allow operation.py to ignore TACAN rules 2021-08-18 00:06:34 +02:00
Magnus Wolffelt
f63a35b1fa
Use TACAN channels more selectively, use pytest (#1554)
* Use TACAN channels more selectively

* Increase tacan range to 126

* Use pytest and add workflow

* Skip faction tests due to outdated test data

* Run mypy on tests directory also

* Use iterators for bands AND usages, add tests
2021-08-17 23:14:54 +02:00
Magnus Wolffelt
8f5b6f58d1 Add rmul to distance and speeds, so that reversed operands work 2021-08-16 10:38:26 +02:00
Dan Albert
4423288a53 Assign aircraft to squadrons rather than bases.
This is needed to support the upcoming squadron transfers, since
squadrons need to bring their aircraft with them.

https://github.com/dcs-liberation/dcs_liberation/issues/1145
2021-08-15 17:42:56 -07:00
Dan Albert
357487b767 Remove random purchase pessimization.
Aircraft variety is now handled by explicit squadron selection, so no
longer needed.
2021-08-14 21:46:27 -07:00
Dan Albert
90ad1f4a61 Change squadrons to operate out of a single base.
https://github.com/dcs-liberation/dcs_liberation/issues/1145

Currently this is fixed at the start of the campaign. The squadron
locations are defined by the campaign file.

Follow up work:

* Track aircraft ownership per-squadron rather than per-airbase.
* UI for relocating squadrons.
* Ferry missions for squadrons that are relocating.
* Auto-relocation (probably only for retreat handling).

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1138
2021-08-14 21:46:27 -07:00
Dan Albert
d2e22ef8bf More campaign loader cleanup. 2021-08-14 13:39:27 -07:00
Magnus Wolffelt
103675e5bb
Make some paths cross-platform compatible (#1543)
* Make some paths cross-platform compatible

* Fix lint error for Path
2021-08-14 21:45:23 +02:00
RndName
b5b0d82a1a
Open all files with utf-8 encoding
- will not be used for binary read/writes (rb,wb)!
- prevents a bug where units with special characters in the unit name can not be tracked anymore as there will be a name mismatch due to wrong encoding
2021-08-14 13:10:43 +02:00
RndName
ee8e8d4a9a
Fix selling of units not visible
allow pending_deliveries to become negative again but still delete the delivery when the amount of a specific unit_type comes to exactly 0 to prevent emtpy group sizes
2021-08-12 19:42:40 +02:00
Dan Albert
88d52003b3 Allow using yaml for campaign definitions.
JSON continues to be supported as well. No additional work needed here,
just needed to allow both.
2021-08-10 18:21:52 -07:00
Dan Albert
6c7b62b8b1 Move MizCampaignLoader out of conflicttheater.py.
Also removes the useless `size` and `importance` fields from
`ControlPoint`.
2021-08-10 18:21:26 -07:00
Dan Albert
91daabc9d2 Fixup auto-assignable tasks when limits change.
The air wing config was fixing the main `mission_types` field, but the
`auto_assignable_mission_types` property had already been set. Update
that field whenever the `mission_types` are changed.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1515
2021-08-07 14:04:32 -07:00
Kangwook Lee
def5454e5f Add battle damage assessment option 2021-08-07 13:11:10 -07:00
Kangwook Lee
72d83e2fe4 Reorganize setting fields to match UI 2021-08-07 13:00:22 -07:00
RndName
b67fd16081
tweak the airlift procurement
- only buy airlift capable aircraft if there is one friendly cp without a factory which can only be reached via airlift
- prevent that an airlift procurement gets fulfilled at a different cp than the requesting one. this ensures that the cp also has a factory to produce ground units which can then be transported
- fixes an infinite buy loop if the fulfilling cp has no factory and the requesting cp has no space for airlift
- have always 2 reserve transport planes at the biggest CP
2021-08-05 22:09:53 +02:00
Magnus Wolffelt
9792c17c69
Make arid theaters more likely to have clouds, and tweak others sliiightly (#1501) 2021-08-05 13:54:42 +02:00
Magnus Wolffelt
30801dff9f
Use more sensible patrol speeds for CAP, and fix is_helo (#1492)
* Use more sensible patrol speeds for CAP, and fix is_helo
2021-08-03 12:22:55 +02:00
Magnus Wolffelt
6621421a6f Tweak max-speed-based patrol altitudes 2021-08-01 15:21:32 -07:00
Dan Albert
edf95ea9fb Dedup purchase requests.
Since the theater commander runs once per campaign action, missions that
do not have aircraft available may be checked more than once a turn.
Without deduping requests this can lead to cases where the AI buys
dozens of tankers on turn 0.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1470
2021-08-01 15:17:43 -07:00
Magnus Wolffelt
a3e3e9046f Estimate preferred patrol altitude based on max speed 2021-08-01 12:15:15 -07:00
RndName
04cdb6fbfc fix for wrong patrol speed 2021-08-01 12:05:28 -07:00
Dan Albert
73ba7933da Assign laser codes to players with TGPs.
This doesn't configure the bombs in the mission or anything yet; it only
pre-assigns a laser code for the player to use if they choose to.
2021-07-31 16:49:58 -07:00
bgreman
fc45c3b98c
Fixes an unlikely bug with JTAC laser code allocation (#1477)
* Fixes an unlikely bug with JTAC laser code allocation, allows for future allocation of codes to a/c with TGPs

* Fixing typing issues

* Changelog
2021-07-31 18:44:16 -04:00
Dan Albert
971d7e730a Add ALIC codes for the tin shield and NASAMS.
https://github.com/dcs-liberation/dcs_liberation/issues/1448
2021-07-31 13:53:04 -07:00
Dan Albert
db51384b63 Add auto-generation warning to files. 2021-07-31 13:40:04 -07:00
RndName
ac088ea692 improved the validation for planned transfers
- instead of only checking if the transfer destination was captured it now checks if there is a valid route between origin and destination. This also ensures that there will be a check if the current position or next_stop was captured and therefore the transfer should be disbanded.
- disband uncompletable transfer before planning or performing (also when user cheated a base capture)
2021-07-31 13:27:48 -07:00
Dan Albert
8d68c10905 Set up JTAC channel assignments. 2021-07-31 13:00:14 -07:00
Kangwook Lee (이강욱)
0370aa8df5
Add AFAC task to JTAC unit.
This causes the JTAC unit that's used for autolase to also work as
a FAC over the radio.
2021-07-31 12:37:18 -07:00
bgreman
58c96e1329
Adds more details to frontline movement logging (#1465)
* adds more detailed logging for frontline movement

* Fixing attribute name

* Fixing if, adding else
2021-07-31 12:05:22 -04:00
Magnus Wolffelt
4c51b4b822
Seasonal weather types per theater.
Adjusts the weather conditions per theater and  per season.
2021-07-31 03:57:23 -07:00
RndName
67fa4a8910
fix generation of empty transfer during cp capture
when a cp capture happens and the next cp has pending unit deliveries then they will be redeployed to the newly captured cp. The redeploy was drecreasing the num of pending unit deliveries for the old cp but was not removing them completly from the dict when all were removed
2021-07-25 15:24:16 +02:00
bgreman
1094085872
Fixes #1449 and updates another area where the Heading class can apply (#1451) 2021-07-22 15:30:46 -04:00
Dan Albert
edbd3de4a4 Bump campaign version to 8.0 for latest DCS.
Building IDs changed again. Ack the change in my two campaigns which
don't use these target types.
2021-07-21 17:10:29 -07:00
bgreman
91d430085e
Addresses #478, adding a heading class to represent headings and angles (#1387)
* Addresses #478, adding a heading class to represent headings and angles
Removed some unused code

* Fixing bad merge

* Formatting

* Fixing type issues and other merge resolution misses
2021-07-21 10:29:37 -04:00
Dan Albert
ce01ad2083 Default to aircraft at only appropriate bases. 2021-07-18 17:12:34 -07:00
Dan Albert
c2951e5e41 Increase minimum hold distance.
The previous values were far too optimistic for a non-AB climb to hold
altitude, especially for the AI.
2021-07-18 14:52:12 -07:00
Dan Albert
e22e8669e1 Add fallback locations for join zones.
It's rare with the current 5NM buffer around the origin, but if we use
the hold distance as the buffer like we maybe should it's possible for
the preferred join locations to fall entirely within the home zone. In
that case, fall back to a location within the max-turn-zone that's
outside the home zone and is nearest the IP.
2021-07-18 14:52:12 -07:00
Dan Albert
c11c6f40d5 Add minimum fuel per waypoint on the kneeboard. 2021-07-17 19:51:55 -07:00
Dan Albert
4c0a97e62f Log a warning for unknown max ranges. 2021-07-17 17:27:40 -07:00
Dan Albert
c65ac5a7cf Move mission range data into the aircraft type.
The doctrine/task limits were capturing a reasonable average for the
era, but it did a bad job for cases like the Harrier vs the Hornet,
which perform similar missions but have drastically different max
ranges. It also forced us into limiting CAS missions (even those flown
by long range aircraft like the A-10) to 50nm since helicopters could
commonly be fragged to them.

This should allow us to design campaigns without needing airfields to be
a max of ~50-100nm apart.
2021-07-17 16:34:13 -07:00
Dan Albert
04a8040292 Prevent carriers from claiming most TGOs.
The naval CP generators will only spawn ships, so if any of the other
TGO types were closest to the CV or LHA they just would not be
generated.
2021-07-17 16:34:13 -07:00
Dan Albert
9bb8e00c3d Allow configuration of the air wing at game start.
After completing the new game wizard but before initializing turn 0,
open a dialog to allow the player to customize their air wing. With this
they can remove squadrons from the game, rename them, add players, or
change allowed mission types. *Adding* squadrons is not currently
supported, nor is changing the squadron's livery (the data in pydcs is
an arbitrary class hierarchy that can't be safely indexed by country).

This only applies to the blue air wing for now.

Future improvements:

* Add squadron button.
* Collapse disable squadrons to declutter?
* Tabs on the side like the settings dialog to group by aircraft type.
* Top tab bar to switch between red and blue air wings.
2021-07-17 14:29:04 -07:00
Dan Albert
f2dc95b86d Fix typo. 2021-07-16 22:43:59 -07:00
Dan Albert
28f98aed88 Migrate pressure to a typed unit. 2021-07-16 22:38:41 -07:00
Dan Albert
8e977f994f Remove LGBs from degraded loadouts without TGPs.
This only takes effect for default loadouts. Custom loadouts set from
the UI will allow LGBs. In the default case there will not be buddy-lase
coordination so we should take iron bombs instead.

Also adds single/double Mk 83 and Mk 82 weapon data to accomodate this.
2021-07-16 18:34:41 -07:00