388 Commits

Author SHA1 Message Date
Dan Albert
9f078e1483 Don't generate empty groups. 2020-11-26 20:03:16 -08:00
Dan Albert
0e807d84c2 Differentiate required long and medium range SAMs.
To improve IADS design in campaigns, this differentiates required long
and medium range SAMs. SAMs that must be long range SAMs are defined by
SA-10 or Patriot launchers, while medium range SAMs are defined by SA-2,
SA-3, or Hawk launchers.

Long range SAMs positions will only be populated by long range SAMs
(Patriots and SA-10s), and not all factions have those available. Medium
range SAMs currently comprise all air defenses that are not long range
SAMs, so if the faction includes flak guns in their `sams` property then
flak guns may be spawned at medium range SAM locations.

Base defenses and random SAM locations continue to use either type of
SAM.
2020-11-26 19:48:14 -08:00
Dan Albert
2bd673a531 Don't allow operating on broken runways.
Doesn't allow helos or harriers to do it either even though they should
be able to because we don't currently support ground spawns, which would
be needed to prevent those aircraft from using the runway. Even then, I
don't know if they can be forced to *land* vertically.

Fixes https://github.com/Khopa/dcs_liberation/issues/432
2020-11-25 18:50:00 -08:00
Dan Albert
80bc9d6b23 Support reparing damaged runways.
Repairing a damaged runway costs $100M and takes 4 turns (one day). The
AI will always repair runways if they can afford it. if a runway is
damaged again during the repair the process must begin again.

Runways are still operational despite what the UI says. Preventing the
player and AI from using damaged runways (except for with helicopters
and harriers) is next.
2020-11-25 18:07:51 -08:00
Dan Albert
ee768b9147 Display damaged runways. 2020-11-25 18:07:51 -08:00
Dan Albert
0c4e920af3 Handle runway damage in the debrief.
Apparently we were already getting this info because it's a unit like
any other according to the event system, so if runways were actually
sufficiently damaged we'd emit a ton of exceptions.

This doesn't do anything yet, but tracks the damage state. Will add the
ability to repair them next, and then finally make the damage render the
runway inoperable.
2020-11-25 13:12:46 -08:00
Dan Albert
b99462b628 Rename OCA strike tasks. 2020-11-24 17:28:48 -08:00
Dan Albert
65ac30acda Merge ground strike and SAM location presets.
Locations that should always be SAMs should be done with fixed IADs
locations, so we don't need the separate type.

The generic "ground strike location" needs to be eventually split up
into more specific types, so eventually all of the non-base defense SAMs
will go away.
2020-11-24 17:15:24 -08:00
Dan Albert
efcdbebda5 Handle additional preset location types.
Missile sites were accidentally excluded, and coastal defenses aren't
being generated yet.
2020-11-24 15:50:51 -08:00
Khopa
20276e5230 Removed an unused property in controlpoint.py 2020-11-25 00:46:23 +01:00
Khopa
9c1d36d18a Removed radials from control point data. (Not used anymore) 2020-11-24 22:48:40 +01:00
walterroach
17fe977b06
Merge pull request #437 from walterroach/operation_refactor
Operation refactor
2020-11-23 22:36:46 -06:00
walterroach
60783ca390 remove mypy ignore 2020-11-23 22:28:53 -06:00
walterroach
34a7a37409 Operation refactor cleanup
Fix bug in closest cp algorithm
2020-11-23 22:27:12 -06:00
Dan Albert
b0317055e7 Implement OCA strike missions.
https://github.com/Khopa/dcs_liberation/issues/349
2020-11-23 17:58:53 -08:00
Dan Albert
9394ed663a Add runway bombing missions.
This allows planning the missions and the missions are functional, but
they will have no effect on future turns yet.
2020-11-23 16:47:58 -08:00
walterroach
967574820f Remove unused conflictgen globals
Remove unused  `Conflict` properties

mypy fixes

Cleanup
2020-11-23 18:14:25 -06:00
walterroach
da17d1e5d1 Change Operation to a static class
Removed always True "event successful"

Add `AirWarEvent` as the primary game `Event` applied to every miz

Cleanup of `FrontLineAttackEvent`

Change `Operation.is_awacs_enabled` to two bools for each side red/blue
Currently controlled by whether an AWACs is available for the faction
(and only ever true for Blue)
2020-11-23 18:14:25 -06:00
Dan Albert
63bdbebcaa Refactor control points into individual classes. 2020-11-23 14:34:58 -08:00
Dan Albert
d7b328b887 Consider trasnfers when counting parking. 2020-11-22 18:44:16 -08:00
walterroach
f6e0dbbb6a operation refactoring 2020-11-21 17:00:22 -06:00
Dan Albert
0d95716545 Correct type annotations. 2020-11-20 21:40:31 -08:00
Dan Albert
75edbb62f1 Clean up available parking code a bit.
Moved more into the `ControlPoint`.
2020-11-20 18:31:19 -08:00
Dan Albert
c4b8a41742 Move calculation of aircraft amounts into game.
The planner needs to know how much space is still expected to be
available next turn.
2020-11-20 18:25:03 -08:00
Dan Albert
f8b2dbe283 Move unit delivery ownership out of the UI.
Breaks save compat, but we need to have this knowledge outside the UI so
we can know whether or not we can ferry aircraft to the airfield without
overflowing parking.
2020-11-20 18:04:27 -08:00
Dan Albert
a594f45aae Pick divert airfields when planning.
https://github.com/Khopa/dcs_liberation/issues/342
2020-11-20 17:29:58 -08:00
Dan Albert
ae68a35a1a Remove save compat since it's breaking anyway.
Removal of old paths/names for things that no longer exist.
2020-11-20 17:06:01 -08:00
Dan Albert
18b6f7b84c Add off-map spawn locations.
The AI isn't making use of these yet, but it's not smart enough to do so
anyway.

Would benefit from an icon to differentiate it on the map.

I'm stretching the definition of "control point" quite a bit. We might
want to put a class above `ControlPoint` for `AirSpawnLocation` to
represent types of spawn locations that can't be captured and don't have
ground objectives.

Fixes https://github.com/Khopa/dcs_liberation/issues/274
2020-11-20 02:19:03 -08:00
Dan Albert
bc3cd50a6c Add support for required SAMs in campaigns.
"Required" SAMs (designative by redfor long range SAM launchers in the
ME) will always be spawned during campaign generation. This makes it
possible to build a semi-guaranteed IADS (the exact type of SAM is
dependent) on the choice of faction.

Requierd SAMs will consume the slots of random SAMs during generation.
Later we should differentiate between strategic SAMs like SA-10s and
tactical SAMs like SA-11s so we can fill in the medium range SAMs at
random locations among the fixed long range SAMs.
2020-11-19 23:47:07 -08:00
Dan Albert
cecf611f91 Add docs for PresetLocations. 2020-11-19 21:59:36 -08:00
Dan Albert
5e4802f05e Return base defense locations to pool on capture.
When a base is captured we clear its defenses. Those locations need to
be returned to the preset location pool so they can be used for the new
base defenses.
2020-11-19 21:50:29 -08:00
Dan Albert
5fb6a53cbd Add preset configuration for offshore types. 2020-11-19 21:28:57 -08:00
Dan Albert
ff751c30f9 Add preset configuration for strike targets. 2020-11-19 21:20:40 -08:00
Dan Albert
c1614ad5a7 Add TODOs for carrier CP names. 2020-11-19 21:19:53 -08:00
Dan Albert
1ee0aafd9a Unify TGO location selection.
We currently have three methods of choosing locations for TGOs:

1. From the campaign miz
2. From the per-CP mizdata files
3. Randomly

Move the selection among these sources into a single place and use it
everywhere that we search for a TGO location.

Longer term methods 2 and 3 will be removed.
2020-11-19 21:09:33 -08:00
Dan Albert
df80ec635f Add a new miz file based campaign generator.
Defining a campaign using a miz file instead of as JSON has a number of
advantages:

* Much easier for players to mod their campaigns.
* Easier to see the big picture of how objective locations will be laid
  out, since every control point can be seen at once.
* No need to associate objective locations to control points explicitly;
  the campaign generator can claim objectives for control points based
  on distance.
* Easier to create an IADS that performs well.
* Non-random campaigns are easier to make.

The downside is duplication across campaigns, and a less structured data
format for complex objects. The former is annoying if we have to fix a
bug that appears in a dozen campaigns. It's less an annoyance for
needing to start from scratch since the easiest way to create a campaign
will be to copy the "full" campaign for the given theater and prune it.

So far I've implemented control points, base defenses, and front lines.
Still need to add support for non-base defense TGOs.

This currently doesn't do anything for the `radials` property of the
`ControlPoint` because I'm not sure what those are.
2020-11-19 16:55:21 -08:00
Dan Albert
94c5ed8bdc Fix custom waypoints.
Like with deleting waypoints, these will degrade the flight plan to the
2.1 behavior.

Ascend/descend points aren't in use any more, so I removed those.
2020-11-19 00:29:05 -08:00
Dan Albert
8345063e84 Move theater into game. 2020-11-17 18:11:33 -08:00