completely destroy long bridges in a chain reaction
This commit is contained in:
@@ -289,12 +289,34 @@ namespace OpenRA.Mods.RA
|
||||
return damage;
|
||||
}
|
||||
|
||||
public void Demolish(Actor saboteur)
|
||||
public void Demolish(Actor saboteur, bool continueNorth, bool continueSouth)
|
||||
{
|
||||
// TODO: completely destroy long bridges in a chain reaction
|
||||
Combat.DoExplosion(saboteur, "Demolish", self.CenterPosition);
|
||||
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(15, self.CenterPosition, 6);
|
||||
self.Kill(saboteur);
|
||||
var initialDamage = Health.DamageState;
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
Combat.DoExplosion(saboteur, "Demolish", self.CenterPosition);
|
||||
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(15, self.CenterPosition, 6);
|
||||
self.Kill(saboteur);
|
||||
});
|
||||
|
||||
// Destroy adjacent spans (long bridges)
|
||||
if (continueNorth && northNeighbour != null)
|
||||
{
|
||||
var delay = initialDamage == DamageState.Dead || NeighbourIsDeadShore(northNeighbour) ?
|
||||
0 : Info.RepairPropagationDelay;
|
||||
|
||||
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
|
||||
northNeighbour.Demolish(saboteur, true, false))));
|
||||
}
|
||||
|
||||
if (continueSouth && southNeighbour != null)
|
||||
{
|
||||
var delay = initialDamage == DamageState.Dead || NeighbourIsDeadShore(southNeighbour) ?
|
||||
0 : Info.RepairPropagationDelay;
|
||||
|
||||
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
|
||||
southNeighbour.Demolish(saboteur, false, true))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void Demolish(Actor self, Actor saboteur)
|
||||
{
|
||||
bridge.Demolish(saboteur);
|
||||
bridge.Demolish(saboteur, true, true);
|
||||
}
|
||||
|
||||
public bool IsValidTarget(Actor self, Actor saboteur)
|
||||
|
||||
Reference in New Issue
Block a user