195 Commits

Author SHA1 Message Date
Simon Clark
963ab38b2e Refactor the mod select changes, re-add accidentally deleted factions. 2021-06-21 01:16:48 +01:00
Simon Clark
11069cc219 Make mod selection nicer and deprecate MB-339.
Mod selection is now done via checkbox in the new game wizard.

The MB-339 is being turned into a paid module, and the free mod no longer works, so it's been removed.
2021-06-21 01:16:41 +01:00
Marcel
0a874a28ef Fix group name for EWRs.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1246
2021-06-18 19:26:42 -07:00
Dan Albert
4c3ac0af91 Adapt to DCS update. 2021-06-17 22:58:46 -07:00
Dan Albert
09704b6f37 Add a wrapper type for ground unit info. 2021-06-17 22:09:17 -07:00
Dan Albert
4a3ef42e67 Wrap the pydcs FlyingType in our own AircraftType.
This is an attempt to remove a lot of our supposedly unnecessary error
handling. Every aircraft should have a price, a description, a name,
etc; and none of those should require carrying around the faction's
country as context.

This moves all the data for aircraft into yaml files (only one converted
here as an example). Most of the "extended unit info" isn't actually
being read yet.

To replace the renaming of units based on the county, we instead
generate multiple types of each unit when necessary. The CF-18 is just
as much a first-class type as the F/A-18 is.

This doesn't work in its current state because it does break all the
existing names for aircraft that are used in the faction and squadron
files, and we no longer let those errors go as a warning. It will be an
annoying one time switch, but it allows us to define the names that get
used in these files instead of being sensitive to changes as they happen
in pydcs, and allows faction designers to specifically choose, for
example, the Su-22 instead of the Su-17.

One thing not handled by this is aircraft task capability. This is
because the lists in ai_flight_planner_db.py are a priority list, and to
move it out to a yaml file we'd need to assign a weight to it that would
be used to stack rank each aircraft. That's doable, but it makes it much
more difficult to see the ordering of aircraft at a glance, and much
more annoying to move aircraft around in the priority list. I don't
think this is worth doing, and the priority lists will remain in their
own separate lists.

This includes the converted I used to convert all the old unit info and
factions to the new format. This doesn't need to live long, but we may
want to reuse it in the future so we want it in the version history.
2021-06-12 20:13:45 -07:00
SnappyComebacks
a53a648a63 Add plannable tankers.
This Pull Request lets users plan Tanker flights.

Features:

- Introduction of `Refueling` flight type.
- Tankers can be purchased at airbases and carriers.
- Tankers get planned by AI.
- Tankers are planned from airbases and at aircraft carriers.
- Tankers aim to be at high, fast, and 70 miles from the nearest threat.
  (A10s won't be able to tank)
- Tankers racetrack orbit for one hour.
- Optional Tickbox to enable legacy tankers.
- S-3B Tanker added to factions.
- KC-130 MPRS added to factions.
- Kneeboard shows planned tankers, their tacans, and radios.

Limitations:

- AI doesn't know whether to plan probe and drogue or boom refueling
  tankers.
- User can't choose tanker speed.  Heavily loaded aircraft may have
  trouble.
- User can't choose tanker altitude.  A-10s will not make it to high
  altitude.

Problems:

- Tanker callsigns do not increment, see attached image.  (Investigated:
  Need to use `FlyingType.callsign_dict`, instead of just
  `FlyingType.callsign`.  This seems like it might be significant work
  to do.).
- Having a flight of two or more tankers only spawns one tanker.
- Let me know if you have a solution, or feel free to commit one.

https://user-images.githubusercontent.com/74509817/120909602-d7bc3680-c633-11eb-80d7-eccd4e095770.png
2021-06-09 21:14:10 -07:00
Dan Albert
ef35ad90b8 Remove one user of UNIT_BY_TASK. 2021-06-07 18:01:31 -07:00
Dan Albert
914691eaa7 Remove more unused code from Base. 2021-06-07 17:51:25 -07:00
Dan Albert
37bb83dfa6 Delete a bunch of unused code from Base. 2021-06-07 17:48:03 -07:00
Florian
3a592aee8b Split purchase budget based on investment ratio.
The AI purchaser will aim to have a 50/50 ground/air investment mix.
This allows it to overspend on one category if significant losses were
taken the previous turn.

The total purchase amount is still limited, so if the bases are full
when only 10% of the investment is in ground units, the full budget for
the turn will still go to air.
2021-06-05 14:07:18 -07:00
Dan Albert
6094179a40 Show pending ground unit count in the base menu.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1161
2021-06-05 13:24:12 -07:00
Dan Albert
136e776b03 Add map markers for each building in the group.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1126
2021-06-04 18:07:12 -07:00
Dan Albert
8604faffe6 Make EWR sites purchasable.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/968
2021-05-31 16:33:55 -07:00
Dan Albert
45919200c4 Depopulate captured objectives.
Buildings are left to be captured, but the retreating coalition now
destroys their abandoned equipment.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1158
2021-05-31 15:43:20 -07:00
Dan Albert
284f2bc323 Show runway status on the new map.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1105
2021-05-31 14:18:27 -07:00
Dan Albert
355e6e1d15 Fix several cases of wrongly using broken runways.
The usual symptom here was the game breaking when a carrier is
destroyed. The carrier would no longer be operational but missions would
be assigned there that could not generate flight plans.
2021-05-31 14:13:33 -07:00
Dan Albert
4055b06e71 Clean up and rename ControlPoint.for_airbase. 2021-05-30 21:17:12 -07:00
Dan Albert
6616359baf Remove "base defenses" UI features.
There's no such thing any more. There are just objectives that are
closer to the CP than the others.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1130
2021-05-30 21:07:48 -07:00
Dan Albert
871e7f7a50 Remove random objective generation.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1076
2021-05-30 20:47:20 -07:00
Brock Greman
7b2bb4a128 Show ground unit supply info in the base menu.
Update the base UI to have a hint about ground unit deployment limits
and a matching tooltip for how it is calculated.
2021-05-30 13:15:06 -07:00
Florian
d61382f4e2 Maintain composition when buying ground units.
Unit composition is defined by the doctrine. The most understaffed CP
will now get the most underrepresented unit type. Previously a random
understaffed CP would get a random unit type.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1057.
2021-05-30 12:52:35 -07:00
Khopa
1af95955b6 Base menu UI : Added ammo depots & factory information (WIP UX) 2021-05-30 17:49:15 +02:00
SnappyComebacks
95b0b851a5 Limit front line size with ammo depots.
This limit is determined by the number of buildings that belong to Ammo
Depots at the front line's connected Control Point. The limit increases
for every surviving building at ammo depot objectives.

There is a lower limit to the number of units that will spawn, so that
if there are no surviving ammo depot buildings at a control point, there
will still be some ground conflict.
2021-05-29 13:25:23 -07:00
Dan Albert
e6b9a73d03 Improve AI air defense target prioritization.
Target the air defenses whose *threat ranges* come closest to friendly
bases rather than the closest sites themselves. In other words, the
SA-10 that is 5 miles behind the SA-6 will now be the priority.

This also treats EWRs a bit differently. If they are not protected by a
SAM their detection range will be used for determining their "threat"
range. Otherwise a heuristic is used to determine whether or not they
can be safely attacked without encroaching on the covering SAM.
2021-05-28 19:27:02 -07:00
Dan Albert
cea264e871 Remove special case behavior for FOB missions.
The only difference from the main CP types was that it didn't support
AEW&C (which shouldn't have been on the main ControlPoint class anyway)
and add strike.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1132
2021-05-28 18:02:57 -07:00
Dan Albert
a2abdcf5d3 Ensure that a transit path exists for recruitment.
Networks can be disconnected even by airlift because FOBs are not
airports.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1147
2021-05-28 16:28:50 -07:00
Dan Albert
f2bd7300aa Improve precision of kneeboard lat/lon.
DMS with decimal seconds is what the hornet uses for PP targest. In the
future we'll want to make this aircraft specific (and potentially user
preference for jets like the A-10 that can handle both L/L and MGRS).
2021-05-24 18:06:47 -07:00
Dan Albert
62b743025a Fix supply route clobbering, make immutable.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1083
2021-05-23 17:30:50 -07:00
Dan Albert
d15ef63182 Remove unused method of ControlPoint. 2021-05-23 17:17:59 -07:00
Dan Albert
fa321c7ddc Don't plan SEAD when only a search radar remains. 2021-05-23 13:15:42 -07:00
Dan Albert
ddd6e7d18f Improve detection of functional radar SAMs.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1109
2021-05-23 13:01:44 -07:00
Dan Albert
98e0be6be9 Revert "Correct radar detection."
We need this after all, but we do need to audit the list. Will follow
up with that fix.

https://github.com/dcs-liberation/dcs_liberation/issues/1109

This reverts commit f68935735d436385a0821e1168a8726c7dba8ebb.
2021-05-23 01:10:29 -07:00
Dan Albert
f68935735d Correct radar detection.
This list includede units without radars and also missed units with
radars. Stop curating the list and just query the unit type.
2021-05-22 15:36:56 -07:00
Dan Albert
57fe5c04ec Improve DEAD mission planning.
We don't need to include a SEAD flight in missions against EWRs or SAMs
that no longer have a radar.

Also plan DEAD missions against air defenses that have no radars.
Previously we would never finish killing launcher only sites (which
cannot defend any more, but are cheaper to return to working order than
a fully destroyed site) nor would we plan DEAD against IR SAMs or AAA.
2021-05-22 14:56:18 -07:00
Dan Albert
b6154b273c Differentiate SEAD and SEAD escorts.
SEAD suppresses the package's target. SEAD escort protects the package
from any SAM threat along its flight path.
2021-05-22 14:24:13 -07:00
Dan Albert
c0ead4a484 Add icons for CPs. 2021-05-21 23:26:15 -07:00
Dan Albert
664092c023 Remove non-CP FOBs. 2021-05-20 19:01:43 -07:00
Dan Albert
a382e74a89 Set up bullseye early, create waypoints.
Setting this up as part of the game makes it possible for us to show in
the UI.

https://github.com/dcs-liberation/dcs_liberation/issues/136
2021-05-20 18:29:35 -07:00
Dan Albert
1c32ae1227 Create default strike target implementation. 2021-05-20 16:50:01 -07:00
Dan Albert
2a77f57aa4 Improve AI strike targeting.
We were setting up all the correct *target* waypoints but the AI doesn't
use the target waypoints; they use the targets property of the ingress
waypoint. This meant that the flight plan looked correct in the UI and
was correct for players but the tasks were set up incorrectly for the AI
because building TGOs are aggravatingly multiple TGOs with the same name
in the implementation.

Mission targets now enumerate their own strike targets so that this
mistake is harder to make in the future.

This won't be perfect, the AI is still not able to parallelize tasks and
since buildings aren't groups they can only attack one structure at a
time, but they'll now at least switch to the next target after hitting
the first one.

As a bonus, stop bombing the dead buildings.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/235
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/244
2021-05-19 23:33:15 -07:00
Dan Albert
4e37666037 Clean up the category property of TGOs.
This really needs to be a proper type, but this is a start: create new
categories for the types of TGOs that are missing. This removes some
icon special cases.
2021-05-18 23:35:25 -07:00
Dan Albert
a3cce8ff72 Invert the random location warning.
Campaigns should no longer be using these. Remove the warning when a
location cannot be found, and emit a warning when they are used.
2021-05-18 19:36:20 -07:00
Dan Albert
f4b64370bb Remove fallback for old non-convoy behavior. 2021-05-18 19:21:43 -07:00
Dan Albert
cd391a360c Add support for AAA objectives.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/999
2021-05-18 17:29:42 -07:00
Dan Albert
739406614d Add support for required variants of all TGOs.
Adds required variants of:

* SHORADS
* Armor groups
* Buildings
* Oil rigs
* Coastal defenses
* Missile sites
* Ships

This is prep work for removing random generation.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1076
2021-05-18 00:48:12 -07:00
Dan Albert
8ec133830f Don't tell the UI about CP TGOs.
These are an implementation quirk, and passing them to the UI just means
that we put TGO pins on top of the CP, which makes the base menu
unopenable.

In the old UI we avoided this by not drawing anything that was
`for_airbase`, but now that we can zoom in further we're drawing base
defenses.
2021-05-15 00:10:05 -07:00
Dan Albert
bdb959d986 Draw patrol commit ranges in the new map. 2021-05-14 23:41:55 -07:00
SnappyComebacks
bb1a066ff7
Let map objects be Strike targets.
This PR allows campaign creators to incorporate map objects (referred to as Scenery in the code) into their Liberation campaign.

Map objects are defined using white trigger zones created by right clicking on scenery and clicking `assign as...`.   Objective groups are defined by creating a blue TriggerZone surrounding the centers of the white trigger zones.  The type of objective is determined by the campaign creator, assigning the value of the first property of the blue TriggerZone with the objective type.

Map objects maintain their visually dead state by assigning a `Mission Start` `Scenery Object Dead` trigger to the trigger zone.  It is important for the Liberation generated TriggerZone to be as small as possible so that no other scenery is marked dead by DCS.

TriggerZones are hidden during gameplay (DCS behavior.  I don't know if it's possible to turn that off.)  TriggerZones are visible in the mission editor and mission planner however.  If a player is using an older plane, it is important for them to remember where the target is.

In the mission planner, the trigger zones' will be blue or red depending on which faction the map objects belong to.

Inherent Resolve campaign has been modified to integrate scenery objects.

### **Limitations:**
- Objective definitions (Any Blue TriggerZones) in campaign definition cannot overlap.
- Map object deaths in `state.json` is tracking integers.  You won't know what died until debriefing.
- No images for the various buildings.  In theory it can be done, but an unreasonable amount of work.
- Every blue trigger zone must have a unique name.  (If you let DCS auto increment the names this is not a concern.
- No output to screen when scenery object is dead.  You can see the building drawn as dead in the F10 map though.


### **Pictures:**

An objective:
![CampaignCreation](https://user-images.githubusercontent.com/74509817/117526797-c294af00-af84-11eb-9fb7-3940db64c5d8.png)

How the objective looks once in the mission planner/editor.  This objective belongs to the enemy faction:
![MissionPlanner](https://user-images.githubusercontent.com/74509817/117526819-ece66c80-af84-11eb-9db0-64000dedcf89.png)
2021-05-14 17:18:03 -07:00
Dan Albert
9a9872812f Generate factories at FOBs.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1021
2021-05-14 11:38:14 -07:00