Add a sequence reference attribute to label fallbacks.

This commit is contained in:
Matthias Mailänder
2020-05-17 14:45:51 +02:00
committed by teinarss
parent 336656e8f7
commit 3a427c3630
4 changed files with 12 additions and 4 deletions

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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";