Commit Graph

395 Commits

Author SHA1 Message Date
Gustas
5cc59ae3ac Move ValidRelations from Capturable to Captures
To better match weapon definitions
2023-09-09 13:24:33 +02:00
RoosterDragon
93a97d5d6f Fix CA1851, assume_method_enumerates_parameters = true 2023-08-20 20:41:27 +02:00
RoosterDragon
3275875ae5 Fix CA1851 2023-08-20 20:41:27 +02:00
Gustas
3ab421cbe3 Allow queueing up scatter and move Nudge to an activity 2023-08-08 16:10:53 +02:00
dnqbob
2ac85ac61d Add InstantlyRepairsProperties 2023-08-01 12:21:19 +02:00
Gustas
723ffdf33d Revert Hunt to move within 2 cells of the target
Otherwise infantry get stuck within weapon range but outside of vision range
2023-07-30 20:26:41 +02:00
RoosterDragon
231bf01f18 Fix CA1854 2023-06-20 17:57:40 +02:00
Matthias Mailänder
c31f2abfc9 Add sanity checks to the Lua script trait. 2023-06-11 11:03:38 +03:00
RoosterDragon
277699cbd5 Fix CA1822 2023-06-06 11:51:47 +03:00
abcdefg30
74ed202b29 Support enabling and disabling the low power notification via Lua 2023-06-01 20:42:39 +03:00
Matthias Mailänder
8433bc0948 Throw early when Lua function parameters are null. 2023-05-23 17:30:03 +03:00
Matthias Mailänder
0fb5853b7a Fallback to normal difficulty when none is set. 2023-05-21 15:46:20 +03:00
Matthias Mailänder
b30285e38d Officially deprecate this function. 2023-05-21 15:46:20 +03:00
abcdefg30
6b536ca88a Add a Lua function to concat two tables 2023-05-20 18:56:58 +02:00
Matthias Mailänder
445b736885 Replace sandbox wrapper scripts. 2023-05-20 13:19:48 +02:00
Matthias Mailänder
65c0cf1065 Deprecate string format shorthand. 2023-05-05 19:03:09 +02:00
Matthias Mailänder
1c2ce0dcc0 Deprecate string format log shorthand. 2023-05-05 19:03:09 +02:00
Matthias Mailänder
55ff0ac1f4 Inline variables. 2023-04-25 21:33:02 +03:00
Matthias Mailänder
68eec52cef Add TranslationProvider 2023-04-22 19:23:41 +02:00
Gustas
1db982276a Fix actors being added to world while world actors are being iterated 2023-04-15 17:26:02 +02:00
RoosterDragon
595717fff0 Enable Code Quality Rules
Enforces a variety of CAxxxx rules that do not have existing violations.

For the benefit of dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = true, rename parameters of methods that forward to string.Format so format issues will get detected automatically.
2023-04-08 23:15:40 +02:00
RoosterDragon
8a285f9b19 Fix IDE0090 2023-04-08 16:51:51 +03:00
RoosterDragon
83561d639d Update LangVersion to C# 9.
mono was the bottleneck restricting our ability to use a newer C# version. mono 6.12 is currently available. Although poorly documented on their website, this supports C# 9. https://www.mono-project.com/docs/about-mono/versioning/#mono-source-versioning indicates mono 6.12 uses Roslyn 3.9.0. https://github.com/dotnet/roslyn/blob/main/docs/wiki/NuGet-packages.md#versioning indicates Roslyn 3.9.0 supports C# 9.

This unlocks C# 8 and C# 9 features previously unavailable to us.
- https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-80
- https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-9

A newer version of StyleCop is required to avoid rules tripping up on the new syntax. Currently only prerelease versions are available but their use is encouraged https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3420#issuecomment-994899135

Fix style rule violations on existing rules where the newer language version makes some existing casts redundant or allows use of the null coalescing assignment operator.
2023-04-05 15:27:41 +03:00
Thomas Christlieb
9e081763ad fix stance icon not updating when selecting units 2023-03-28 22:09:07 +03:00
RoosterDragon
53e9f44972 Spelling fixes 2023-03-02 20:11:54 +02:00
RoosterDragon
d4135d608e Fix IDE0039 2023-02-27 10:09:11 +01:00
RoosterDragon
99c1a4448b Fix IDE0030 2023-02-24 22:00:25 +02:00
penev92
2c51e791ad Added VideoPlayerWidget.LoadAndPlayAsync method
Previous commits removed the async loading of videos, which can be a problem for videos played in the radar widget mid-game because it can cause a lag spike. This loads the video on a separate thread and runs it on the main thread whenever it is loaded, not blocking the main thread meanwhile and allowing the game to continue while the video loads.
Also add back cancelling of already playing video and add a check to not try to run onComplete if it is null.
2023-02-18 14:10:24 +01:00
penev92
c3fcbf77ed Rename some VideoPlayerWidget methods for clarity 2023-02-18 14:10:24 +01:00
penev92
4135079290 Unify MediaGlobal/Scripting.Media PlayFMV* methods
- Improve consistency
- Remove dead code
- Removed AsyncAction!
- Delegate.BeginInvoke is unsupported since .NET Core and throws an "Operation is not supported on this platform." exception.
2023-02-18 14:10:24 +01:00
penev92
287428b487 Did a slight refactor pass on MediaGlobal
- Unified onPlayComplete callback handling to avoid code duplication.
- Fixed code style issues.
2023-02-18 14:10:24 +01:00
Azarus
77b06ac9f7 Add an option to check if an actor can be captured via Lua 2023-01-30 13:46:29 +02:00
Matthias Mailänder
867efcc6e8 Add Media.DisplayMessageToPlayer 2023-01-23 20:51:45 +01:00
Matthias Mailänder
847bbf5710 Use out parameter modifier code style. 2023-01-23 20:51:45 +01:00
abcdefg30
5bf7fe852c Remove the copyright year numbers 2023-01-11 11:58:54 +02:00
Matthias Mailänder
19ecddcd86 Enforce use of 'var' instead of explicit type. 2022-12-28 23:02:04 +01:00
Matthias Mailänder
b62cf7ee9a Add translation arguments to the Lua API. 2022-11-17 22:28:07 +02:00
abcdefg30
75f642bd09 Introduce FirstEnabledConditionalTraitOrDefault 2022-10-14 13:50:57 +03:00
Gustas
5abbdc37cb Revert "Fix crushables and crates causing HPF to crash."
This reverts commit 5765e51c56.
2022-10-07 21:06:04 +02:00
Gustas
043e6f662f Make demolition conditional 2022-10-04 21:55:17 +02:00
RoosterDragon
5765e51c56 Fix crushables and crates causing HPF to crash.
When crushables and crates change their Location/TopLeft, their crushability is cached, but when their CenterPosition is changed, their cached crushability is not refreshed. Since their CrushableBy functions depends on IsAtGroundLevel, which depends on the CenterPosition, this means that when the crushability is cached it will depend on the current height of the object. If the height of the object changes, the cache is not refreshed and now contains out of date information.

The Locomotor cache and the HPF both cache this same information, but at different times. HPF caches immediately, but Locomotor caches on demand which means there can be a delay. This means they can have inconsistent, differing views of the crushability information. This eventually surfaces in a "The abstract path should never be searched for an unreachable point." error from HPF when it detects the inconsistency.

The bug is that Locomotor was caching information without refreshing it when required. Fixing this to refresh the cache when the CenterPosition changes is likely to have negative performance impacts. As would removing crushability from the cache. These would both be fixes that address the underlying bug.

The high impacts of a proper fix lead us to a workaround instead. If we set the CenterPosition before setting the Location, then when the Location is set and the caches are refreshed, the new CenterPosition is available when caching the crushability information. This means logic depending on IsAtGroundLevel will get the new information and cache a more up-to-date view of things. This means when changing both the CenterPosition and Location together we now cache correct information. However calls that set only the CenterPosition and not the Location can still result in a bad cache state. Although this is imperfect it is an improvement over current affairs, and has less impact.
2022-09-24 15:15:53 +02:00
Matthias Mailänder
91fbd618ce Fix a crash when encountering 0 byte .vqa placeholders. 2022-07-12 23:23:28 +02:00
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
abcdefg30
4ec19b3486 Remove deprecated airstrike and paratrooper methods for Lua 2022-05-22 10:57:30 -05:00
abcdefg30
c827d1a4ab Remove deprecated integer facing handling for Lua 2022-05-22 10:57:30 -05:00
Eduardo Cáceres
aa998a46d9 Simplify collection initialization 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
79f321cb44 .Any(), .Count() -> .Count or .Length 2022-05-18 11:42:36 -05:00
RoosterDragon
ac0969d688 Use nameof instead of hardcoded strings in reflection calls.
This helps improve the safety of code the uses reflection when methods may get renamed, and helps navigating code as the nameof will show up when searching for references to members.
2022-04-14 19:58:15 +02:00
Matthias Mailänder
0e7ad43425 Remove unused parameters. 2022-04-01 23:30:26 +02:00
Mustafa Alperen Seki
0203476da9 Update variables for Flash lua function. 2022-03-05 15:19:01 +01:00