Remove FlyCircleTimed activity

A FlyCircle overload is sufficient.
This commit is contained in:
reaperrr
2017-07-28 18:12:05 +02:00
committed by Matthias Mailänder
parent df94765eac
commit 5d58374962
4 changed files with 9 additions and 39 deletions

View File

@@ -18,11 +18,13 @@ namespace OpenRA.Mods.Common.Activities
{
readonly Aircraft plane;
readonly WDist cruiseAltitude;
int remainingTicks;
public FlyCircle(Actor self)
public FlyCircle(Actor self, int ticks = -1)
{
plane = self.Trait<Aircraft>();
cruiseAltitude = plane.Info.CruiseAltitude;
remainingTicks = ticks;
}
public override Activity Tick(Actor self)
@@ -37,6 +39,11 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceled)
return NextActivity;
if (remainingTicks > 0)
remainingTicks--;
else if (remainingTicks == 0)
return NextActivity;
// We can't possibly turn this fast
var desiredFacing = plane.Facing + 64;
Fly.FlyToward(self, plane, desiredFacing, cruiseAltitude);

View File

@@ -1,36 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
namespace OpenRA.Mods.Common.Activities
{
public class FlyCircleTimed : FlyCircle
{
int remainingTicks;
public FlyCircleTimed(Actor self, int ticks) : base(self)
{
remainingTicks = ticks;
}
public override Activity Tick(Actor self)
{
if (IsCanceled || remainingTicks-- == 0)
return NextActivity;
base.Tick(self);
return this;
}
}
}

View File

@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Activities
if (nearestAfld != null)
return ActivityUtils.SequenceActivities(
new Fly(self, Target.FromActor(nearestAfld), WDist.Zero, plane.Info.WaitDistanceFromResupplyBase),
new FlyCircleTimed(self, plane.Info.NumberOfTicksToVerifyAvailableAirport),
new FlyCircle(self, plane.Info.NumberOfTicksToVerifyAvailableAirport),
this);
else
{

View File

@@ -770,7 +770,6 @@
<Compile Include="Traits\Buildings\FreeActorWithDelivery.cs" />
<Compile Include="Traits\ExitsDebugOverlay.cs" />
<Compile Include="Traits\World\ExitsDebugOverlayManager.cs" />
<Compile Include="Activities\Air\FlyCircleTimed.cs" />
<Compile Include="UtilityCommands\ListInstallShieldCabContentsCommand.cs" />
<Compile Include="FileFormats\InstallShieldCABCompression.cs" />
<Compile Include="ModContent.cs" />