Add ConsumedByCapture flag to emulate legacy external behaviour.

This commit is contained in:
Paul Chote
2018-09-29 20:48:39 +00:00
committed by abcdefg30
parent 4d2f1f8942
commit 50423b13fb
3 changed files with 39 additions and 14 deletions

View File

@@ -167,8 +167,10 @@ namespace OpenRA.Mods.Common.Traits
/// This method grants the capturing conditions on the captor and target and returns
/// true if the captor is able to start entering or false if it needs to wait.
/// </summary>
public bool StartCapture(Actor self, Actor target, CaptureManager targetManager)
public bool StartCapture(Actor self, Actor target, CaptureManager targetManager, out Captures captures)
{
captures = null;
if (target != currentTarget)
{
if (currentTarget != null)
@@ -189,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
targetManager.beingCapturedToken == ConditionManager.InvalidConditionToken)
targetManager.beingCapturedToken = targetManager.conditionManager.GrantCondition(target, targetManager.info.BeingCapturedCondition);
var captures = enabledCaptures
captures = enabledCaptures
.OrderBy(c => c.Info.CaptureDelay)
.FirstOrDefault(c => targetManager.CanBeTargetedBy(target, self, c));
@@ -199,7 +201,7 @@ namespace OpenRA.Mods.Common.Traits
if (progressWatchers.Any() || targetManager.progressWatchers.Any())
{
currentTargetTotal = captures.Info.CaptureDelay;
if (move != null)
if (move != null && captures.Info.ConsumedByCapture)
{
var pos = target.GetTargetablePositions().PositionClosestTo(self.CenterPosition);
currentTargetTotal += move.EstimatedMoveDuration(self, self.CenterPosition, pos);