move counter-capture logic down into Capturable; remove spurious interlock on CaptureInProgress

This commit is contained in:
Chris Forbes
2012-09-13 07:14:56 +12:00
parent c012ea90dd
commit 0b665bc35b
2 changed files with 4 additions and 5 deletions

View File

@@ -32,10 +32,6 @@ namespace OpenRA.Mods.RA.Activities
if ((nearest - mobile.toCell).LengthSquared > 2) if ((nearest - mobile.toCell).LengthSquared > 2)
return Util.SequenceActivities(new MoveAdjacentTo(Target.FromActor(target)), this); return Util.SequenceActivities(new MoveAdjacentTo(Target.FromActor(target)), this);
var capturable = target.TraitOrDefault<Capturable>();
if (capturable != null && capturable.CaptureInProgress && capturable.Captor.Owner.Stances[self.Owner] == Stance.Ally)
return NextActivity;
if (!target.Trait<Capturable>().BeginCapture(target, self)) if (!target.Trait<Capturable>().BeginCapture(target, self))
return NextActivity; return NextActivity;

View File

@@ -40,7 +40,10 @@ namespace OpenRA.Mods.RA
public bool BeginCapture(Actor self, Actor captor) public bool BeginCapture(Actor self, Actor captor)
{ {
if (!self.Trait<Building>().Lock()) if (!CaptureInProgress && !self.Trait<Building>().Lock())
return false;
if (CaptureInProgress && Captor.Owner.Stances[captor.Owner] == Stance.Ally)
return false; return false;
CaptureProgressTime = 0; CaptureProgressTime = 0;