Fix crash in CaptureActor.Tick when trying to capture a dead actor
This commit is contained in:
@@ -22,10 +22,6 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
var capturesInfo = self.Info.Traits.Get<CapturesInfo>();
|
||||
var health = target.Trait<Health>();
|
||||
int damage = (int)(0.25 * health.MaxHP);
|
||||
|
||||
if (IsCanceled)
|
||||
return NextActivity;
|
||||
if (target == null || !target.IsInWorld || target.IsDead())
|
||||
@@ -33,6 +29,10 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (target.Owner == self.Owner)
|
||||
return NextActivity;
|
||||
|
||||
var capturesInfo = self.Info.Traits.Get<CapturesInfo>();
|
||||
var health = target.Trait<Health>();
|
||||
int damage = (int)(0.25 * health.MaxHP);
|
||||
|
||||
// Need to be next to building, TODO: stop capture when going away
|
||||
var mobile = self.Trait<Mobile>();
|
||||
var nearest = target.OccupiesSpace.NearestCellTo(mobile.toCell);
|
||||
|
||||
Reference in New Issue
Block a user