Skip to content

Commit

Permalink
Add AlwaysTurnInPlace option to Mobile.
Browse files Browse the repository at this point in the history
  • Loading branch information
tovl authored and abcdefg30 committed Jun 27, 2020
1 parent 1c8c49d commit b79aa7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions OpenRA.Mods.Common/Activities/Move/Move.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ public MoveFirstHalf(Move move, WPos from, WPos to, WAngle fromFacing, WAngle to

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);
Expand Down
3 changes: 3 additions & 0 deletions OpenRA.Mods.Common/Traits/Mobile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class MobileInfo : PausableConditionalTraitInfo, IMoveInfo, IPositionable

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";

Expand Down

0 comments on commit b79aa7e

Please sign in to comment.