diff --git a/OpenRA.Mods.RA/Air/FlyAttack.cs b/OpenRA.Mods.RA/Air/FlyAttack.cs index 00e4bd321f..efd3af709e 100755 --- a/OpenRA.Mods.RA/Air/FlyAttack.cs +++ b/OpenRA.Mods.RA/Air/FlyAttack.cs @@ -52,11 +52,11 @@ namespace OpenRA.Mods.RA.Air } } - public class FlyCircle : CancelableActivity + public class FlyAttackLoop : CancelableActivity { int2 Target; - public FlyCircle(int2 target) { Target = target; } + public FlyAttackLoop(int2 target) { Target = target; } public override IActivity Tick(Actor self) { diff --git a/OpenRA.Mods.RA/Air/FlyCircle.cs b/OpenRA.Mods.RA/Air/FlyCircle.cs new file mode 100644 index 0000000000..498f954fb5 --- /dev/null +++ b/OpenRA.Mods.RA/Air/FlyCircle.cs @@ -0,0 +1,43 @@ +#region Copyright & License Information +/* + * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System.Collections.Generic; +using OpenRA.Traits; +using OpenRA.Traits.Activities; + +namespace OpenRA.Mods.RA.Air +{ + public class FlyCircle : CancelableActivity + { + public override IActivity Tick(Actor self) + { + var cruiseAltitude = self.Info.Traits.Get().CruiseAltitude; + + if (IsCanceled) return NextActivity; + + var aircraft = self.Trait(); + + var desiredFacing = aircraft.Facing + 64; // we can't possibly turn this fast. + if (aircraft.Altitude == cruiseAltitude) + aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT); + + if (aircraft.Altitude < cruiseAltitude) + ++aircraft.Altitude; + + FlyUtil.Fly(self, cruiseAltitude); + return this; + } + + public override IEnumerable GetCurrentPath() + { + yield break; + } + } +} diff --git a/OpenRA.Mods.RA/CrateDrop.cs b/OpenRA.Mods.RA/CrateDrop.cs index dad39bf1de..8a3aaad42f 100644 --- a/OpenRA.Mods.RA/CrateDrop.cs +++ b/OpenRA.Mods.RA/CrateDrop.cs @@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA new AltitudeInit( Rules.Info["badr"].Traits.Get().CruiseAltitude ), }); plane.CancelActivity(); - plane.QueueActivity(new FlyCircle(p)); + plane.QueueActivity(new FlyAttackLoop(p)); plane.Trait().SetLZ(p); plane.Trait().Load(plane, crate); }); diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 905f704762..3629dd4a30 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -60,6 +60,7 @@ + diff --git a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs index a126f24fd5..da91faca07 100755 --- a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA }); a.CancelActivity(); - a.QueueActivity(new FlyCircle(order.TargetLocation)); + a.QueueActivity(new FlyAttackLoop(order.TargetLocation)); a.Trait().SetLZ(order.TargetLocation); var cargo = a.Trait();