diff --git a/OpenRA.Game/Traits/LintAttributes.cs b/OpenRA.Game/Traits/LintAttributes.cs index 2f3776921c..b89efab64d 100644 --- a/OpenRA.Game/Traits/LintAttributes.cs +++ b/OpenRA.Game/Traits/LintAttributes.cs @@ -23,10 +23,21 @@ namespace OpenRA.Traits [AttributeUsage(AttributeTargets.Field)] public sealed class ActorReferenceAttribute : Attribute { - public Type[] RequiredTraits; - public ActorReferenceAttribute(params Type[] requiredTraits) + public readonly Type[] RequiredTraits; + public readonly LintDictionaryReference DictionaryReference; + + public ActorReferenceAttribute(Type[] requiredTraits, + LintDictionaryReference dictionaryReference = LintDictionaryReference.None) { RequiredTraits = requiredTraits; + DictionaryReference = dictionaryReference; + } + + public ActorReferenceAttribute(Type requiredTrait = null, + LintDictionaryReference dictionaryReference = LintDictionaryReference.None) + { + RequiredTraits = requiredTrait != null ? new[] { requiredTrait } : new Type[0]; + DictionaryReference = dictionaryReference; } } diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs index ca15dba5db..60454d98b5 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/DropPodsPower.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc.Traits { [FieldLoader.Require] [Desc("Drop pod unit")] - [ActorReference(typeof(AircraftInfo), typeof(FallsToEarthInfo))] + [ActorReference(new[] { typeof(AircraftInfo), typeof(FallsToEarthInfo) })] public readonly string[] UnitTypes = null; [Desc("Number of drop pods spawned.")] diff --git a/OpenRA.Mods.Common/Lint/CheckActorReferences.cs b/OpenRA.Mods.Common/Lint/CheckActorReferences.cs index e41e9e7d62..22639487c8 100644 --- a/OpenRA.Mods.Common/Lint/CheckActorReferences.cs +++ b/OpenRA.Mods.Common/Lint/CheckActorReferences.cs @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Lint IReadOnlyDictionary dict, ActorReferenceAttribute attribute) { - var values = LintExts.GetFieldValues(traitInfo, fieldInfo, emitError); + var values = LintExts.GetFieldValues(traitInfo, fieldInfo, emitError, attribute.DictionaryReference); foreach (var value in values) { if (value == null)