Replaced Canceled state with Canceling state.
This commit is contained in:
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Activities
|
||||
{
|
||||
public enum ActivityState { Queued, Active, Done, Canceled }
|
||||
public enum ActivityState { Queued, Active, Canceling, Done }
|
||||
|
||||
/*
|
||||
* Activities are actions carried out by actors during each tick.
|
||||
@@ -99,7 +99,7 @@ namespace OpenRA.Activities
|
||||
{
|
||||
get
|
||||
{
|
||||
return childActivity != null && childActivity.State != ActivityState.Done ? childActivity : null;
|
||||
return childActivity != null && childActivity.State < ActivityState.Done ? childActivity : null;
|
||||
}
|
||||
|
||||
set
|
||||
@@ -153,7 +153,7 @@ namespace OpenRA.Activities
|
||||
}
|
||||
|
||||
public bool IsInterruptible { get; protected set; }
|
||||
public bool IsCanceled { get { return State == ActivityState.Canceled; } }
|
||||
public bool IsCanceling { get { return State == ActivityState.Canceling; } }
|
||||
|
||||
public Activity()
|
||||
{
|
||||
@@ -179,8 +179,7 @@ namespace OpenRA.Activities
|
||||
if (ParentActivity != null && ParentActivity != ret)
|
||||
ParentActivity.ChildActivity = ret;
|
||||
|
||||
if (State != ActivityState.Canceled)
|
||||
State = ActivityState.Done;
|
||||
State = ActivityState.Done;
|
||||
|
||||
OnLastRun(self);
|
||||
}
|
||||
@@ -220,16 +219,16 @@ namespace OpenRA.Activities
|
||||
|
||||
public virtual bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!keepQueue)
|
||||
NextInQueue = null;
|
||||
|
||||
if (!IsInterruptible)
|
||||
return false;
|
||||
|
||||
if (ChildActivity != null && !ChildActivity.Cancel(self))
|
||||
return false;
|
||||
if (ChildActivity != null)
|
||||
ChildActivity.Cancel(self);
|
||||
|
||||
if (!keepQueue)
|
||||
NextActivity = null;
|
||||
|
||||
State = ActivityState.Canceled;
|
||||
State = ActivityState.Canceling;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (rearmableInfo != null && ammoPools.Any(p => p.Info.Name == info.AmmoPoolName && !p.HasAmmo()))
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
if (IsCanceling || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
if (attack.IsTraitDisabled)
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || !attack.CanAttack(self, target))
|
||||
if (IsCanceling || !attack.CanAttack(self, target))
|
||||
return NextActivity;
|
||||
|
||||
if (attack.charges == 0)
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || !attack.CanAttack(self, target))
|
||||
if (IsCanceling || !attack.CanAttack(self, target))
|
||||
return NextActivity;
|
||||
|
||||
if (attack.charges == 0)
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
Cancel(self);
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
Cancel(self);
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (remainingTicks > 0)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
Cancel(self);
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
if (IsCanceled || !self.World.Map.Contains(self.Location))
|
||||
if (IsCanceling || !self.World.Map.Contains(self.Location))
|
||||
return NextActivity;
|
||||
|
||||
Fly.FlyToward(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
if (IsCanceled || remainingTicks-- == 0)
|
||||
if (IsCanceling || remainingTicks-- == 0)
|
||||
return NextActivity;
|
||||
|
||||
Fly.FlyToward(self, aircraft, aircraft.Facing, cruiseAltitude);
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
Cancel(self);
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
Cancel(self);
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
@@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
var activity = base.Tick(self);
|
||||
|
||||
if (activity == null && !IsCanceled && info.LandWhenIdle)
|
||||
if (activity == null && !IsCanceling && info.LandWhenIdle)
|
||||
{
|
||||
if (info.TurnToLand)
|
||||
self.QueueActivity(new Turn(self, info.InitialFacing));
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (HeliFly.AdjustAltitude(self, aircraft, aircraft.Info.CruiseAltitude))
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (requireSpace && !aircraft.CanLand(self.Location))
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
return NextActivity;
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (dest == null || dest.IsDead || !Reservable.IsAvailableFor(dest, self))
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (!target.IsValidFor(self))
|
||||
Cancel(self);
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (!soundPlayed && aircraft.Info.LandingSounds.Length > 0 && !self.IsAtGroundLevel())
|
||||
|
||||
@@ -51,11 +51,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
// Conditional fixes being able to stop aircraft from resupplying.
|
||||
if (IsCanceled && NextInQueue == null)
|
||||
{
|
||||
OnFirstRun(self);
|
||||
return this;
|
||||
}
|
||||
if (IsCanceling && NextInQueue == null)
|
||||
return new ResupplyAircraft(self);
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (aircraft.ForceLanding)
|
||||
return NextActivity;
|
||||
|
||||
if (IsCanceled || self.IsDead)
|
||||
if (IsCanceling || self.IsDead)
|
||||
return NextActivity;
|
||||
|
||||
if (!isCalculated)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
protected virtual AttackStatus TickAttack(Actor self, AttackFrontal attack)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return AttackStatus.UnableToAttack;
|
||||
|
||||
if (!target.IsValidFor(self))
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if ((carryall.State == Carryall.CarryallState.Idle || carryall.Carryable.IsDead) && state != DeliveryState.TakeOff)
|
||||
@@ -208,8 +208,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsCanceled && innerActivity != null && !innerActivity.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && innerActivity != null)
|
||||
innerActivity.Cancel(self);
|
||||
|
||||
return base.Cancel(self);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
// Without this, turn for facing deploy angle will be canceled and immediately deploy!
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (IsInterruptible)
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
useLastVisibleTarget = targetIsHiddenActor || !target.IsValidFor(self);
|
||||
|
||||
// Cancel immediately if the target died while we were entering it
|
||||
if (!IsCanceled && useLastVisibleTarget && lastState == EnterState.Entering)
|
||||
if (!IsCanceling && useLastVisibleTarget && lastState == EnterState.Entering)
|
||||
Cancel(self, true);
|
||||
|
||||
TickInner(self, target, useLastVisibleTarget);
|
||||
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
// NOTE: We can safely cancel in this case because we know the
|
||||
// actor has finished any in-progress move activities
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
// Lost track of the target
|
||||
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// Subclasses can cancel the activity during TryStartEnter
|
||||
// Return immediately to avoid an extra tick's delay
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
lastState = EnterState.Waiting;
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
// Check that we reached the requested position
|
||||
var targetPos = target.Positions.PositionClosestTo(self.CenterPosition);
|
||||
if (!IsCanceled && self.CenterPosition == targetPos && target.Type == TargetType.Actor)
|
||||
if (!IsCanceling && self.CenterPosition == targetPos && target.Type == TargetType.Actor)
|
||||
OnEnterComplete(self, target.Actor);
|
||||
|
||||
lastState = EnterState.Exiting;
|
||||
@@ -164,8 +164,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
OnCancel(self);
|
||||
|
||||
if (!IsCanceled && moveActivity != null && !moveActivity.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && moveActivity != null)
|
||||
moveActivity.Cancel(self);
|
||||
|
||||
return base.Cancel(self, keepQueue);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
// Try and find a new transport nearby
|
||||
if (IsCanceled || string.IsNullOrEmpty(type))
|
||||
if (IsCanceling || string.IsNullOrEmpty(type))
|
||||
return NextActivity;
|
||||
|
||||
Func<Actor, bool> isValidTransport = a =>
|
||||
@@ -135,8 +135,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsCanceled && enterTransport != null && !enterTransport.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && enterTransport != null)
|
||||
enterTransport.Cancel(self);
|
||||
|
||||
return base.Cancel(self, keepQueue);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (harv.IsFull)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
{
|
||||
claimLayer.RemoveClaim(self);
|
||||
return NextActivity;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
var target = targets.ClosestTo(self);
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsCanceled && inner != null && !inner.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && inner != null)
|
||||
inner.Cancel(self);
|
||||
|
||||
return base.Cancel(self, keepQueue);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
bool targetIsHiddenActor;
|
||||
|
||||
@@ -144,37 +144,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (ChildActivity == null)
|
||||
return base.Cancel(self, keepQueue);
|
||||
|
||||
// Although MoveFirstHalf and MoveSecondHalf can't be interrupted,
|
||||
// we prevent them from moving forever by removing the path.
|
||||
if (path != null)
|
||||
path.Clear();
|
||||
|
||||
// Remove queued activities
|
||||
if (!keepQueue && NextInQueue != null)
|
||||
NextInQueue = null;
|
||||
|
||||
// In current implementation, ChildActivity can be Turn, MoveFirstHalf and MoveSecondHalf.
|
||||
// Turn may be interrupted freely while they are turning.
|
||||
// Unlike Turn, MoveFirstHalf and MoveSecondHalf are not Interruptable, but clearing the
|
||||
// path guarantees that they will return as soon as possible, once the actor is back in a
|
||||
// valid position.
|
||||
// This means that it is safe to unconditionally return true, which avoids breaking parent
|
||||
// activities that rely on cancellation succeeding (but not necessarily immediately)
|
||||
ChildActivity.Cancel(self, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
// ChildActivity is the top priority, unlike other activities.
|
||||
// Even if this activity is canceled, we must let the child be run so that units
|
||||
// will not end up in an odd place.
|
||||
// Let the child be run so that units will not end up in an odd place.
|
||||
if (ChildActivity != null)
|
||||
{
|
||||
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||
@@ -187,7 +159,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// If the actor is inside a tunnel then we must let them move
|
||||
// all the way through before moving to the next activity
|
||||
if (IsCanceled && self.Location.Layer != CustomMovementLayerType.Tunnel)
|
||||
if (IsCanceling && self.Location.Layer != CustomMovementLayerType.Tunnel)
|
||||
return NextActivity;
|
||||
|
||||
if (mobile.IsTraitDisabled || mobile.IsTraitPaused)
|
||||
@@ -440,7 +412,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var fromSubcellOffset = map.Grid.OffsetOfSubCell(mobile.FromSubCell);
|
||||
var toSubcellOffset = map.Grid.OffsetOfSubCell(mobile.ToSubCell);
|
||||
|
||||
if (!IsCanceled || self.Location.Layer == CustomMovementLayerType.Tunnel)
|
||||
if (!IsCanceling || self.Location.Layer == CustomMovementLayerType.Tunnel)
|
||||
{
|
||||
var nextCell = parent.PopPath(self);
|
||||
if (nextCell != null)
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
// We are done here if the order was cancelled for any
|
||||
// reason except the target moving.
|
||||
if (IsCanceled || !repath || !targetIsValid)
|
||||
if (IsCanceling || !repath || !targetIsValid)
|
||||
return NextActivity;
|
||||
|
||||
// Target has moved, and MoveAdjacentTo is still valid.
|
||||
@@ -169,8 +169,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsCanceled && inner != null && !inner.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && inner != null)
|
||||
inner.Cancel(self);
|
||||
|
||||
return base.Cancel(self);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
if (IsCanceled || target.Type == TargetType.Invalid)
|
||||
if (IsCanceling || target.Type == TargetType.Invalid)
|
||||
return NextActivity;
|
||||
|
||||
if (mobile.IsTraitDisabled || mobile.IsTraitPaused)
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (cargo != carryall.Carryable)
|
||||
return NextActivity;
|
||||
|
||||
if (cargo.IsDead || IsCanceled || carryable.IsTraitDisabled || !cargo.AppearsFriendlyTo(self))
|
||||
if (cargo.IsDead || IsCanceling || carryable.IsTraitDisabled || !cargo.AppearsFriendlyTo(self))
|
||||
{
|
||||
carryall.UnreserveCarryable(self);
|
||||
return NextActivity;
|
||||
@@ -161,8 +161,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsCanceled && innerActivity != null && !innerActivity.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && innerActivity != null)
|
||||
innerActivity.Cancel(self);
|
||||
|
||||
return base.Cancel(self, keepQueue);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (host.Type == TargetType.Invalid)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled) return NextActivity;
|
||||
if (IsCanceling) return NextActivity;
|
||||
self.Dispose();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
{
|
||||
if (remainingTicks-- == 0)
|
||||
return NextActivity;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (ChildActivity != null)
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
protected override void OnLastRun(Actor self)
|
||||
{
|
||||
if (!IsCanceled)
|
||||
if (!IsCanceling)
|
||||
DoTransform(self);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsInterruptible && IsCanceled)
|
||||
if (IsInterruptible && IsCanceling)
|
||||
return NextActivity;
|
||||
|
||||
if (disablable != null && disablable.IsTraitDisabled)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
cargo.Unloading = false;
|
||||
if (IsCanceled || cargo.IsEmpty(self))
|
||||
if (IsCanceling || cargo.IsEmpty(self))
|
||||
return NextActivity;
|
||||
|
||||
foreach (var inu in notifiers)
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsCanceled && inner != null && !inner.Cancel(self))
|
||||
return false;
|
||||
if (!IsCanceling && inner != null)
|
||||
inner.Cancel(self);
|
||||
|
||||
return base.Cancel(self, keepQueue);
|
||||
}
|
||||
|
||||
@@ -45,9 +45,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!base.Cancel(self, keepQueue))
|
||||
return false;
|
||||
|
||||
base.Cancel(self, keepQueue);
|
||||
Dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled)
|
||||
if (IsCanceling)
|
||||
{
|
||||
// Cancel the requested target, but keep firing on it while in range
|
||||
attack.opportunityTarget = attack.requestedTarget;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// This activity can't move to reacquire hidden targets, so use the
|
||||
// Recalculate overload that invalidates hidden targets.
|
||||
target = target.RecalculateInvalidatingHiddenTargets(self.Owner);
|
||||
if (IsCanceled || !target.IsValidFor(self) || !attack.IsReachableTarget(target, allowMove))
|
||||
if (IsCanceling || !target.IsValidFor(self) || !attack.IsReachableTarget(target, allowMove))
|
||||
return NextActivity;
|
||||
|
||||
attack.DoAttack(self, target);
|
||||
|
||||
Reference in New Issue
Block a user