Set Mobile.IsMoving to "true" if queueing a turn that takes only a single tick

At the end of L-turns, actors often end up with an internal facing not 100% matching the direction of the next cell on their path.
As a result, if they haven't reached their destination yet, Move queues a quick Turn as ChildActivity, which previously was not considered as IsMoving.
However, we don't want those mini-turns to interrupt move animations, so we now consider them a move as well. Additionally, to avoid any issues, we make these mini-turns non-interruptible, just like the MovePart activities already are.
This commit is contained in:
reaperrr
2018-06-10 00:24:51 +02:00
committed by Paul Chote
parent e167d1f848
commit 4c239d4ebc
2 changed files with 29 additions and 2 deletions

View File

@@ -224,7 +224,14 @@ namespace OpenRA.Mods.Common.Activities
if (firstFacing != mobile.Facing)
{
path.Add(nextCell.Value.First);
QueueChild(new Turn(self, firstFacing));
// 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.
// To avoid issues, we also make these mini-turns uninterruptible (like MovePart activities) to ensure the actor
// finishes that mini-turn before starting something else.
var facingWithinTolerance = Util.FacingWithinTolerance(mobile.Facing, firstFacing, mobile.TurnSpeed);
QueueChild(new Turn(self, firstFacing, facingWithinTolerance, !facingWithinTolerance));
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
return this;
}