#6030 Regression fix. CreateEffectWarhead effect location and water impact sound.

This commit is contained in:
UberWaffe
2014-08-04 16:28:59 +02:00
parent c482e97060
commit 0f8023217d

View File

@@ -19,9 +19,6 @@ namespace OpenRA.Mods.RA
{ {
public class CreateEffectWarhead : Warhead public class CreateEffectWarhead : Warhead
{ {
[Desc("Size of the area. An explosion animation will be created in each tile.", "Provide 2 values for a ring effect (outer/inner).")]
public readonly int[] Size = { 0, 0 };
[Desc("Explosion effect to use.")] [Desc("Explosion effect to use.")]
public readonly string Explosion = null; public readonly string Explosion = null;
@@ -53,31 +50,20 @@ namespace OpenRA.Mods.RA
if (!world.Map.Contains(targetTile)) if (!world.Map.Contains(targetTile))
return; return;
var minRange = (Size.Length > 1 && Size[1] > 0) ? Size[1] : 0; // TODO: #5937 should go in here after rebase.
var allCells = world.Map.FindTilesInAnnulus(targetTile, minRange, Size[0]); var isWater = pos.Z <= 0 && world.Map.GetTerrainInfo(targetTile).IsWater;
var explosionType = isWater ? WaterExplosion : Explosion;
var explosionTypePalette = isWater ? WaterExplosionPalette : ExplosionPalette;
// Draw the effects if (explosionType != null)
foreach (var currentCell in allCells) world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, explosionType, explosionTypePalette)));
{
var currentPos = world.Map.CenterOfCell(currentCell);
// TODO: #5937 should go in here after rebase.
var isWater = currentPos.Z <= 0 && world.Map.GetTerrainInfo(currentCell).IsWater;
var explosionType = isWater ? WaterExplosion : Explosion;
var explosionTypePalette = isWater ? WaterExplosionPalette : ExplosionPalette;
if (explosionType != null) var sound = ImpactSound;
world.AddFrameEndTask(w => w.Add(new Explosion(w, currentPos, explosionType, explosionTypePalette)));
}
string sound = null;
var isTargetWater = pos.Z <= 0 && world.Map.GetTerrainInfo(targetTile).IsWater; var isTargetWater = pos.Z <= 0 && world.Map.GetTerrainInfo(targetTile).IsWater;
if (isTargetWater && WaterImpactSound != null) if (isTargetWater && WaterImpactSound != null)
sound = WaterImpactSound; sound = WaterImpactSound;
if (ImpactSound != null)
sound = ImpactSound;
Sound.Play(sound, pos); Sound.Play(sound, pos);
} }