From 713b970f246fdc395536e7efd73567eaa35b0e1c Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Fri, 21 Oct 2016 08:59:15 +0200 Subject: [PATCH] Fully support unhardcoded sequences in the voxel render traits --- OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs | 2 +- OpenRA.Mods.TS/Traits/Render/WithVoxelUnloadBody.cs | 2 +- OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs index f5494ccdbf..27ef51adb4 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBody.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits.Render ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func orientation, int facings, PaletteReference p) { var body = init.Actor.TraitInfo(); - var voxel = VoxelProvider.GetVoxel(image, "idle"); + var voxel = VoxelProvider.GetVoxel(image, Sequence); yield return new VoxelAnimation(voxel, () => WVec.Zero, () => new[] { body.QuantizeOrientation(orientation(), facings) }, () => false, () => 0, ShowShadow); diff --git a/OpenRA.Mods.TS/Traits/Render/WithVoxelUnloadBody.cs b/OpenRA.Mods.TS/Traits/Render/WithVoxelUnloadBody.cs index b9360cdcc0..4b800a3f82 100644 --- a/OpenRA.Mods.TS/Traits/Render/WithVoxelUnloadBody.cs +++ b/OpenRA.Mods.TS/Traits/Render/WithVoxelUnloadBody.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.TS.Traits.Render ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func orientation, int facings, PaletteReference p) { var body = init.Actor.TraitInfo(); - var voxel = VoxelProvider.GetVoxel(image, "idle"); + var voxel = VoxelProvider.GetVoxel(image, IdleSequence); yield return new VoxelAnimation(voxel, () => WVec.Zero, () => new[] { body.QuantizeOrientation(orientation(), facings) }, () => false, () => 0, ShowShadow); diff --git a/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs b/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs index b7ef55f66b..501db4bee2 100644 --- a/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs +++ b/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs @@ -24,6 +24,8 @@ namespace OpenRA.Mods.TS.Traits.Render { public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires, Requires, Requires { + public readonly string Sequence = "idle"; + [Desc("The speed of the walker's legs.")] public readonly int TickRate = 5; @@ -34,7 +36,7 @@ namespace OpenRA.Mods.TS.Traits.Render public IEnumerable RenderPreviewVoxels( ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func orientation, int facings, PaletteReference p) { - var voxel = VoxelProvider.GetVoxel(image, "idle"); + var voxel = VoxelProvider.GetVoxel(image, Sequence); var body = init.Actor.TraitInfo(); var frame = init.Contains() ? init.Get() : 0; @@ -62,7 +64,7 @@ namespace OpenRA.Mods.TS.Traits.Render var body = self.Trait(); var rv = self.Trait(); - var voxel = VoxelProvider.GetVoxel(rv.Image, "idle"); + var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence); frames = voxel.Frames; rv.Add(new VoxelAnimation(voxel, () => WVec.Zero, () => new[] { body.QuantizeOrientation(self, self.Orientation) },