Prevent bogus attackmove on take-off.
This commit is contained in:
@@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (aircraft.Info.CanHover && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude)
|
if (aircraft.Info.CanHover && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude)
|
||||||
{
|
{
|
||||||
if (dat <= aircraft.LandAltitude)
|
if (dat <= aircraft.LandAltitude)
|
||||||
QueueChild(new TakeOff(self, target));
|
QueueChild(new TakeOff(self));
|
||||||
else
|
else
|
||||||
VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
else if (dat <= aircraft.LandAltitude)
|
else if (dat <= aircraft.LandAltitude)
|
||||||
{
|
{
|
||||||
QueueChild(new TakeOff(self, target));
|
QueueChild(new TakeOff(self));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,19 +21,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
readonly IMove move;
|
readonly IMove move;
|
||||||
Target fallbackTarget;
|
|
||||||
bool movedToTarget = false;
|
|
||||||
|
|
||||||
public TakeOff(Actor self, Target fallbackTarget)
|
public TakeOff(Actor self)
|
||||||
{
|
{
|
||||||
aircraft = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
move = self.Trait<IMove>();
|
move = self.Trait<IMove>();
|
||||||
this.fallbackTarget = fallbackTarget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TakeOff(Actor self)
|
|
||||||
: this(self, Target.Invalid) { }
|
|
||||||
|
|
||||||
protected override void OnFirstRun(Actor self)
|
protected override void OnFirstRun(Actor self)
|
||||||
{
|
{
|
||||||
if (aircraft.ForceLanding)
|
if (aircraft.ForceLanding)
|
||||||
@@ -73,24 +67,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only move to the fallback target if we don't have anything better to do
|
|
||||||
if (NextActivity == null && fallbackTarget.IsValidFor(self) && !movedToTarget)
|
|
||||||
{
|
|
||||||
QueueChild(new AttackMoveActivity(self, () => move.MoveToTarget(self, fallbackTarget, targetLineColor: Color.OrangeRed)));
|
|
||||||
movedToTarget = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<TargetLineNode> TargetLineNodes(Actor self)
|
|
||||||
{
|
|
||||||
if (ChildActivity != null)
|
|
||||||
foreach (var n in ChildActivity.TargetLineNodes(self))
|
|
||||||
yield return n;
|
|
||||||
else
|
|
||||||
yield return new TargetLineNode(fallbackTarget, Color.OrangeRed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -521,10 +521,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
if (takeOff && self.World.Map.DistanceAboveTerrain(CenterPosition).Length <= LandAltitude.Length)
|
if (takeOff && self.World.Map.DistanceAboveTerrain(CenterPosition).Length <= LandAltitude.Length)
|
||||||
{
|
{
|
||||||
if (rp != null)
|
|
||||||
self.QueueActivity(new TakeOff(self, Target.FromCell(self.World, rp.Location)));
|
|
||||||
else
|
|
||||||
self.QueueActivity(new TakeOff(self));
|
self.QueueActivity(new TakeOff(self));
|
||||||
|
if (rp != null)
|
||||||
|
self.QueueActivity(new AttackMoveActivity(self, () => MoveTo(rp.Location, null, targetLineColor: Color.OrangeRed)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user