From b79aa7eb6af62dd6089a5ba0fa419c25bd9a6e68 Mon Sep 17 00:00:00 2001 From: tovl Date: Tue, 16 Jun 2020 19:22:53 +0200 Subject: [PATCH] Add AlwaysTurnInPlace option to Mobile. --- OpenRA.Mods.Common/Activities/Move/Move.cs | 4 ++++ OpenRA.Mods.Common/Traits/Mobile.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/OpenRA.Mods.Common/Activities/Move/Move.cs b/OpenRA.Mods.Common/Activities/Move/Move.cs index 122c779212..283fb46f55 100644 --- a/OpenRA.Mods.Common/Activities/Move/Move.cs +++ b/OpenRA.Mods.Common/Activities/Move/Move.cs @@ -496,6 +496,10 @@ namespace OpenRA.Mods.Common.Activities static bool IsTurn(Mobile mobile, CPos nextCell, Map map) { + // Some actors with a limited number of sprite facings should never move along curved trajectories. + if (mobile.Info.AlwaysTurnInPlace) + return false; + // Tight U-turns should be done in place instead of making silly looking loops. var nextFacing = map.FacingBetween(nextCell, mobile.ToCell, mobile.Facing); var currentFacing = map.FacingBetween(mobile.ToCell, mobile.FromCell, mobile.Facing); diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 7dd4f44a62..135bb50bb4 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -37,6 +37,9 @@ namespace OpenRA.Mods.Common.Traits public readonly int Speed = 1; + [Desc("If set to true, this unit will always turn in place instead of following a curved trajectory (like infantry).")] + public readonly bool AlwaysTurnInPlace = false; + [Desc("Cursor to display when a move order can be issued at target location.")] public readonly string Cursor = "move";