diff --git a/OpenRA.Game/Traits/LintAttributes.cs b/OpenRA.Game/Traits/LintAttributes.cs index fe5caf4fab..9b2c299aa4 100644 --- a/OpenRA.Game/Traits/LintAttributes.cs +++ b/OpenRA.Game/Traits/LintAttributes.cs @@ -55,10 +55,12 @@ namespace OpenRA.Traits { public readonly string ImageReference; // The field name in the same trait info that contains the image name. public readonly bool Prefix; - public SequenceReferenceAttribute(string imageReference = null, bool prefix = false) + public readonly bool ActorNameFallback; + public SequenceReferenceAttribute(string imageReference = null, bool prefix = false, bool actorNameFallback = false) { ImageReference = imageReference; Prefix = prefix; + ActorNameFallback = actorNameFallback; } } diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index 1296300d41..ab83086635 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -82,6 +82,12 @@ namespace OpenRA.Mods.Common.Lint { if (string.IsNullOrEmpty(imageOverride)) { + if (!sequenceReference.ActorNameFallback) + { + emitWarning("Custom sprite image of actor {0} is null and there is no fallback.".F(actorInfo.Value.Name)); + continue; + } + foreach (var sequenceProvider in sequenceProviders) { var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, faction); diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs index 9e703f2c8e..8b71544cfa 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly string Image = null; [FieldLoader.Require] - [SequenceReference("Image")] + [SequenceReference("Image", false, true)] [Desc("Sequence used for this decoration (can be animated).")] public readonly string Sequence = null; diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs index ff5fe46c7b..7111b51f77 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs @@ -23,11 +23,11 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Image used for this decoration. Defaults to the actor's type.")] public readonly string Image = null; - [SequenceReference("Image")] + [SequenceReference("Image", false, true)] [Desc("Animation to play when the actor is created.")] public readonly string StartSequence = null; - [SequenceReference("Image")] + [SequenceReference("Image", false, true)] [Desc("Sequence name to use")] public readonly string Sequence = "idle-overlay";