Also check for a missing UpgradeManager trait
as optional upgrades will otherwise be silently non-functional.
This commit is contained in:
@@ -40,8 +40,14 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
foreach (var field in fields.Where(x => x.HasAttribute<UpgradeUsedReferenceAttribute>()))
|
foreach (var field in fields.Where(x => x.HasAttribute<UpgradeUsedReferenceAttribute>()))
|
||||||
{
|
{
|
||||||
var values = LintExts.GetFieldValues(trait, field, emitError);
|
var values = LintExts.GetFieldValues(trait, field, emitError);
|
||||||
foreach (var value in values.Where(x => !upgradesGranted.Contains(x)))
|
foreach (var value in values)
|
||||||
emitError("Actor type `{0}` uses upgrade `{1}` that is not granted by anything!".F(actorInfo.Key, value));
|
{
|
||||||
|
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<UpgradeManagerInfo>() == null)
|
||||||
|
emitError("Actor type `{0}` uses upgrade `{1}`, but doesn't have the UpgradeManager trait.".F(actorInfo.Key, value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user