Add plumbing for notifying traits of movement

More precisely, about start and stop of movement.
This commit is contained in:
reaperrr
2018-08-26 13:49:23 +02:00
committed by Paul Chote
parent 32ab822786
commit a10af382b4
15 changed files with 102 additions and 84 deletions

View File

@@ -50,8 +50,8 @@ namespace OpenRA.Mods.Common.Traits
if (conditionManager == null)
return;
var isMovingVertically = Info.ConsiderVerticalMovement ? movement.IsMovingVertically : false;
var isMoving = !IsTraitDisabled && !self.IsDead && (movement.IsMoving || isMovingVertically);
var isMovingVertically = Info.ConsiderVerticalMovement ? movement.CurrentMovementTypes.HasFlag(MovementType.Vertical);
var isMoving = !IsTraitDisabled && !self.IsDead && (movement.CurrentMovementTypes.HasFlag(MovementType.Horizontal) || isMovingVertically);
if (isMoving && conditionToken == ConditionManager.InvalidConditionToken)
conditionToken = conditionManager.GrantCondition(self, Info.Condition);
else if (!isMoving && conditionToken != ConditionManager.InvalidConditionToken)