make attackmove on spawn work properly for things that cant attackmove
This commit is contained in:
@@ -42,11 +42,10 @@ namespace OpenRA.Mods.RA
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
void Activate(Actor self)
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new AttackMoveActivity(mobile.MoveTo(TargetLocation.Value, 1)));
|
||||
self.QueueActivity(new AttackMoveActivity(self, mobile.MoveTo(TargetLocation.Value, 1)));
|
||||
self.SetTargetLine(Target.FromCell(TargetLocation.Value), Color.Red);
|
||||
}
|
||||
|
||||
@@ -75,16 +74,21 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
Activity inner;
|
||||
int scanTicks;
|
||||
AutoTarget autoTarget;
|
||||
|
||||
const int ScanInterval = 7;
|
||||
|
||||
public AttackMoveActivity( Activity inner ) { this.inner = inner; }
|
||||
public AttackMoveActivity( Actor self, Activity inner )
|
||||
{
|
||||
this.inner = inner;
|
||||
this.autoTarget = self.TraitOrDefault<AutoTarget>();
|
||||
}
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if (--scanTicks <= 0)
|
||||
if (autoTarget != null && --scanTicks <= 0)
|
||||
{
|
||||
self.Trait<AutoTarget>().ScanAndAttack(self);
|
||||
autoTarget.ScanAndAttack(self);
|
||||
scanTicks = ScanInterval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user