From 6984c0ec105c762c4fc29f7f1b1ae9ea68904e83 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 10 Jun 2018 00:39:48 +0200 Subject: [PATCH] Add AlwaysConsiderTurnAsMove plumbing to Mobile Can be used to make walker units like the TS mechs display move animations while turning on the spot. --- OpenRA.Mods.Common/Activities/Move/Move.cs | 5 +++++ OpenRA.Mods.Common/Traits/Mobile.cs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/OpenRA.Mods.Common/Activities/Move/Move.cs b/OpenRA.Mods.Common/Activities/Move/Move.cs index 33d8b6b579..072d665194 100644 --- a/OpenRA.Mods.Common/Activities/Move/Move.cs +++ b/OpenRA.Mods.Common/Activities/Move/Move.cs @@ -225,6 +225,11 @@ namespace OpenRA.Mods.Common.Activities { path.Add(nextCell.Value.First); + // If Mobile.Info.AlwaysConsiderTurnAsMove is true, we consider Turn as movement regardless of facing delta size. + // IsMoving is then set back to false in Turn.OnLastRun. + // This is needed for actors that want to display their movement animation during turns (walker units, for example). + mobile.IsMoving = mobile.Info.AlwaysConsiderTurnAsMove; + // HACK: To fix visual hiccups on actors with move animations during "L-turn to next part of movement" transitions // or invisible mini-turns (due to less sprite facings than internal facings), we set IsMoving to 'true' during Turn activity // when the facing delta is low enough to be covered with a single Turn tick. diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 3adaa27067..d7c1bd96d9 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -35,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Speed at which the actor turns.")] public readonly int TurnSpeed = 255; + [Desc("Should turning always be considering as moving (instead of only turning while moving forward).")] + public readonly bool AlwaysConsiderTurnAsMove = false; + public readonly int Speed = 1; public readonly string Cursor = "move";