From 64497c9b2f1f481419fa8c09ea40a5462c29614c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 2 Jun 2011 18:11:30 +1200 Subject: [PATCH] Fix exploding walls --- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + OpenRA.Mods.RA/Render/RenderBuilding.cs | 10 +------ .../Render/WithBuildingExplosion.cs | 28 +++++++++++++++++++ mods/cnc/rules/defaults.yaml | 4 +++ mods/ra/rules/defaults.yaml | 1 + 5 files changed, 35 insertions(+), 9 deletions(-) create mode 100755 OpenRA.Mods.RA/Render/WithBuildingExplosion.cs diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 0cc401c1a1..6d472d863b 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -347,6 +347,7 @@ + diff --git a/OpenRA.Mods.RA/Render/RenderBuilding.cs b/OpenRA.Mods.RA/Render/RenderBuilding.cs index c87935ac4c..1632e624b7 100755 --- a/OpenRA.Mods.RA/Render/RenderBuilding.cs +++ b/OpenRA.Mods.RA/Render/RenderBuilding.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Render } } - public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, IRenderModifier, INotifyKilled + public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, IRenderModifier { readonly RenderBuildingInfo Info; @@ -103,13 +103,5 @@ namespace OpenRA.Mods.RA.Render else if (e.DamageState < DamageState.Heavy) anim.ReplaceAnim("idle"); } - - public void Killed(Actor self, AttackInfo e) - { - var bi = self.Info.Traits.Get(); - FootprintUtils.UnpathableTiles(self.Info.Name, bi, self.Location).Do( - t => self.World.AddFrameEndTask( - w => w.Add(new Explosion(w, Traits.Util.CenterOfCell(t), "building", false, 0)))); - } } } diff --git a/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs b/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs new file mode 100755 index 0000000000..3e35945673 --- /dev/null +++ b/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs @@ -0,0 +1,28 @@ +#region Copyright & License Information +/* + * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using OpenRA.Mods.RA.Buildings; +using OpenRA.Mods.RA.Effects; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA.Render +{ + class WithBuildingExplosionInfo : TraitInfo { } + class WithBuildingExplosion : INotifyKilled + { + public void Killed(Actor self, AttackInfo e) + { + var bi = self.Info.Traits.Get(); + FootprintUtils.UnpathableTiles(self.Info.Name, bi, self.Location).Do( + t => self.World.AddFrameEndTask( + w => w.Add(new Explosion(w, Traits.Util.CenterOfCell(t), "building", false, 0)))); + } + } +} diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 9a910783a6..0493effe6a 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -205,6 +205,7 @@ Buildable: Queue: Building RenderBuilding: + WithBuildingExplosion: DeadBuildingState: EmitInfantryOnSell: ActorTypes: e6,e1 @@ -234,6 +235,8 @@ Armor: Type: Wood Building: + RenderBuilding: + WithBuildingExplosion: -RepairableBuilding: -Capturable: Tooltip: @@ -249,6 +252,7 @@ RenderBuilding: OverrideTileset: DESERT OverrideImage: v23 + -WithBuildingExplosion: ^Wall: AppearsOnRadar: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 674885f5ad..c23c909c08 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -176,6 +176,7 @@ DamagedSound: kaboom1.aud DestroyedSound: kaboom22.aud RenderBuilding: + WithBuildingExplosion: RepairableBuilding: EmitInfantryOnSell: ActorTypes: e1,e1,e1,c1,c2,e6