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