Add a sequence reference attribute to label fallbacks.
This commit is contained in:
committed by
teinarss
parent
336656e8f7
commit
3a427c3630
@@ -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 string ImageReference; // The field name in the same trait info that contains the image name.
|
||||||
public readonly bool Prefix;
|
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;
|
ImageReference = imageReference;
|
||||||
Prefix = prefix;
|
Prefix = prefix;
|
||||||
|
ActorNameFallback = actorNameFallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(imageOverride))
|
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)
|
foreach (var sequenceProvider in sequenceProviders)
|
||||||
{
|
{
|
||||||
var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, faction);
|
var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, faction);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
public readonly string Image = null;
|
public readonly string Image = null;
|
||||||
|
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[SequenceReference("Image")]
|
[SequenceReference("Image", false, true)]
|
||||||
[Desc("Sequence used for this decoration (can be animated).")]
|
[Desc("Sequence used for this decoration (can be animated).")]
|
||||||
public readonly string Sequence = null;
|
public readonly string Sequence = null;
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
||||||
public readonly string Image = null;
|
public readonly string Image = null;
|
||||||
|
|
||||||
[SequenceReference("Image")]
|
[SequenceReference("Image", false, true)]
|
||||||
[Desc("Animation to play when the actor is created.")]
|
[Desc("Animation to play when the actor is created.")]
|
||||||
public readonly string StartSequence = null;
|
public readonly string StartSequence = null;
|
||||||
|
|
||||||
[SequenceReference("Image")]
|
[SequenceReference("Image", false, true)]
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
public readonly string Sequence = "idle-overlay";
|
public readonly string Sequence = "idle-overlay";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user