diff --git a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs index 29e6619785..88b7cd76db 100644 --- a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs +++ b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs @@ -31,14 +31,23 @@ namespace OpenRA.Mods.Common.Lint foreach (var actorInfo in rules.Actors) { + if (actorInfo.Key.StartsWith("^")) + continue; + foreach (var trait in actorInfo.Value.TraitInfos()) { var fields = trait.GetType().GetFields(); foreach (var field in fields.Where(x => x.HasAttribute())) { var values = LintExts.GetFieldValues(trait, field, emitError); - foreach (var value in values.Where(x => !upgradesGranted.Contains(x))) - emitError("Actor type `{0}` uses upgrade `{1}` that is not granted by anything!".F(actorInfo.Key, value)); + foreach (var value in values) + { + if (!upgradesGranted.Contains(value)) + emitError("Actor type `{0}` uses upgrade `{1}` that is not granted by anything!".F(actorInfo.Key, value)); + + if (actorInfo.Value.TraitInfoOrDefault() == null) + emitError("Actor type `{0}` uses upgrade `{1}`, but doesn't have the UpgradeManager trait.".F(actorInfo.Key, value)); + } } } } @@ -51,6 +60,9 @@ namespace OpenRA.Mods.Common.Lint // Check all upgrades granted by traits. foreach (var actorInfo in rules.Actors) { + if (actorInfo.Key.StartsWith("^")) + continue; + foreach (var trait in actorInfo.Value.TraitInfos()) { var fields = trait.GetType().GetFields();