1794 Commits

Author SHA1 Message Date
Raffson
a46e32cdf1
Add Spanish Naval Assets pack v3.2.0 by desdemicabina
Resolves #119
2023-05-20 20:17:54 +02:00
Raffson
93b3157c35
Add 'Fog' class to CustomUnpickler
This class also got refactored and moved into its own package, hence we need to add it to the custom unpickler
2023-05-20 01:41:37 +02:00
Raffson
5eee136189
Fix final country-refactor related issues? 2023-05-20 01:41:37 +02:00
Raffson
1a5e31c01a
Migrate squadron countries 2023-05-20 01:41:37 +02:00
Raffson
f72f3316f4
Fix bug in migrator 2023-05-18 23:05:57 +02:00
Raffson
5909ce372b
Remove debugging try-except 2023-05-18 22:36:17 +02:00
Raffson
386844378e
More save-compatibility changes 2023-05-18 22:33:11 +02:00
Raffson
99b56f1ab7
Update campaign version 2023-05-18 18:51:35 +02:00
Raffson
978e3e4de2
Formatting + type annotations 2023-05-18 16:29:20 +02:00
Raffson
da109146c9
Fixing issues after using actual Country in Faction 2023-05-18 16:24:49 +02:00
Raffson
cca45d3729
Fix save-compat issues 2023-05-18 14:37:34 +02:00
Raffson
b14059e134
Fixing tests + mypy issues 2023-05-18 14:12:41 +02:00
Raffson
71f6186a88
Reuse Ghosti's NightMission conditions 2023-05-18 13:40:29 +02:00
Dan Albert
0e139b8640
Make wind speed moddable.
These should probably be overridable per theater and per season, but
even with that we'll want some defaults.

https://github.com/dcs-liberation/dcs_liberation/issues/2862
2023-05-18 13:33:39 +02:00
Dan Albert
8ed843a9cf
Move and split up weather.py.
This is getting out of hand, and I'm about to make it worse.
2023-05-18 13:31:26 +02:00
Dan Albert
080d346517
Rework wind speed Weibull inputs, tune.
The previous method of using a uniform scalar of the MSL wind speed for
higher altitudes didn't offer enough control. In particular, the shape
needs to be quite different to skew low, mid, high.

This patch reworks that system so the parameters of each distribution
are configured per-altitude level. To keep some continuity between
altitudes (on a windy day, all levels should have higher wind speeds on
average), the wind speed of the lower altitude will be added to the
scale value of the higher altitude.

Since it wasn't practical to approximate the previous behavior with the
new system, this also handles the tuning of each. The low altitude
speeds remain mostly unchanged (typically around 5 knots expect for
thunderstorms), but the average speeds for other altitudes went up to
more closely match the previous intent but without the massive
overshoot. At 2000m wind speeds are typically in the 20-25 knot range
now, and 8000m 30-50 knots.

https://www.quora.com/What-is-the-average-wind-speed-at-different-altitudes
has some of the source data, and Quora is the most authoritative source
there is. It claims that cruise altitude winds can get "as high as 150
knots", but doesn't claim anything about the average. I had a
surprisingly difficult time finding good data for cruise altitude air
speeds for non-jet stream paths (though many of our maps are in jet
streams), so I just eyeballed it from
https://turbli.com/wind-during-flights/.

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

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2863.
2023-05-18 13:29:02 +02:00
Dan Albert
73e0cbe182
Use weibull distribution for wind generation.
Wind speeds should not be uniformly distributed. This switches to a
Weibull distribution which allegedly (see the bug) is good enough.
Experimentally that seems true as well, though I know nothing about how
wind works irl. This at least looks like it'll generate reasonable
variation in missions while keeping the 1st through 3rd quartile
behaviors from getting out of hand.

I'm very uncertain about the scaling factor aspect of this. Naively the
wind speeds at different altitudes ought to be somewhat correlated, but
I'm not sure how much, and whether this kind of scaling is at all the
right way to do it. As before, meh, close enough?

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2861.
2023-05-18 13:29:02 +02:00
Raffson
b750099b16
Add missing tasks in aircraft yamls 2023-05-18 13:14:22 +02:00
Raffson
f00a3fb1d2
pydcs update: refactored livery-scanner 2023-05-16 21:45:27 +02:00
Raffson
1b1090d78f
Fix exception wrt typing 2023-05-16 21:45:26 +02:00
Raffson
34645560bf
Migration changes 2023-05-16 21:45:26 +02:00
Raffson
785beffee0
Cleanup after cherry-picking... 2023-05-14 21:37:24 +02:00
Dan Albert
b44249317a
Remove old aircraft selection mode.
New mode seems to be working well.
2023-05-14 21:04:43 +02:00
Dan Albert
0608089eb0
Use the actual Country type instead of the name.
We want other pieces of country information (in particular the short
names). This cleans up a lot of code anyway.

As an added bonus, this now catches squadrons that used invalid names
which would previously be passed through to pydcs and... then I don't
know what would happen.
2023-05-14 21:04:09 +02:00
Dan Albert
5c07a2556e
Add option to limit squadron sizes and begin full.
Adding temporarily as an option to make sure it's not a terrible idea,
but the old mode will probably go away.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1583.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2808.
2023-05-14 20:56:58 +02:00
Dan Albert
f719e1cfe7
Add an option to prefer primary tasked aircraft.
We're still using mostly the same aircraft selection as we have before
we added squadrons: the closest aircraft is the best choice.

This adds an option to obey the primary task set by the campaign
designer (can be overridden by players), even if the squadron is farther
away than one that is capable of it as a secondary task.

I don't expect this option to live very long. I'm making it optional for
now to give people a chance to test it, but it'll either replace the old
selection strategy or will be removed.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1892.
2023-05-14 20:33:55 +02:00
zhexu14
790d08fa13
enable AEWC missions on FOBs 2023-05-14 17:30:20 +02:00
Dan Albert
03c48376c4
Disallow squadrons from disabling mission types.
After this change, players will always have the final say in what
missions a squadron can be assigned to. Squadrons are not able to
influence the default auto-assignable missions either because that
property is always overridden by the campaign's air wing configuration
(the primary and secondary task properties). The `mission-types` field
of the squadron definition has been removed since it is no longer
capable of influencing anything. I haven't bothered cleaning up the now
useless data in all the existing squadrons though.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2785.
2023-05-14 17:18:55 +02:00
Raffson
5e2625ad21
Propagate changes from Liberation 2023-05-14 17:09:41 +02:00
Raffson
711d102425
Only use bold font on kneeboard
Should fix an issue where letters seem transparent in VR
2023-05-14 16:54:48 +02:00
Raffson
231a857813
Fix mypy errors 2023-05-14 15:16:21 +02:00
Raffson
3ce0473c86
Cleanup 2023-05-14 15:13:44 +02:00
Dan Albert
0b6575ca97
Use task priorities from aircraft yamls.
Preferred aircraft per task are now determined by a ranking of weights
stored in the aircraft yaml files. To aid in visualizing the priorities
across aircraft, Liberation can be run with the argument
dump-task-priorities to dump a yaml file in Saved
Games/DCS/Liberation/Debug/priorities.yaml, which will show each task
along with priority sorted aircraft and their weights.

The current weights in the data were exported from the existing lists,
where each position from the bottom of the list was worth 10 (to allow
some games for less shuffling later).

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2809.
2023-05-14 14:50:30 +02:00
Dan Albert
9ebbe11d83
Add debug command to dump aircraft priorities.
https://github.com/dcs-liberation/dcs_liberation/issues/2809
2023-05-14 14:30:19 +02:00
Dan Albert
016a9b5762
Load task priorities from YAML.
Not used yet.

https://github.com/dcs-liberation/dcs_liberation/issues/2809
2023-05-14 14:19:47 +02:00
Dan Albert
81554c510e
Fix merged classvars in UnitType descendants.
```
>>> class Foo:
...     bar = 0
...     @classmethod
...     def set_bar(cls, v):
...             cls.bar = v
...
>>> class Bar(Foo):
...     ...
...
>>> Bar.set_bar(1)
>>> Bar.bar
1
>>> Foo.bar
0
>>> class Foo:
...     bar = {}
...     @classmethod
...     def add(cls, k, v):
...             cls.bar[k] = v
...
>>> class Bar(Foo):
...     pass
...
>>> Bar.add(0, 1)
>>> Bar.bar
{0: 1}
>>> Foo.bar
{0: 1}
```

The collections are copied by reference into the descendants, whereas
_loaded is copied by value, so that one can stay. Before this patch,
every subtype was loading because _loaded was set per subclass, but they
were all registering with a common collection defined by UnitType rather
than their own class.
2023-05-14 14:08:37 +02:00
Pande4360
179850cdb6
Support for SW v2.6 mod (#120)
* Removed AI varients

* Removed AI varients Logo/Banners

* Removed AI varients Logo/Banners

* Removed AI varients ai flgith planner

* Removed AI varients SWPack Fix

* Removed AI varients SWPack - SWWeapon fix
2023-05-11 21:48:19 +02:00
zhexu14
f965c9ffa7
Handle edge case where aircraft have built in TPGs 2023-05-07 21:43:41 +02:00
zhexu14
065f90ea98
Reset flight's flight plan builder when changing task type.
The mechanism for how this bug arises is that the *WaypointGenerator*
uses the *FlightWaypoint.waypoint_type* to decide whether to generate
the waypoint in the .miz file using a *DeadIngressBuilder* or a
*SeadIngressBuilder*. This *waypoint_type* is set by
*ato.flightplans.<sead|dead>.Builder*, which is set when *ato.flight* is
initialised in the *Flight._flight_plan_builder* member variable based
on *Flight.flight_type*. When *Flight.flight_type* is updated when the
flight is changed from SEAD->DEAD, *Flight._flight_plan_builder* is not
updated in the development build, resulting in it continuing to generate
SEAD waypoints.

This PR adds *set_flight_type()* which sets the *flight_type* property
and updates *Flight._flight_plan_builder* and uses this function when
converting flight types. Ideally, *flight_type* should be made private
and only accessed through getter/setter functions that encapsulate this
behavior, but that would mess up any existing liberation save files.

This PR was tested by:
1. Opening the save file from Issue 2779 in the development build
2. Clicking "Take Off" and confirming that the Weapon Release Type is
"Guided" at the Ingress Waypoint as described in the issue.
3. Opening the save file from Issue 2779 in this PR
4. Converting the SEAD2DEAD flight from DEAD back to SEAD, and then from
SEAD to DEAD
5. Clicking "Take Off" and confirming in the mission editor that the
SEAD2DEAD flight has Weapon Release Type set to "Auto" at the Ingress
Waypoint.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2779.
2023-05-07 21:19:53 +02:00
zhexu14
c44fe4c89e
Track S_EVENT_KILL and S_EVENT_UNIT_LOST as well.
Catch a few more death signals. Still not perfect but a bit better.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2765.
2023-05-07 21:19:53 +02:00
Dan Albert
0697a0dd5b
Fix file encoding for some loads.
We've actually been pretty good at getting this right in most of the
code base, but we've missed it in a few places. Python defaults to the
encoding of the current locale unless otherwise specified, and for a US
English Windows install that's cp1252, not UTF-8. I'm not brave enough
to change the locale at startup because I don't know how that might
affect CJK encoding users (or for that matter, non-Latin derived
alphabet UTF-8 variants).

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2786.
2023-05-07 19:31:20 +02:00
Dan Albert
4cf7864916
Improve logging in defaultsquadronassigner.py.
https://github.com/dcs-liberation/dcs_liberation/issues/2786
2023-05-07 19:30:44 +02:00
Raffson
55b76de3f4
Formatting -_- 2023-05-06 18:13:36 +02:00
Raffson
29f3de3587
Fixing some issues with mod weapons 2023-05-06 17:19:56 +02:00
Raffson
df4a071a0f
Adjust Strike formation before and after bombing task 2023-05-06 17:08:48 +02:00
Pande4360
b36e7ea750
Support for SW mod v2.55 (#116) 2023-05-04 21:45:26 +02:00
Raffson
2ce63abf04
Use Courier font for kneeboard 2023-05-01 18:15:58 +02:00
Raffson
199467f31b
Export txt version of kneeboard pages 2023-05-01 18:12:17 +02:00
Raffson
b4b19d3ad5
Avoid claiming unused aircraft
Probably the final Fix #97
Unused aircraft (assigned upon takeoff) would get claimed but since it's not possible to delete those flights after aborting, these flights wouldn't get released anymore. This should fix that issue, including a migrator change to correct the number of claimed aircraft per squadron.
2023-05-01 18:12:17 +02:00
Raffson
31cfc333c7
Fine-tuning kneeboard
Partial fix #106
2023-05-01 18:12:16 +02:00