Generalize Fly* plane activities Aircraft caching naming
To make a possible future merger (or inheritance or other code-sharing) with other activities easier.
This commit is contained in:
@@ -18,14 +18,14 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
public class FlyFollow : Activity
|
public class FlyFollow : Activity
|
||||||
{
|
{
|
||||||
Target target;
|
Target target;
|
||||||
Aircraft plane;
|
Aircraft aircraft;
|
||||||
WDist minRange;
|
WDist minRange;
|
||||||
WDist maxRange;
|
WDist maxRange;
|
||||||
|
|
||||||
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
|
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
plane = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
this.minRange = minRange;
|
this.minRange = minRange;
|
||||||
this.maxRange = maxRange;
|
this.maxRange = maxRange;
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
// Refuse to take off if it would land immediately again.
|
// Refuse to take off if it would land immediately again.
|
||||||
if (plane.ForceLanding)
|
if (aircraft.ForceLanding)
|
||||||
{
|
{
|
||||||
Cancel(self);
|
Cancel(self);
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
if (target.IsInRange(self.CenterPosition, maxRange) && !target.IsInRange(self.CenterPosition, minRange))
|
if (target.IsInRange(self.CenterPosition, maxRange) && !target.IsInRange(self.CenterPosition, minRange))
|
||||||
{
|
{
|
||||||
Fly.FlyToward(self, plane, plane.Facing, plane.Info.CruiseAltitude);
|
Fly.FlyToward(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
public class FlyOffMap : Activity
|
public class FlyOffMap : Activity
|
||||||
{
|
{
|
||||||
readonly Aircraft plane;
|
readonly Aircraft aircraft;
|
||||||
|
|
||||||
public FlyOffMap(Actor self)
|
public FlyOffMap(Actor self)
|
||||||
{
|
{
|
||||||
plane = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
// Refuse to take off if it would land immediately again.
|
// Refuse to take off if it would land immediately again.
|
||||||
if (plane.ForceLanding)
|
if (aircraft.ForceLanding)
|
||||||
{
|
{
|
||||||
Cancel(self);
|
Cancel(self);
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (IsCanceled || !self.World.Map.Contains(self.Location))
|
if (IsCanceled || !self.World.Map.Contains(self.Location))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
Fly.FlyToward(self, plane, plane.Facing, plane.Info.CruiseAltitude);
|
Fly.FlyToward(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,21 +16,21 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
public class FlyTimed : Activity
|
public class FlyTimed : Activity
|
||||||
{
|
{
|
||||||
readonly Aircraft plane;
|
readonly Aircraft aircraft;
|
||||||
readonly WDist cruiseAltitude;
|
readonly WDist cruiseAltitude;
|
||||||
int remainingTicks;
|
int remainingTicks;
|
||||||
|
|
||||||
public FlyTimed(int ticks, Actor self)
|
public FlyTimed(int ticks, Actor self)
|
||||||
{
|
{
|
||||||
remainingTicks = ticks;
|
remainingTicks = ticks;
|
||||||
plane = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
cruiseAltitude = plane.Info.CruiseAltitude;
|
cruiseAltitude = aircraft.Info.CruiseAltitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
// Refuse to take off if it would land immediately again.
|
// Refuse to take off if it would land immediately again.
|
||||||
if (plane.ForceLanding)
|
if (aircraft.ForceLanding)
|
||||||
{
|
{
|
||||||
Cancel(self);
|
Cancel(self);
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (IsCanceled || remainingTicks-- == 0)
|
if (IsCanceled || remainingTicks-- == 0)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
Fly.FlyToward(self, plane, plane.Facing, cruiseAltitude);
|
Fly.FlyToward(self, aircraft, aircraft.Facing, cruiseAltitude);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user