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

@@ -18,18 +18,18 @@ namespace OpenRA.Mods.Common.Traits
{
public class ControlGroupsInfo : TraitInfo, IControlGroupsInfo
{
public readonly string[] Groups = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
public readonly ImmutableArray<string> Groups = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
public override object Create(ActorInitializer init) { return new ControlGroups(init.World, this); }
string[] IControlGroupsInfo.Groups => Groups;
ImmutableArray<string> IControlGroupsInfo.Groups => Groups;
}
[TraitLocation(SystemActors.World | SystemActors.EditorWorld)]
public class ControlGroups : IControlGroups, ITick, IGameSaveTraitData
{
readonly World world;
public string[] Groups { get; }
public ImmutableArray<string> Groups { get; }
readonly List<Actor>[] controlGroups;