Allow all sprites to use interpolated facings.

This commit is contained in:
Paul Chote
2022-12-29 14:31:26 +13:00
committed by Gustas
parent b051211842
commit a6f3db0a45
4 changed files with 16 additions and 22 deletions

View File

@@ -23,14 +23,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Defines sequence to derive facings from.")]
public readonly string Sequence = "idle";
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequences, string faction)
{
if (string.IsNullOrEmpty(Sequence))
throw new InvalidOperationException("Actor " + ai.Name + " is missing sequence to quantize facings from.");
throw new InvalidOperationException($"Actor {ai.Name} is missing sequence to quantize facings from.");
var rsi = ai.TraitInfo<RenderSpritesInfo>();
var seq = sequenceProvider.GetSequence(rsi.GetImage(ai, race), Sequence);
return seq.InterpolatedFacings == -1 ? seq.Facings : seq.InterpolatedFacings;
return sequences.GetSequence(rsi.GetImage(ai, faction), Sequence).Facings;
}
public override object Create(ActorInitializer init) { return new QuantizeFacingsFromSequence(this); }