Replace SequenceActivities with ChildActivity in several activities.
This commit is contained in:
@@ -91,6 +91,13 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (ChildActivity != null)
|
||||||
|
{
|
||||||
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCanceling || !attack.CanAttack(self, target))
|
if (IsCanceling || !attack.CanAttack(self, target))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
@@ -103,7 +110,9 @@ 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(self, new Wait(attack.info.InitialChargeDelay), new ChargeFire(attack, target), this);
|
QueueChild(self, new Wait(attack.info.InitialChargeDelay), true);
|
||||||
|
QueueChild(self, new ChargeFire(attack, target));
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +129,13 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (ChildActivity != null)
|
||||||
|
{
|
||||||
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCanceling || !attack.CanAttack(self, target))
|
if (IsCanceling || !attack.CanAttack(self, target))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
@@ -128,7 +144,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
attack.DoAttack(self, target);
|
attack.DoAttack(self, target);
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(self, new Wait(attack.info.ChargeDelay), this);
|
QueueChild(self, new Wait(attack.info.ChargeDelay), true);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (ChildActivity != null)
|
||||||
|
{
|
||||||
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCanceling)
|
if (IsCanceling)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
@@ -40,10 +47,9 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
return ActivityUtils.SequenceActivities(self,
|
QueueChild(self, new AttackMoveActivity(self, () => move.MoveTo(target.Location, 2)), true);
|
||||||
new AttackMoveActivity(self, () => move.MoveTo(target.Location, 2)),
|
QueueChild(self, new Wait(25));
|
||||||
new Wait(25),
|
return this;
|
||||||
this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (ChildActivity != null)
|
||||||
|
{
|
||||||
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCanceling)
|
if (IsCanceling)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
@@ -83,9 +90,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// Move into range
|
// Move into range
|
||||||
wasMovingWithinRange = true;
|
wasMovingWithinRange = true;
|
||||||
return ActivityUtils.SequenceActivities(self,
|
QueueChild(self, move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor), true);
|
||||||
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor),
|
return this;
|
||||||
this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (ChildActivity != null)
|
||||||
|
{
|
||||||
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
cargo.Unloading = false;
|
cargo.Unloading = false;
|
||||||
if (IsCanceling || cargo.IsEmpty(self))
|
if (IsCanceling || cargo.IsEmpty(self))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
@@ -75,8 +82,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (exitSubCell == null)
|
if (exitSubCell == null)
|
||||||
{
|
{
|
||||||
self.NotifyBlocker(BlockedExitCells(actor));
|
self.NotifyBlocker(BlockedExitCells(actor));
|
||||||
|
QueueChild(self, new Wait(10), true);
|
||||||
return ActivityUtils.SequenceActivities(self, new Wait(10), this);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
cargo.Unload(self);
|
cargo.Unload(self);
|
||||||
|
|||||||
@@ -176,6 +176,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
if (ChildActivity != null)
|
||||||
|
{
|
||||||
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCanceling)
|
if (IsCanceling)
|
||||||
{
|
{
|
||||||
// Cancel the requested target, but keep firing on it while in range
|
// Cancel the requested target, but keep firing on it while in range
|
||||||
@@ -275,9 +282,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
wasMovingWithinRange = true;
|
wasMovingWithinRange = true;
|
||||||
return ActivityUtils.SequenceActivities(self,
|
QueueChild(self, move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red), true);
|
||||||
move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red),
|
return this;
|
||||||
this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user