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

@@ -9,7 +9,9 @@
*/
#endregion
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -22,11 +24,11 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Condition = null;
[Desc("Name of the armaments that grant this condition.")]
public readonly HashSet<string> ArmamentNames = ["primary"];
public readonly FrozenSet<string> ArmamentNames = new HashSet<string> { "primary" }.ToFrozenSet();
[Desc("Shots required to apply an instance of the condition. If there are more instances of the condition granted than values listed,",
"the last value is used for all following instances beyond the defined range.")]
public readonly int[] RequiredShotsPerInstance = [1];
public readonly ImmutableArray<int> RequiredShotsPerInstance = [1];
[Desc("Maximum instances of the condition to grant.")]
public readonly int MaximumInstances = 1;