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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Activate(Actor self)
|
void Activate(Actor self)
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
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);
|
self.SetTargetLine(Target.FromCell(TargetLocation.Value), Color.Red);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,16 +74,21 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
Activity inner;
|
Activity inner;
|
||||||
int scanTicks;
|
int scanTicks;
|
||||||
|
AutoTarget autoTarget;
|
||||||
|
|
||||||
const int ScanInterval = 7;
|
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 )
|
public override Activity Tick( Actor self )
|
||||||
{
|
{
|
||||||
if (--scanTicks <= 0)
|
if (autoTarget != null && --scanTicks <= 0)
|
||||||
{
|
{
|
||||||
self.Trait<AutoTarget>().ScanAndAttack(self);
|
autoTarget.ScanAndAttack(self);
|
||||||
scanTicks = ScanInterval;
|
scanTicks = ScanInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ namespace OpenRA.Mods.RA
|
|||||||
var mobile = newUnit.TraitOrDefault<Mobile>();
|
var mobile = newUnit.TraitOrDefault<Mobile>();
|
||||||
if (mobile != null)
|
if (mobile != null)
|
||||||
{
|
{
|
||||||
newUnit.QueueActivity(new AttackMove.AttackMoveActivity(mobile.MoveTo(rp.rallyPoint, 1)));
|
newUnit.QueueActivity(new AttackMove.AttackMoveActivity(
|
||||||
|
newUnit, mobile.MoveTo(rp.rallyPoint, 1)));
|
||||||
return rp.rallyPoint;
|
return rp.rallyPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user