Allow cancelling an activity without aborting the entire queue
This commit is contained in:
committed by
Paul Chote
parent
3111b2cf9b
commit
f9951f76ca
@@ -201,7 +201,7 @@ namespace OpenRA.Activities
|
||||
/// </summary>
|
||||
protected virtual void OnLastRun(Actor self) { }
|
||||
|
||||
public virtual bool Cancel(Actor self)
|
||||
public virtual bool Cancel(Actor self, bool keepQueue = false)
|
||||
{
|
||||
if (!IsInterruptible)
|
||||
return false;
|
||||
@@ -209,9 +209,11 @@ namespace OpenRA.Activities
|
||||
if (ChildActivity != null && !ChildActivity.Cancel(self))
|
||||
return false;
|
||||
|
||||
State = ActivityState.Canceled;
|
||||
NextActivity = null;
|
||||
if (!keepQueue)
|
||||
NextActivity = null;
|
||||
|
||||
ChildActivity = null;
|
||||
State = ActivityState.Canceled;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user