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,7 @@
*/
#endregion
using System.Collections.Generic;
using System.Collections.Frozen;
using System.Linq;
namespace OpenRA.Mods.Common.Traits
@@ -18,11 +18,11 @@ namespace OpenRA.Mods.Common.Traits
public class RejectsOrdersInfo : ConditionalTraitInfo
{
[Desc("Explicit list of rejected orders. Leave empty to reject all minus those listed under Except.")]
public readonly HashSet<string> Reject = [];
public readonly FrozenSet<string> Reject = FrozenSet<string>.Empty;
[Desc("List of orders that should *not* be rejected.",
"Also overrides other instances of this trait's Reject fields.")]
public readonly HashSet<string> Except = [];
public readonly FrozenSet<string> Except = FrozenSet<string>.Empty;
[Desc("Remove current and all queued orders from the actor when this trait is enabled.")]
public readonly bool RemoveOrders = false;
@@ -32,8 +32,8 @@ namespace OpenRA.Mods.Common.Traits
public class RejectsOrders : ConditionalTrait<RejectsOrdersInfo>
{
public HashSet<string> Reject => Info.Reject;
public HashSet<string> Except => Info.Except;
public FrozenSet<string> Reject => Info.Reject;
public FrozenSet<string> Except => Info.Except;
public RejectsOrders(RejectsOrdersInfo info)
: base(info) { }