90 Commits

Author SHA1 Message Date
Raffson
647032ca48
Skip & Log incompatible loadouts
Solution exists in using the 'get' method
of the "Weapons dictionary", and
subsequentially guarding against
None. Aside from that I created
a method to validate a payload,
which uses this None value to
determine validity.
2022-08-14 14:45:26 +02:00
Dan Albert
60f772081c Update pydcs. 2022-08-10 19:17:06 -07:00
RndName
aa77cfe4b9 Add AirAssault and Airlift mission types with CTLD support
- Add the new airassault mission type and special flightplans for it
- Add the mission type to airbase and FOB
- Add Layout for the UH-1H
- Add mission type to capable squadrons
- Allow the auto planner to task air assault missions when preconditions are met
- Improve Airlift mission type and improve the flightplan (Stopover and Helo landing)
- Allow Slingload and spawnable crates for airlift
- Rework airsupport to a general missiondata class
- Added Carrier Information to mission data
- Allow to define CTLD specific capabilities in the unit yaml
- Allow inflight preload and fixed wing support for air assault
2022-06-09 22:45:29 +02:00
RndName
7acc418489 Update the High Digit SAMs implementation
- Add more HighDigitSAMs units
- Add hds SA-2, SA-3 and HQ-2 to capable factions
- Update radar db with hds as these entries were missing
2022-05-12 16:20:44 +02:00
RndName
5be92cd75e Cleanup threat and detection range calculation
- Moved logic from TGO to TheaterGroup and Unit, cleanup
- Fixed an issue with wrong radar threat zone calculation
- Correctly handle dead and alive units in threat calculation (dead units are no more threats...)
- Fixed wrong air_defenses threat zone used for planning (now uses aa-capable tgos instead of all tgos for the CP)
- Remove the might_have_aa property from TGOs and actually check if there is any aa-capable unit present (this is needed as with the recent tgo refactor all type of TGOs can also have anti air units if they have some defined in the layout)
2022-04-21 21:20:02 +02: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
RndName
1d20e6277e
Fix silkworm launcher falsely added to scud groups
Added AntiShipMissile unit class and updated the hy_launcher unit as well as the silkworm layout to differentiate clearly between missile (scud, v1) and antiship (silkworm)

fixes #2159
2022-04-08 21:30:44 +02:00
RndName
1bb7e1bf47 Change SEAD task to Search and Engage for ARM weapon
SEAD flights will have the Search and Engage Group Task instead of the current AttackGroup task when the flight has ARM weapons in the Loadout. This resolves an issue with AI not able to attack a SAM when skynet is used. This is due to the RADAR not emitting and the AI therefore just diving into the SAM.
Non-ARM Loadouts will still use the AttackGroup task. This ensures that for example the ADM-141 TALD used by the F-14s will work correctly
2022-04-02 10:16:11 +02:00
RndName
2c17a9a52e Refactor Templates to Layouts, Review and Cleanup
- Fix tgogenerator
- Fix UI for ForceGroup and Layouts
- Fix ammo depot handling
- Split bigger files in smaller meaningful files (TGO, layouts, forces)
- Renamed Template to Layout
- Renamed GroundGroup to TheaterGroup and GroundUnit to TheaterUnit
- Reorganize Layouts and UnitGroups to a ArmedForces class and ForceGroup similar to the AirWing and Squadron
- Reworded the UnitClass, GroupRole, GroupTask (adopted to PEP8) and reworked the connection from Role and Task
- added comments
- added missing unit classes
- added temp workaround for missing classes
- add repariable property to TheaterUnit
- Review and Cleanup

Added serialization for loaded templates

Loading the templates from the .miz files takes a lot of computation time and in the future there will be more templates added to the system. Therefore a local pickle serialization for the loaded templates was re-added:
- The pickle will be created the first time the TemplateLoader will be accessed
- Pickle is stored in Liberation SaveDir
- Added UI option to (re-)import templates
2022-02-21 20:45:41 +01:00
RndName
60c8c80480 Decoupling and generalization of templates
Improvement for factions and templates which will allow decoupling of the templates from the actual units
- Implement UnitGroup class which matches unit_types and possible templates as the needed abstraction layer for decoupling.
- Refactor UnitType, Add ShipUnitType and all ships we currently use
- Remove serialized template.json and migrated to multiple yaml templates (one for each template) and multiple .miz
- Reorganized a lot of templates and started with generalization of many types (AAA, Flak, SHORAD, Navy)
- Fixed a lot of bugs from the previous reworks (group name generation, strike targets...)
- Reorganized the faction file completly. removed redundant lists, added presets for complex groups / families of units like sams
- Reworked the building template handling. Some templates are unused like "village"
- Reworked how groups from templates can be merged again for the dcs group creation (e.g. the skynet plugin requires them to be in the same group)
- Allow to define alternative tasks
2022-02-21 20:45:41 +01:00
RndName
d154069877 Refactor ground objects and prepare template system
- completly refactored the way TGO handles groups and replaced the usage of the pydcs ground groups (vehicle, ship, static) with an own Group and Unit class.
- this allows us to only take care of dcs group generation during miz generation, where it should have always been.
- We can now have any type of unit (even statics) in the same logic ground group we handle in liberation. this is independent from the dcs group handling. the dcs group will only be genarted when takeoff is pressed.
- Refactored the unitmap and the scenery object handling to adopt to changes that now TGOs can hold all Units we want.
- Cleaned up many many many lines of uneeded hacks to build stuff around dcs groups.
- Removed IDs for TGOs as the names we generate are unique and for liberation to work we need no ids. Unique IDs for dcs will be generated for the units and groups only.
2022-02-21 20:45:41 +01:00
RndName
3afc6ba24b
Add NASAM Radar and Launcher to radar_db
This will allow correct calculation of the threat range and prevent creating a threat zone when the SR is dead. #1978
2022-01-28 09:41:17 +01:00
RndName
54745e786e
Fix incorrect threat range of SA-5
The SA-5 was not part of the radar_db.py and therefore the threat_range calculation was wrong / ever LN counted as threat even when the TR was dead. Also fixed a wrong unit for the SA-11 TELAR.
#1816
2022-01-07 14:41:01 +01:00
Dan Albert
46bf952562 Add Forrestal support, use in US 1975.
https://github.com/dcs-liberation/dcs_liberation/issues/1657
2021-10-22 10:11:15 -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
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
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
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
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
Dan Albert
e5c0fc92ec Don't reload weapon data if already loaded. 2021-07-16 01:06:31 -07:00
Dan Albert
e03d710d53 [1/3] Rework IP placement.
Test cases:

1. Target is not threatened.

   The IP should be placed on a direct heading from the origin to the
   target at the max ingress distance, or very near the origin airfield
   if the airfield is closer to the target than the IP distance.

2. Unthreatened home zone, max IP between origin and target, safe
   locations available for IP.

   The IP should be placed in LAR at the closest point to home.

3. Unthreatened home zone, origin within LAR, safe locations available
   for IP.

   The IP should be placed near the origin airfield to prevent
   backtracking more than needed.

4. Unthreatened home zone, origin entirely nearer the target than LAR,
   safe locations available for IP.

   The IP should be placed in LAR as close as possible to the origin.

5. Threatened home zone, safe locations available for IP.

   The IP should be placed in LAR as close as possible to the origin.

6. No safe IP.

   The IP should be placed in LAR at the point nearest the threat
   boundary.
2021-07-15 23:18:10 -07:00
Dan Albert
7648716199 Make weapon groups explicit and moddable.
The only parts of the old weapon data that worked well (didn't commonly
result in empty pylons) did this implicitly, so make the grouping
explicit.

This also moves the data out of Python and into the resources, which
both makes the data moddable and isolates us from a huge amount of
effort and a save compat break whenever ED changes weapon names.

I didn't auto migrate the old data since the old groups were not
explict and there's no way to infer the grouping. Besides, since most of
the weapons were *not* grouped, the old data did more harm than good in
my experience. I've handled the AIM-120 and AIM-7 for now, but will get
at least all the fox 3 missiles before we ship.
2021-07-14 01:04:03 -07:00
Dan Albert
9bbcee645e Cleanup and document some of Doctrine. 2021-07-13 20:18:30 -07:00
Dan Albert
dfcd372d2d Remove egress points from most flight plans.
These don't have any function. Remove them and remove the angled attack
heading from the IP.
2021-07-13 18:36:38 -07:00
Dan Albert
783ac18222 Replace existing campaign planner with an HTN.
An HTN (https://en.wikipedia.org/wiki/Hierarchical_task_network) is
similar to a decision tree, but it is able to reset to an earlier stage
if a subtask fails and tasks are able to account for the changes in
world state caused by earlier tasks.

Currently this just uses exactly the same strategy as before so we can
prove the system, but it should make it simpler to improve on task
planning.
2021-07-12 13:02:23 -07:00
Dan Albert
96c7b87ac7 More adaptation for pydcs updates.
This is as much as we can do until pydcs actually adds the py.typed
file. Once that's added there are a few ugly monkey patching corners
that will just need `# type: ignore` for now, but we can't pre-add those
since we have mypy warning us about superfluous ignore comments.
2021-07-09 16:35:03 -07:00
Dan Albert
53f6a0b32b Fix some typing in preparation for pydcs types.
Not complete, but progress.
2021-07-08 23:23:05 -07:00
Mustang-25
151f8bf329 Update TGP Restriction Dates
TGP dates to more accurately reflect IRL IOC dates.
2021-06-30 19:17:14 -07:00
Mike Jones
08b7aff0d8 Add gunfighter flag to aircraft data files. 2021-06-22 14:35:28 -07:00
Dan Albert
dc85644d71 Exclude weapon names and weights from comparisons.
Only the class ID matters, and the names sometimes change with new pydcs
updates.
2021-06-20 15:11:35 -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
Schneefl0cke
203f0d3851
Introduce recon unit type, adjust ratios. 2021-06-02 23:00:35 -07:00
Dan Albert
c42974f7b3 Update FOB icon.
Also removes the possibility of generating FOBs that are not FOBs.
2021-05-31 13:14:45 -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
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
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
5e68dbe1ca Correct the list of units with radars.
Probably.

https://github.com/dcs-liberation/dcs_liberation/issues/1109
2021-05-23 01:30:23 -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
11bf0ca868 Replace JSOW fallbacks with walleyes.
The GBU-12 that was chosen doesn't fit on the hornet in the first place,
and we ought to replace glide bombs with glide bombs.
2021-05-20 19:58:26 -07:00
Dan Albert
664092c023 Remove non-CP FOBs. 2021-05-20 19:01:43 -07:00
Khopa
9243fd499b pydcs update for DCS 2.7.1 2021-05-21 01:15:54 +02:00
Dan Albert
8274e68846 Add SEAD/DEAD target info kneeboard page.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/965
2021-05-20 00:13:49 -07:00
Dan Albert
f1adcd1836 Be permissive about presumably incorrect loadouts.
These might be broken loadouts, or might be broken pydcs data. In case
it's the latter, attempt to load the pylon. DCS will remove the weapon
if it's not compatible automatically.
2021-05-19 23:33:24 -07:00
Dan Albert
f63d218aae Fix loadouts to work with clean pylons. 2021-05-17 21:28:12 -07:00
Mustang-25
3161ccced3
Re-adds GAR-8 (now AIM-9B in DCS) Fallback dates (#1025) 2021-04-23 22:25:11 -07:00
Dan Albert
eff5b94db7 Add factory placement to the campaign files.
This also removes the "factory" type from the normal strike target
(money generating) generators to avoid confusion. Later only control
points with factories will be able to spawn ground units, at which point
these will no longer generate income.

https://github.com/Khopa/dcs_liberation/issues/986
2021-04-18 23:22:30 -07:00
Khopa
c2ce3a6992 Fixed Lint issue 2021-04-17 13:11:26 +02:00