Properly end capturing during an owner change
This commit is contained in:
@@ -50,7 +50,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
BeginCapture(self);
|
BeginCapture(self);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (capturable.Captor != self) return NextActivity;
|
if (capturable.Captor != self)
|
||||||
|
return NextActivity;
|
||||||
|
|
||||||
if (capturable.CaptureProgressTime % 25 == 0)
|
if (capturable.CaptureProgressTime % 25 == 0)
|
||||||
{
|
{
|
||||||
@@ -99,8 +100,9 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
void EndCapture(Actor self)
|
void EndCapture(Actor self)
|
||||||
{
|
{
|
||||||
if (target.Type == TargetType.Actor && capturable.CaptureInProgress)
|
if (capturable.CaptureInProgress)
|
||||||
capturable.EndCapture();
|
capturable.EndCapture();
|
||||||
|
|
||||||
if (capturingToken != ConditionManager.InvalidConditionToken)
|
if (capturingToken != ConditionManager.InvalidConditionToken)
|
||||||
capturingToken = conditionManager.RevokeCondition(self, capturingToken);
|
capturingToken = conditionManager.RevokeCondition(self, capturingToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,18 +52,18 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
[Sync] public int CaptureProgressTime = 0;
|
[Sync] public int CaptureProgressTime = 0;
|
||||||
[Sync] public Actor Captor;
|
[Sync] public Actor Captor;
|
||||||
private Actor self;
|
|
||||||
public bool CaptureInProgress { get { return Captor != null; } }
|
public bool CaptureInProgress { get { return Captor != null; } }
|
||||||
|
|
||||||
|
readonly Building building;
|
||||||
|
|
||||||
public ExternalCapturable(Actor self, ExternalCapturableInfo info)
|
public ExternalCapturable(Actor self, ExternalCapturableInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
{
|
{
|
||||||
this.self = self;
|
building = self.TraitOrDefault<Building>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginCapture(Actor captor)
|
public void BeginCapture(Actor captor)
|
||||||
{
|
{
|
||||||
var building = self.TraitOrDefault<Building>();
|
|
||||||
if (building != null)
|
if (building != null)
|
||||||
building.Lock();
|
building.Lock();
|
||||||
|
|
||||||
@@ -72,7 +72,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public void EndCapture()
|
public void EndCapture()
|
||||||
{
|
{
|
||||||
var building = self.TraitOrDefault<Building>();
|
|
||||||
if (building != null)
|
if (building != null)
|
||||||
building.Unlock();
|
building.Unlock();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user