Fix random placement of AssociateWithAirfieldActivity
It doesn't belong to IMove, so it doesn't belong into that region. Put it near ICreationActivity where it belongs.
This commit is contained in:
@@ -921,43 +921,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public Activity ReturnToCell(Actor self) { return null; }
|
public Activity ReturnToCell(Actor self) { return null; }
|
||||||
|
|
||||||
class AssociateWithAirfieldActivity : Activity
|
|
||||||
{
|
|
||||||
readonly Actor self;
|
|
||||||
readonly Aircraft aircraft;
|
|
||||||
readonly int delay;
|
|
||||||
|
|
||||||
public AssociateWithAirfieldActivity(Actor self, int delay = 0)
|
|
||||||
{
|
|
||||||
this.self = self;
|
|
||||||
aircraft = self.Trait<Aircraft>();
|
|
||||||
IsInterruptible = false;
|
|
||||||
this.delay = delay;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnFirstRun(Actor self)
|
|
||||||
{
|
|
||||||
var host = aircraft.GetActorBelow();
|
|
||||||
if (host != null)
|
|
||||||
aircraft.MakeReservation(host);
|
|
||||||
|
|
||||||
if (delay > 0)
|
|
||||||
QueueChild(new Wait(delay));
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (!aircraft.Info.TakeOffOnCreation)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition).Length <= aircraft.LandAltitude.Length)
|
|
||||||
QueueChild(new TakeOff(self));
|
|
||||||
|
|
||||||
aircraft.UnReserve();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Activity MoveToTarget(Actor self, in Target target,
|
public Activity MoveToTarget(Actor self, in Target target,
|
||||||
WPos? initialTargetPosition = null, Color? targetLineColor = null)
|
WPos? initialTargetPosition = null, Color? targetLineColor = null)
|
||||||
{
|
{
|
||||||
@@ -1259,6 +1222,43 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return new AssociateWithAirfieldActivity(self, creationActivityDelay);
|
return new AssociateWithAirfieldActivity(self, creationActivityDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AssociateWithAirfieldActivity : Activity
|
||||||
|
{
|
||||||
|
readonly Actor self;
|
||||||
|
readonly Aircraft aircraft;
|
||||||
|
readonly int delay;
|
||||||
|
|
||||||
|
public AssociateWithAirfieldActivity(Actor self, int delay = 0)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
aircraft = self.Trait<Aircraft>();
|
||||||
|
IsInterruptible = false;
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnFirstRun(Actor self)
|
||||||
|
{
|
||||||
|
var host = aircraft.GetActorBelow();
|
||||||
|
if (host != null)
|
||||||
|
aircraft.MakeReservation(host);
|
||||||
|
|
||||||
|
if (delay > 0)
|
||||||
|
QueueChild(new Wait(delay));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (!aircraft.Info.TakeOffOnCreation)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition).Length <= aircraft.LandAltitude.Length)
|
||||||
|
QueueChild(new TakeOff(self));
|
||||||
|
|
||||||
|
aircraft.UnReserve();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class AircraftMoveOrderTargeter : IOrderTargeter
|
public class AircraftMoveOrderTargeter : IOrderTargeter
|
||||||
{
|
{
|
||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
|
|||||||
Reference in New Issue
Block a user