1
0
Fork 0

Drop required properties syntax

Sometimes, seemingly after random unrelated changes, it might stop
compiling with internal compiler error messages about missing features
and attributes. .NET Standard 2.1 is not supposed to support any
features beyond C# 8.0, while `required` attribute was introduced only
in C# 11 or 12, it's hard to tell.
This commit is contained in:
ivan tkachenko 2025-08-22 15:13:54 +03:00
parent 70e45d5ba2
commit 327e606deb
1 changed files with 9 additions and 9 deletions

View File

@ -932,8 +932,8 @@ namespace MuzikaGromche
// Suitable to declare elemnents of SelectableTracksGroup and as a base for standalone selectable tracks. // Suitable to declare elemnents of SelectableTracksGroup and as a base for standalone selectable tracks.
public class CoreAudioTrack : IAudioTrack public class CoreAudioTrack : IAudioTrack
{ {
public required string Name { get; init; } public /* required */ string Name { get; init; } = "";
public required float WindUpTimer { get; init; } public /* required */ float WindUpTimer { get; init; } = 0f;
public int Beats { get; init; } public int Beats { get; init; }
// Shorthand for four beats // Shorthand for four beats
@ -1006,7 +1006,7 @@ namespace MuzikaGromche
// Standalone, top-level, selectable audio track // Standalone, top-level, selectable audio track
public class SelectableAudioTrack : CoreAudioTrack, ISelectableTrack public class SelectableAudioTrack : CoreAudioTrack, ISelectableTrack
{ {
public required Language Language { get; init; } public /* required */ Language Language { get; init; }
public bool IsExplicit { get; init; } = false; public bool IsExplicit { get; init; } = false;
ConfigEntry<int> ISelectableTrack.Weight { get; set; } = null!; ConfigEntry<int> ISelectableTrack.Weight { get; set; } = null!;
@ -1022,12 +1022,12 @@ namespace MuzikaGromche
public class SelectableTracksGroup : ISelectableTrack public class SelectableTracksGroup : ISelectableTrack
{ {
public required string Name { get; init; } public /* required */ string Name { get; init; } = "";
public required Language Language { get; init; } public /* required */ Language Language { get; init; }
public bool IsExplicit { get; init; } = false; public bool IsExplicit { get; init; } = false;
ConfigEntry<int> ISelectableTrack.Weight { get; set; } = null!; ConfigEntry<int> ISelectableTrack.Weight { get; set; } = null!;
public required IAudioTrack[] Tracks; public /* required */ IAudioTrack[] Tracks = [];
IAudioTrack[] ISelectableTrack.GetTracks() => Tracks; IAudioTrack[] ISelectableTrack.GetTracks() => Tracks;
@ -2393,9 +2393,9 @@ namespace MuzikaGromche
class State class State
{ {
public required int currentBehaviourStateIndex; public int currentBehaviourStateIndex;
public required int previousState; public int previousState;
public required float stunNormalizedTimer; public float stunNormalizedTimer;
} }
[HarmonyPatch(nameof(JesterAI.Update))] [HarmonyPatch(nameof(JesterAI.Update))]