From 2e0719f1fdfdba38a4c5962fa800e572567b8a5c Mon Sep 17 00:00:00 2001 From: teees Date: Wed, 4 Nov 2015 16:08:08 +0100 Subject: [PATCH] tick VoxelWalker move animation when turning --- OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs b/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs index b92f31d624..6ce8ea49df 100644 --- a/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs +++ b/OpenRA.Mods.TS/Traits/Render/WithVoxelWalkerBody.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.TS.Traits { - public class WithVoxelWalkerBodyInfo : ITraitInfo, Requires, Requires + public class WithVoxelWalkerBodyInfo : ITraitInfo, Requires, Requires, Requires { public readonly int TickRate = 5; public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); } @@ -26,6 +26,8 @@ namespace OpenRA.Mods.TS.Traits { WithVoxelWalkerBodyInfo info; IMove movement; + IFacing facing; + int oldFacing; int2 size; uint tick, frame, frames; @@ -33,6 +35,7 @@ namespace OpenRA.Mods.TS.Traits { this.info = info; movement = self.Trait(); + facing = self.Trait(); var body = self.Trait(); var rv = self.Trait(); @@ -53,8 +56,9 @@ namespace OpenRA.Mods.TS.Traits public void Tick(Actor self) { - if (movement.IsMoving) + if (movement.IsMoving || facing.Facing != oldFacing) tick++; + oldFacing = facing.Facing; if (tick < info.TickRate) return;