Change classes that use FieldLoader to use read-only collections.

This commit is contained in:
RoosterDragon
2025-11-08 12:40:56 +00:00
committed by Paul Chote
parent 797c71e500
commit 649e7e8c28
308 changed files with 1233 additions and 901 deletions

View File

@@ -10,6 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Collections.Immutable;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits.Sound
@@ -18,15 +19,15 @@ namespace OpenRA.Mods.Common.Traits.Sound
sealed class AmbientSoundInfo : ConditionalTraitInfo
{
[FieldLoader.Require]
public readonly string[] SoundFiles = null;
public readonly ImmutableArray<string> SoundFiles = default;
[Desc("Initial delay (in ticks) before playing the sound for the first time.",
"Two values indicate a random delay range.")]
public readonly int[] Delay = [0];
public readonly ImmutableArray<int> Delay = [0];
[Desc("Interval between playing the sound (in ticks).",
"Two values indicate a random delay range.")]
public readonly int[] Interval = [0];
public readonly ImmutableArray<int> Interval = [0];
public override object Create(ActorInitializer init) { return new AmbientSound(init.Self, this); }
}