Add missing self and optional pretick parameters to Queue, QueueChild and PrintActivity methods.
This means sequenceActivities needs to accept self as well.
This commit is contained in:
@@ -234,20 +234,20 @@ namespace OpenRA.Activities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Queue(Activity activity)
|
public virtual void Queue(Actor self, Activity activity, bool pretick = false)
|
||||||
{
|
{
|
||||||
if (NextInQueue != null)
|
if (NextInQueue != null)
|
||||||
NextInQueue.Queue(activity);
|
NextInQueue.Queue(self, activity);
|
||||||
else
|
else
|
||||||
NextInQueue = activity;
|
NextInQueue = pretick ? ActivityUtils.RunActivity(self, activity) : activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void QueueChild(Activity activity)
|
public virtual void QueueChild(Actor self, Activity activity, bool pretick = false)
|
||||||
{
|
{
|
||||||
if (ChildActivity != null)
|
if (ChildActivity != null)
|
||||||
ChildActivity.Queue(activity);
|
ChildActivity.Queue(self, activity);
|
||||||
else
|
else
|
||||||
ChildActivity = activity;
|
ChildActivity = pretick ? ActivityUtils.RunActivity(self, activity) : activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -258,10 +258,10 @@ namespace OpenRA.Activities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="origin">Activity from which to start traversing, and which to mark. If null, mark the calling activity, and start traversal from the root.</param>
|
/// <param name="origin">Activity from which to start traversing, and which to mark. If null, mark the calling activity, and start traversal from the root.</param>
|
||||||
/// <param name="level">Initial level of indentation.</param>
|
/// <param name="level">Initial level of indentation.</param>
|
||||||
protected void PrintActivityTree(Activity origin = null, int level = 0)
|
protected void PrintActivityTree(Actor self, Activity origin = null, int level = 0)
|
||||||
{
|
{
|
||||||
if (origin == null)
|
if (origin == null)
|
||||||
RootActivity.PrintActivityTree(this);
|
RootActivity.PrintActivityTree(self, this);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.Write(new string(' ', level * 2));
|
Console.Write(new string(' ', level * 2));
|
||||||
@@ -271,10 +271,10 @@ namespace OpenRA.Activities
|
|||||||
Console.WriteLine(this.GetType().ToString().Split('.').Last());
|
Console.WriteLine(this.GetType().ToString().Split('.').Last());
|
||||||
|
|
||||||
if (ChildActivity != null)
|
if (ChildActivity != null)
|
||||||
ChildActivity.PrintActivityTree(origin, level + 1);
|
ChildActivity.PrintActivityTree(self, origin, level + 1);
|
||||||
|
|
||||||
if (NextInQueue != null)
|
if (NextInQueue != null)
|
||||||
NextInQueue.PrintActivityTree(origin, level);
|
NextInQueue.PrintActivityTree(self, origin, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ namespace OpenRA
|
|||||||
if (CurrentActivity == null)
|
if (CurrentActivity == null)
|
||||||
CurrentActivity = nextActivity;
|
CurrentActivity = nextActivity;
|
||||||
else
|
else
|
||||||
CurrentActivity.RootActivity.Queue(nextActivity);
|
CurrentActivity.RootActivity.Queue(this, nextActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CancelActivity()
|
public bool CancelActivity()
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ namespace OpenRA.Traits
|
|||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Activity SequenceActivities(params Activity[] acts)
|
public static Activity SequenceActivities(Actor self, params Activity[] acts)
|
||||||
{
|
{
|
||||||
return acts.Reverse().Aggregate(
|
return acts.Reverse().Aggregate(
|
||||||
(next, a) => { a.Queue(next); return a; });
|
(next, a) => { a.Queue(self, next); return a; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
return new Wait(20);
|
return new Wait(20);
|
||||||
|
|
||||||
// Add a CloseEnough range of 512 to the Rearm/Repair activities in order to ensure that we're at the host actor
|
// Add a CloseEnough range of 512 to the Rearm/Repair activities in order to ensure that we're at the host actor
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
|
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
|
||||||
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
|
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
|
||||||
new Rearm(self, rearmTarget, new WDist(512)),
|
new Rearm(self, rearmTarget, new WDist(512)),
|
||||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
if (minelayer.Minefield.Contains(self.Location) && ShouldLayMine(self, self.Location))
|
if (minelayer.Minefield.Contains(self.Location) && ShouldLayMine(self, self.Location))
|
||||||
{
|
{
|
||||||
LayMine(self);
|
LayMine(self);
|
||||||
return ActivityUtils.SequenceActivities(new Wait(20), this); // A little wait after placing each mine, for show
|
return ActivityUtils.SequenceActivities(self, new Wait(20), this); // A little wait after placing each mine, for show
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minelayer.Minefield.Length > 0)
|
if (minelayer.Minefield.Length > 0)
|
||||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
{
|
{
|
||||||
var p = minelayer.Minefield.Random(self.World.SharedRandom);
|
var p = minelayer.Minefield.Random(self.World.SharedRandom);
|
||||||
if (ShouldLayMine(self, p))
|
if (ShouldLayMine(self, p))
|
||||||
return ActivityUtils.SequenceActivities(movement.MoveTo(p, 0), this);
|
return ActivityUtils.SequenceActivities(self, movement.MoveTo(p, 0), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
attack.DoAttack(self, target);
|
attack.DoAttack(self, target);
|
||||||
|
|
||||||
jumpComplete = true;
|
jumpComplete = true;
|
||||||
QueueChild(mobile.VisualMove(self, position, self.World.Map.CenterOfSubCell(destinationCell, destinationSubCell)));
|
QueueChild(self, mobile.VisualMove(self, position, self.World.Map.CenterOfSubCell(destinationCell, destinationSubCell)), true);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
if (!allowMovement || lastVisibleMaxRange == WDist.Zero || lastVisibleMaxRange < lastVisibleMinRange)
|
if (!allowMovement || lastVisibleMaxRange == WDist.Zero || lastVisibleMaxRange < lastVisibleMinRange)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
QueueChild(mobile.MoveWithinRange(target, lastVisibleMinRange, lastVisibleMaxRange, checkTarget.CenterPosition, Color.Red));
|
QueueChild(self, mobile.MoveWithinRange(target, lastVisibleMinRange, lastVisibleMaxRange, checkTarget.CenterPosition, Color.Red), true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,11 +127,11 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
var desiredFacing = (destination - origin).Yaw.Facing;
|
var desiredFacing = (destination - origin).Yaw.Facing;
|
||||||
if (mobile.Facing != desiredFacing)
|
if (mobile.Facing != desiredFacing)
|
||||||
{
|
{
|
||||||
QueueChild(new Turn(self, desiredFacing));
|
QueueChild(self, new Turn(self, desiredFacing), true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueChild(new Leap(self, target, mobile, targetMobile, info.Speed.Length, attack, edible));
|
QueueChild(self, new Leap(self, target, mobile, targetMobile, info.Speed.Length, attack, edible), true);
|
||||||
|
|
||||||
// Re-queue the child activities to kill the target if it didn't die in one go
|
// Re-queue the child activities to kill the target if it didn't die in one go
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
if (!string.IsNullOrEmpty(attack.info.ChargeAudio))
|
if (!string.IsNullOrEmpty(attack.info.ChargeAudio))
|
||||||
Game.Sound.Play(SoundType.World, attack.info.ChargeAudio, self.CenterPosition);
|
Game.Sound.Play(SoundType.World, attack.info.ChargeAudio, self.CenterPosition);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(new Wait(attack.info.InitialChargeDelay), new ChargeFire(attack, target), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(attack.info.InitialChargeDelay), new ChargeFire(attack, target), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
attack.DoAttack(self, target);
|
attack.DoAttack(self, target);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(new Wait(attack.info.ChargeDelay), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(attack.info.ChargeDelay), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// If all valid weapons have depleted their ammo and Rearmable trait exists, return to RearmActor to reload and then resume the activity
|
// If all valid weapons have depleted their ammo and Rearmable trait exists, return to RearmActor to reload and then resume the activity
|
||||||
if (rearmable != null && !useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
if (rearmable != null && !useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
||||||
return ActivityUtils.SequenceActivities(new ReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
return ActivityUtils.SequenceActivities(self, new ReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
||||||
|
|
||||||
var pos = self.CenterPosition;
|
var pos = self.CenterPosition;
|
||||||
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
||||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
// Fly towards the last known position
|
// Fly towards the last known position
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new Fly(self, target, WDist.Zero, lastVisibleMaximumRange, checkTarget.CenterPosition, Color.Red),
|
new Fly(self, target, WDist.Zero, lastVisibleMaximumRange, checkTarget.CenterPosition, Color.Red),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
@@ -103,18 +103,18 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
// TODO: This should fire each weapon at its maximum range
|
// TODO: This should fire each weapon at its maximum range
|
||||||
if (attackAircraft != null && target.IsInRange(self.CenterPosition, attackAircraft.GetMinimumRange()))
|
if (attackAircraft != null && target.IsInRange(self.CenterPosition, attackAircraft.GetMinimumRange()))
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(
|
ChildActivity = ActivityUtils.SequenceActivities(self,
|
||||||
new FlyTimed(ticksUntilTurn, self),
|
new FlyTimed(ticksUntilTurn, self),
|
||||||
new Fly(self, target, checkTarget.CenterPosition, Color.Red),
|
new Fly(self, target, checkTarget.CenterPosition, Color.Red),
|
||||||
new FlyTimed(ticksUntilTurn, self));
|
new FlyTimed(ticksUntilTurn, self));
|
||||||
else
|
else
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(
|
ChildActivity = ActivityUtils.SequenceActivities(self,
|
||||||
new Fly(self, target, checkTarget.CenterPosition, Color.Red),
|
new Fly(self, target, checkTarget.CenterPosition, Color.Red),
|
||||||
new FlyTimed(ticksUntilTurn, self));
|
new FlyTimed(ticksUntilTurn, self));
|
||||||
|
|
||||||
// HACK: This needs to be done in this round-about way because TakeOff doesn't behave as expected when it doesn't have a NextActivity.
|
// HACK: This needs to be done in this round-about way because TakeOff doesn't behave as expected when it doesn't have a NextActivity.
|
||||||
if (self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length < aircraft.Info.MinAirborneAltitude)
|
if (self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length < aircraft.Info.MinAirborneAltitude)
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(new TakeOff(self), ChildActivity);
|
ChildActivity = ActivityUtils.SequenceActivities(self, new TakeOff(self), ChildActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityUtils.RunActivity(self, ChildActivity);
|
ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
wasMovingWithinRange = true;
|
wasMovingWithinRange = true;
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
aircraft.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor),
|
aircraft.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// If all valid weapons have depleted their ammo and Rearmable trait exists, return to RearmActor to reload and then resume the activity
|
// If all valid weapons have depleted their ammo and Rearmable trait exists, return to RearmActor to reload and then resume the activity
|
||||||
if (rearmable != null && !useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
if (rearmable != null && !useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
||||||
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
return ActivityUtils.SequenceActivities(self, new HeliReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
||||||
|
|
||||||
var pos = self.CenterPosition;
|
var pos = self.CenterPosition;
|
||||||
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (nearestResupplier == null && aircraft.Info.LandWhenIdle)
|
if (nearestResupplier == null && aircraft.Info.LandWhenIdle)
|
||||||
{
|
{
|
||||||
if (aircraft.Info.TurnToLand)
|
if (aircraft.Info.TurnToLand)
|
||||||
return ActivityUtils.SequenceActivities(new Turn(self, initialFacing), new HeliLand(self, true));
|
return ActivityUtils.SequenceActivities(self, new Turn(self, initialFacing), new HeliLand(self, true));
|
||||||
|
|
||||||
return new HeliLand(self, true);
|
return new HeliLand(self, true);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
var target = Target.FromPos(nearestResupplier.CenterPosition + randomPosition);
|
var target = Target.FromPos(nearestResupplier.CenterPosition + randomPosition);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new HeliFly(self, target, WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
|
new HeliFly(self, target, WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
else
|
else
|
||||||
landingProcedures.Add(NextActivity);
|
landingProcedures.Add(NextActivity);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(landingProcedures.ToArray());
|
return ActivityUtils.SequenceActivities(self, landingProcedures.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShouldLandAtBuilding(Actor self, Actor dest)
|
bool ShouldLandAtBuilding(Actor self, Actor dest)
|
||||||
|
|||||||
@@ -30,19 +30,15 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
if (!aircraft.Info.TakeOffOnResupply)
|
if (!aircraft.Info.TakeOffOnResupply)
|
||||||
{
|
{
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(
|
ChildActivity = ActivityUtils.SequenceActivities(self, aircraft.GetResupplyActivities(host).ToArray());
|
||||||
aircraft.GetResupplyActivities(host)
|
QueueChild(self, new AllowYieldingReservation(self));
|
||||||
.Append(new AllowYieldingReservation(self))
|
QueueChild(self, new WaitFor(() => NextInQueue != null || aircraft.ReservedActor == null));
|
||||||
.Append(new WaitFor(() => NextInQueue != null || aircraft.ReservedActor == null))
|
|
||||||
.ToArray());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(
|
ChildActivity = ActivityUtils.SequenceActivities(self, aircraft.GetResupplyActivities(host).ToArray());
|
||||||
aircraft.GetResupplyActivities(host)
|
QueueChild(self, new AllowYieldingReservation(self));
|
||||||
.Append(new AllowYieldingReservation(self))
|
QueueChild(self, new TakeOff(self, (a, b, c) => NextInQueue == null && b.NextInQueue == null));
|
||||||
.Append(new TakeOff(self, (a, b, c) => NextInQueue == null && b.NextInQueue == null))
|
|
||||||
.ToArray());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var nearestResupplier = ChooseResupplier(self, false);
|
var nearestResupplier = ChooseResupplier(self, false);
|
||||||
|
|
||||||
if (nearestResupplier != null)
|
if (nearestResupplier != null)
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new Fly(self, Target.FromActor(nearestResupplier), WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
|
new Fly(self, Target.FromActor(nearestResupplier), WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
|
||||||
new FlyCircle(self, aircraft.Info.NumberOfTicksToVerifyAvailableAirport),
|
new FlyCircle(self, aircraft.Info.NumberOfTicksToVerifyAvailableAirport),
|
||||||
this);
|
this);
|
||||||
@@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (!abortOnResupply)
|
if (!abortOnResupply)
|
||||||
landingProcedures.Add(NextActivity);
|
landingProcedures.Add(NextActivity);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(landingProcedures.ToArray());
|
return ActivityUtils.SequenceActivities(self, landingProcedures.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// Move towards the last known position
|
// Move towards the last known position
|
||||||
wasMovingWithinRange = true;
|
wasMovingWithinRange = true;
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
move.MoveWithinRange(target, WDist.Zero, lastVisibleMaximumRange, checkTarget.CenterPosition, Color.Red),
|
move.MoveWithinRange(target, WDist.Zero, lastVisibleMaximumRange, checkTarget.CenterPosition, Color.Red),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var sightRange = rs != null ? rs.Range : WDist.FromCells(2);
|
var sightRange = rs != null ? rs.Range : WDist.FromCells(2);
|
||||||
|
|
||||||
attackStatus |= AttackStatus.NeedsToMove;
|
attackStatus |= AttackStatus.NeedsToMove;
|
||||||
moveActivity = ActivityUtils.SequenceActivities(
|
moveActivity = ActivityUtils.SequenceActivities(self,
|
||||||
move.MoveWithinRange(target, sightRange, target.CenterPosition, Color.Red),
|
move.MoveWithinRange(target, sightRange, target.CenterPosition, Color.Red),
|
||||||
this);
|
this);
|
||||||
|
|
||||||
@@ -195,9 +195,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return AttackStatus.UnableToAttack;
|
return AttackStatus.UnableToAttack;
|
||||||
|
|
||||||
attackStatus |= AttackStatus.NeedsToMove;
|
attackStatus |= AttackStatus.NeedsToMove;
|
||||||
|
|
||||||
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
||||||
moveActivity = ActivityUtils.SequenceActivities(
|
moveActivity = ActivityUtils.SequenceActivities(self,
|
||||||
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red),
|
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red),
|
||||||
this);
|
this);
|
||||||
|
|
||||||
@@ -209,7 +208,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (!Util.FacingWithinTolerance(facing.Facing, desiredFacing, ((AttackFrontalInfo)attack.Info).FacingTolerance))
|
if (!Util.FacingWithinTolerance(facing.Facing, desiredFacing, ((AttackFrontalInfo)attack.Info).FacingTolerance))
|
||||||
{
|
{
|
||||||
attackStatus |= AttackStatus.NeedsToTurn;
|
attackStatus |= AttackStatus.NeedsToTurn;
|
||||||
turnActivity = ActivityUtils.SequenceActivities(new Turn(self, desiredFacing), this);
|
turnActivity = ActivityUtils.SequenceActivities(self, new Turn(self, desiredFacing), this);
|
||||||
return AttackStatus.NeedsToTurn;
|
return AttackStatus.NeedsToTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// No refineries exist; check again after delay defined in Harvester.
|
// No refineries exist; check again after delay defined in Harvester.
|
||||||
if (harv.LinkedProc == null)
|
if (harv.LinkedProc == null)
|
||||||
return ActivityUtils.SequenceActivities(new Wait(harv.Info.SearchForDeliveryBuildingDelay), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(harv.Info.SearchForDeliveryBuildingDelay), this);
|
||||||
|
|
||||||
var proc = harv.LinkedProc;
|
var proc = harv.LinkedProc;
|
||||||
var iao = proc.Trait<IAcceptResources>();
|
var iao = proc.Trait<IAcceptResources>();
|
||||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>())
|
foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>())
|
||||||
n.MovingToRefinery(self, proc, null);
|
n.MovingToRefinery(self, proc, null);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(movement.MoveTo(proc.Location + iao.DeliveryOffset, 0), this);
|
return ActivityUtils.SequenceActivities(self, movement.MoveTo(proc.Location + iao.DeliveryOffset, 0), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDocking)
|
if (!isDocking)
|
||||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
iao.OnDock(self, this);
|
iao.OnDock(self, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(new Wait(10), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(10), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// Can't land, so wait at the target until something changes
|
// Can't land, so wait at the target until something changes
|
||||||
if (!targetLocation.HasValue)
|
if (!targetLocation.HasValue)
|
||||||
{
|
{
|
||||||
innerActivity = ActivityUtils.SequenceActivities(
|
innerActivity = ActivityUtils.SequenceActivities(self,
|
||||||
new HeliFly(self, Target.FromCell(self.World, destination)),
|
new HeliFly(self, Target.FromCell(self.World, destination)),
|
||||||
new Wait(25));
|
new Wait(25));
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
var facing = (targetPosition - self.CenterPosition).Yaw.Facing;
|
var facing = (targetPosition - self.CenterPosition).Yaw.Facing;
|
||||||
localOffset = carryall.CarryableOffset.Rotate(body.QuantizeOrientation(self, WRot.FromFacing(facing)));
|
localOffset = carryall.CarryableOffset.Rotate(body.QuantizeOrientation(self, WRot.FromFacing(facing)));
|
||||||
innerActivity = ActivityUtils.SequenceActivities(
|
innerActivity = ActivityUtils.SequenceActivities(self,
|
||||||
new HeliFly(self, Target.FromPos(targetPosition - body.LocalToWorld(localOffset))),
|
new HeliFly(self, Target.FromPos(targetPosition - body.LocalToWorld(localOffset))),
|
||||||
new Turn(self, facing));
|
new Turn(self, facing));
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return this;
|
return this;
|
||||||
|
|
||||||
case DeliveryState.TakeOff:
|
case DeliveryState.TakeOff:
|
||||||
return ActivityUtils.SequenceActivities(new HeliFly(self, Target.FromPos(self.CenterPosition)), NextActivity);
|
return ActivityUtils.SequenceActivities(self, new HeliFly(self, Target.FromPos(self.CenterPosition)), NextActivity);
|
||||||
|
|
||||||
case DeliveryState.Aborted:
|
case DeliveryState.Aborted:
|
||||||
carryall.UnreserveCarryable(self);
|
carryall.UnreserveCarryable(self);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
// Turn to the required facing.
|
// Turn to the required facing.
|
||||||
if (deploy.Info.Facing != -1 && canTurn)
|
if (deploy.Info.Facing != -1 && canTurn)
|
||||||
QueueChild(new Turn(self, deploy.Info.Facing));
|
QueueChild(self, new Turn(self, deploy.Info.Facing));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (harv.IsFull)
|
if (harv.IsFull)
|
||||||
{
|
{
|
||||||
// HACK: DeliverResources is ignored if there are queued activities, so discard NextActivity
|
// HACK: DeliverResources is ignored if there are queued activities, so discard NextActivity
|
||||||
return ActivityUtils.SequenceActivities(new DeliverResources(self));
|
return ActivityUtils.SequenceActivities(self, new DeliverResources(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
var closestHarvestablePosition = ClosestHarvestablePos(self);
|
var closestHarvestablePosition = ClosestHarvestablePos(self);
|
||||||
@@ -82,13 +82,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// Avoid creating an activity cycle
|
// Avoid creating an activity cycle
|
||||||
var next = NextInQueue;
|
var next = NextInQueue;
|
||||||
NextInQueue = null;
|
NextInQueue = null;
|
||||||
return ActivityUtils.SequenceActivities(next, new Wait(randFrames), this);
|
return ActivityUtils.SequenceActivities(self, next, new Wait(randFrames), this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Attempt to claim the target cell
|
// Attempt to claim the target cell
|
||||||
if (!claimLayer.TryClaimCell(self, closestHarvestablePosition.Value))
|
if (!claimLayer.TryClaimCell(self, closestHarvestablePosition.Value))
|
||||||
return ActivityUtils.SequenceActivities(new Wait(25), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(25), this);
|
||||||
|
|
||||||
harv.LastSearchFailed = false;
|
harv.LastSearchFailed = false;
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
n.MovingToResources(self, closestHarvestablePosition.Value, this);
|
n.MovingToResources(self, closestHarvestablePosition.Value, this);
|
||||||
|
|
||||||
self.SetTargetLine(Target.FromCell(self.World, closestHarvestablePosition.Value), Color.Red, false);
|
self.SetTargetLine(Target.FromCell(self.World, closestHarvestablePosition.Value), Color.Red, false);
|
||||||
return ActivityUtils.SequenceActivities(mobile.MoveTo(closestHarvestablePosition.Value, 1), new HarvestResource(self), this);
|
return ActivityUtils.SequenceActivities(self, mobile.MoveTo(closestHarvestablePosition.Value, 1), new HarvestResource(self), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var current = facing.Facing;
|
var current = facing.Facing;
|
||||||
var desired = body.QuantizeFacing(current, harvInfo.HarvestFacings);
|
var desired = body.QuantizeFacing(current, harvInfo.HarvestFacings);
|
||||||
if (desired != current)
|
if (desired != current)
|
||||||
return ActivityUtils.SequenceActivities(new Turn(self, desired), this);
|
return ActivityUtils.SequenceActivities(self, new Turn(self, desired), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
var resource = resLayer.Harvest(self.Location);
|
var resource = resLayer.Harvest(self.Location);
|
||||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
foreach (var t in self.TraitsImplementing<INotifyHarvesterAction>())
|
foreach (var t in self.TraitsImplementing<INotifyHarvesterAction>())
|
||||||
t.Harvested(self, resource);
|
t.Harvested(self, resource);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(new Wait(harvInfo.BaleLoadDelay), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(harvInfo.BaleLoadDelay), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
case DockingState.Turn:
|
case DockingState.Turn:
|
||||||
dockingState = DockingState.Dock;
|
dockingState = DockingState.Dock;
|
||||||
if (IsDragRequired)
|
if (IsDragRequired)
|
||||||
return ActivityUtils.SequenceActivities(new Turn(self, DockAngle), new Drag(self, StartDrag, EndDrag, DragLength), this);
|
return ActivityUtils.SequenceActivities(self, new Turn(self, DockAngle), new Drag(self, StartDrag, EndDrag, DragLength), this);
|
||||||
return ActivityUtils.SequenceActivities(new Turn(self, DockAngle), this);
|
return ActivityUtils.SequenceActivities(self, new Turn(self, DockAngle), this);
|
||||||
case DockingState.Dock:
|
case DockingState.Dock:
|
||||||
if (Refinery.IsInWorld && !Refinery.IsDead)
|
if (Refinery.IsInWorld && !Refinery.IsDead)
|
||||||
foreach (var nd in Refinery.TraitsImplementing<INotifyDocking>())
|
foreach (var nd in Refinery.TraitsImplementing<INotifyDocking>())
|
||||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
Harv.LastLinkedProc = Harv.LinkedProc;
|
Harv.LastLinkedProc = Harv.LinkedProc;
|
||||||
Harv.LinkProc(self, null);
|
Harv.LinkProc(self, null);
|
||||||
if (IsDragRequired)
|
if (IsDragRequired)
|
||||||
return ActivityUtils.SequenceActivities(new Drag(self, EndDrag, StartDrag, DragLength), NextActivity);
|
return ActivityUtils.SequenceActivities(self, new Drag(self, EndDrag, StartDrag, DragLength), NextActivity);
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new AttackMoveActivity(self, move.MoveTo(target.Location, 2)),
|
new AttackMoveActivity(self, move.MoveTo(target.Location, 2)),
|
||||||
new Wait(25),
|
new Wait(25),
|
||||||
this);
|
this);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// Move into range
|
// Move into range
|
||||||
wasMovingWithinRange = true;
|
wasMovingWithinRange = true;
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor),
|
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,8 +227,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// To avoid issues, we also make these mini-turns uninterruptible (like MovePart activities) to ensure the actor
|
// To avoid issues, we also make these mini-turns uninterruptible (like MovePart activities) to ensure the actor
|
||||||
// finishes that mini-turn before starting something else.
|
// finishes that mini-turn before starting something else.
|
||||||
var facingWithinTolerance = Util.FacingWithinTolerance(mobile.Facing, firstFacing, mobile.TurnSpeed);
|
var facingWithinTolerance = Util.FacingWithinTolerance(mobile.Facing, firstFacing, mobile.TurnSpeed);
|
||||||
QueueChild(new Turn(self, firstFacing, facingWithinTolerance, !facingWithinTolerance));
|
QueueChild(self, new Turn(self, firstFacing, facingWithinTolerance, !facingWithinTolerance), true);
|
||||||
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,18 +241,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var to = Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) +
|
var to = Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) +
|
||||||
(map.Grid.OffsetOfSubCell(mobile.FromSubCell) + map.Grid.OffsetOfSubCell(mobile.ToSubCell)) / 2;
|
(map.Grid.OffsetOfSubCell(mobile.FromSubCell) + map.Grid.OffsetOfSubCell(mobile.ToSubCell)) / 2;
|
||||||
|
|
||||||
QueueChild(new MoveFirstHalf(
|
QueueChild(self, new MoveFirstHalf(this, from, to, mobile.Facing, mobile.Facing, 0), true);
|
||||||
this,
|
|
||||||
from,
|
|
||||||
to,
|
|
||||||
mobile.Facing,
|
|
||||||
mobile.Facing,
|
|
||||||
0));
|
|
||||||
|
|
||||||
// While carrying out one Move order, MoveSecondHalf finishes its work from time to time and returns null.
|
|
||||||
// That causes the ChildActivity to be null and makes us return to this part of code.
|
|
||||||
// If we only queue the activity and not run it, units will lose one tick and pause briefly!
|
|
||||||
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +375,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (ret == this)
|
if (ret == this)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
Queue(ret);
|
Queue(self, ret);
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
var turn = ActivityUtils.RunActivity(self, new Turn(self, facing));
|
var turn = ActivityUtils.RunActivity(self, new Turn(self, facing));
|
||||||
if (turn != null)
|
if (turn != null)
|
||||||
QueueChild(turn);
|
QueueChild(self, turn);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only the last queued activity (given order) is kept
|
// Only the last queued activity (given order) is kept
|
||||||
public override void Queue(Activity activity)
|
public override void Queue(Actor self, Activity activity, bool pretick = false)
|
||||||
{
|
{
|
||||||
NextActivity = activity;
|
NextActivity = activity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
protected override void OnFirstRun(Actor self)
|
protected override void OnFirstRun(Actor self)
|
||||||
{
|
{
|
||||||
if (self.Info.HasTraitInfo<IFacingInfo>())
|
if (self.Info.HasTraitInfo<IFacingInfo>())
|
||||||
QueueChild(new Turn(self, Facing));
|
QueueChild(self, new Turn(self, Facing));
|
||||||
|
|
||||||
if (self.Info.HasTraitInfo<AircraftInfo>())
|
if (self.Info.HasTraitInfo<AircraftInfo>())
|
||||||
QueueChild(new HeliLand(self, true));
|
QueueChild(self, new HeliLand(self, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
IsInterruptible = false;
|
IsInterruptible = false;
|
||||||
|
|
||||||
// Wait forever
|
// Wait forever
|
||||||
QueueChild(new WaitFor(() => false));
|
QueueChild(self, new WaitFor(() => false));
|
||||||
makeAnimation.Reverse(self, () => DoTransform(self));
|
makeAnimation.Reverse(self, () => DoTransform(self));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
self.NotifyBlocker(BlockedExitCells(actor));
|
self.NotifyBlocker(BlockedExitCells(actor));
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(new Wait(10), this);
|
return ActivityUtils.SequenceActivities(self, new Wait(10), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
cargo.Unload(self);
|
cargo.Unload(self);
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return new Fly(self, target, WDist.FromCells(3), WDist.FromCells(5),
|
return new Fly(self, target, WDist.FromCells(3), WDist.FromCells(5),
|
||||||
initialTargetPosition, targetLineColor);
|
initialTargetPosition, targetLineColor);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new HeliFly(self, target, initialTargetPosition, targetLineColor),
|
new HeliFly(self, target, initialTargetPosition, targetLineColor),
|
||||||
new Turn(self, Info.InitialFacing));
|
new Turn(self, Info.InitialFacing));
|
||||||
}
|
}
|
||||||
@@ -674,11 +674,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
// TODO: Ignore repulsion when moving
|
// TODO: Ignore repulsion when moving
|
||||||
if (!Info.CanHover)
|
if (!Info.CanHover)
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new CallFunc(() => SetVisualPosition(self, fromPos)),
|
new CallFunc(() => SetVisualPosition(self, fromPos)),
|
||||||
new Fly(self, Target.FromPos(toPos)));
|
new Fly(self, Target.FromPos(toPos)));
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
new CallFunc(() => SetVisualPosition(self, fromPos)),
|
new CallFunc(() => SetVisualPosition(self, fromPos)),
|
||||||
new HeliFly(self, Target.FromPos(toPos)));
|
new HeliFly(self, Target.FromPos(toPos)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
wasMovingWithinRange = true;
|
wasMovingWithinRange = true;
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(self,
|
||||||
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red),
|
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,12 +144,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
if (!preventDock)
|
if (!preventDock)
|
||||||
{
|
{
|
||||||
dockOrder.Queue(new CallFunc(() => dockedHarv = harv, false));
|
dockOrder.Queue(self, new CallFunc(() => dockedHarv = harv, false));
|
||||||
dockOrder.Queue(DockSequence(harv, self));
|
dockOrder.Queue(self, DockSequence(harv, self));
|
||||||
dockOrder.Queue(new CallFunc(() => dockedHarv = null, false));
|
dockOrder.Queue(self, new CallFunc(() => dockedHarv = null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
dockOrder.Queue(new CallFunc(() => harv.Trait<Harvester>().ContinueHarvesting(harv)));
|
dockOrder.Queue(self, new CallFunc(() => harv.Trait<Harvester>().ContinueHarvesting(harv)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var notifyBlocking = new CallFunc(() => self.NotifyBlocker(cellInfo.Cell));
|
var notifyBlocking = new CallFunc(() => self.NotifyBlocker(cellInfo.Cell));
|
||||||
var waitFor = new WaitFor(() => CanEnterCell(cellInfo.Cell));
|
var waitFor = new WaitFor(() => CanEnterCell(cellInfo.Cell));
|
||||||
var move = new Move(self, cellInfo.Cell);
|
var move = new Move(self, cellInfo.Cell);
|
||||||
self.QueueActivity(ActivityUtils.SequenceActivities(notifyBlocking, waitFor, move));
|
self.QueueActivity(ActivityUtils.SequenceActivities(self, notifyBlocking, waitFor, move));
|
||||||
|
|
||||||
Log.Write("debug", "OnNudge (notify next blocking actor, wait and move) #{0} from {1} to {2}",
|
Log.Write("debug", "OnNudge (notify next blocking actor, wait and move) #{0} from {1} to {2}",
|
||||||
self.ActorID, self.Location, cellInfo.Cell);
|
self.ActorID, self.Location, cellInfo.Cell);
|
||||||
@@ -628,7 +628,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
var delta = toPos - fromPos;
|
var delta = toPos - fromPos;
|
||||||
var facing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : Facing;
|
var facing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : Facing;
|
||||||
return ActivityUtils.SequenceActivities(new Turn(self, facing), new Drag(self, fromPos, toPos, length));
|
return ActivityUtils.SequenceActivities(self, new Turn(self, facing), new Drag(self, fromPos, toPos, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPos? ClosestGroundCell()
|
CPos? ClosestGroundCell()
|
||||||
|
|||||||
@@ -112,13 +112,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
self.SetTargetLine(order.Target, Color.Green);
|
self.SetTargetLine(order.Target, Color.Green);
|
||||||
|
var activities = ActivityUtils.SequenceActivities(self,
|
||||||
var activities = ActivityUtils.SequenceActivities(
|
|
||||||
movement.MoveToTarget(self, order.Target, targetLineColor: Color.Green),
|
movement.MoveToTarget(self, order.Target, targetLineColor: Color.Green),
|
||||||
new CallFunc(() => AfterReachActivities(self, order, movement)));
|
new CallFunc(() => AfterReachActivities(self, order, movement)));
|
||||||
|
|
||||||
self.QueueActivity(new WaitForTransport(self, activities));
|
self.QueueActivity(new WaitForTransport(self, activities));
|
||||||
|
|
||||||
TryCallTransport(self, order.Target, new CallFunc(() => AfterReachActivities(self, order, movement)));
|
TryCallTransport(self, order.Target, new CallFunc(() => AfterReachActivities(self, order, movement)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user