Split out an ActivityUtils class.
This commit is contained in:
@@ -52,12 +52,12 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// TODO: This should fire each weapon at its maximum range
|
||||
if (attackPlane != null && target.IsInRange(self.CenterPosition, attackPlane.Armaments.Select(a => a.Weapon.MinRange).Min()))
|
||||
inner = Util.SequenceActivities(new FlyTimed(ticksUntilTurn, self), new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
||||
inner = ActivityUtils.SequenceActivities(new FlyTimed(ticksUntilTurn, self), new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
||||
else
|
||||
inner = Util.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
||||
inner = ActivityUtils.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
||||
}
|
||||
|
||||
inner = Util.RunActivity(self, inner);
|
||||
inner = ActivityUtils.RunActivity(self, inner);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
return Util.SequenceActivities(new Fly(self, target, minRange, maxRange), this);
|
||||
return ActivityUtils.SequenceActivities(new Fly(self, target, minRange, maxRange), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
self.CancelActivity();
|
||||
self.SetTargetLine(newTarget, Color.Green);
|
||||
return Util.SequenceActivities(new HeliFly(self, newTarget));
|
||||
return ActivityUtils.SequenceActivities(new HeliFly(self, newTarget));
|
||||
}
|
||||
|
||||
// If all ammo pools are depleted and none reload automatically, return to helipad to reload and then move to next activity
|
||||
// TODO: This should check whether there is ammo left that is actually suitable for the target
|
||||
if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo()))
|
||||
return Util.SequenceActivities(new HeliReturnToBase(self), NextActivity);
|
||||
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self), NextActivity);
|
||||
|
||||
var dist = target.CenterPosition - self.CenterPosition;
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
.ClosestTo(self);
|
||||
|
||||
if (nearestHpad == null)
|
||||
return Util.SequenceActivities(new Turn(self, initialFacing), new HeliLand(self, true), NextActivity);
|
||||
return ActivityUtils.SequenceActivities(new Turn(self, initialFacing), new HeliLand(self, true), NextActivity);
|
||||
else
|
||||
return Util.SequenceActivities(new HeliFly(self, Target.FromActor(nearestHpad)));
|
||||
return ActivityUtils.SequenceActivities(new HeliFly(self, Target.FromActor(nearestHpad)));
|
||||
}
|
||||
|
||||
heli.MakeReservation(dest);
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var exit = dest.Info.TraitInfos<ExitInfo>().FirstOrDefault();
|
||||
var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero;
|
||||
|
||||
return Util.SequenceActivities(
|
||||
return ActivityUtils.SequenceActivities(
|
||||
new HeliFly(self, Target.FromPos(dest.CenterPosition + offset)),
|
||||
new Turn(self, initialFacing),
|
||||
new HeliLand(self, false),
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (host == null)
|
||||
return NextActivity;
|
||||
|
||||
return Util.SequenceActivities(
|
||||
return ActivityUtils.SequenceActivities(
|
||||
aircraft.GetResupplyActivities(host).Append(NextActivity).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,12 +106,12 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
self.CancelActivity();
|
||||
if (nearestAfld != null)
|
||||
return Util.SequenceActivities(new Fly(self, Target.FromActor(nearestAfld)), new FlyCircle(self));
|
||||
return ActivityUtils.SequenceActivities(new Fly(self, Target.FromActor(nearestAfld)), new FlyCircle(self));
|
||||
else
|
||||
return new FlyCircle(self);
|
||||
}
|
||||
|
||||
return Util.SequenceActivities(
|
||||
return ActivityUtils.SequenceActivities(
|
||||
new Fly(self, Target.FromPos(w1)),
|
||||
new Fly(self, Target.FromPos(w2)),
|
||||
new Fly(self, Target.FromPos(w3)),
|
||||
|
||||
Reference in New Issue
Block a user