Fix DropPodsPower triggering radar pings upon failure

This commit is contained in:
Gustas
2023-04-16 18:23:31 +03:00
committed by Matthias Mailänder
parent b59bb998eb
commit 90c7680743

View File

@@ -108,9 +108,7 @@ namespace OpenRA.Mods.Cnc.Traits
public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);
SendDropPods(self, self.World.Map.CellContaining(order.Target.CenterPosition));
SendDropPods(self, self.World.Map.CellContaining(order.Target.CenterPosition), () => base.Activate(self, order, manager));
}
public bool CanActivate(World world, CPos cell)
@@ -120,13 +118,16 @@ namespace OpenRA.Mods.Cnc.Traits
&& !world.ActorMap.GetActorsAt(c).Any());
}
public void SendDropPods(Actor self, CPos targetCell)
public void SendDropPods(Actor self, CPos targetCell, Action onSuccess)
{
self.World.AddFrameEndTask(world =>
{
if (!CanActivate(self.World, targetCell))
return;
PlayLaunchSounds();
onSuccess();
if (info.CameraActor != null)
{
var camera = world.CreateActor(info.CameraActor, new TypeDictionary
@@ -139,8 +140,6 @@ namespace OpenRA.Mods.Cnc.Traits
camera.QueueActivity(new RemoveSelf());
}
PlayLaunchSounds();
var dropAmount = world.SharedRandom.Next(info.Drops.X, info.Drops.Y);
var validUnitTypes = unitTypes.ToList();
for (var i = 0; i < dropAmount; i++)