diff --git a/OpenRA.Mods.RA/Activities/MakeAnimation.cs b/OpenRA.Mods.RA/Activities/MakeAnimation.cs index da3b67d081..d0a6212432 100644 --- a/OpenRA.Mods.RA/Activities/MakeAnimation.cs +++ b/OpenRA.Mods.RA/Activities/MakeAnimation.cs @@ -37,8 +37,10 @@ namespace OpenRA.Mods.RA.Activities started = true; if (Reversed) { - foreach (var s in self.Info.Traits.Get().SellSounds) - Sound.PlayToPlayer(self.Owner, s, self.CenterLocation); + var bi = self.Info.Traits.GetOrDefault(); + if (bi != null) + foreach (var s in bi.SellSounds) + Sound.PlayToPlayer(self.Owner, s, self.CenterLocation); // PlayCustomAnim is required to stop a frame of the normal state after the anim completes rb.PlayCustomAnimBackwards(self, "make", () => {rb.PlayCustomAnim(self, "make"); complete = true;}); diff --git a/OpenRA.Mods.RA/Render/RenderBuilding.cs b/OpenRA.Mods.RA/Render/RenderBuilding.cs index 09d09c6ed2..cacd7d8099 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, INotifyDamage, INotifySold, IRenderModifier + public class RenderBuilding : RenderSimple, INotifyDamage, IRenderModifier { readonly RenderBuildingInfo Info; @@ -112,16 +112,5 @@ namespace OpenRA.Mods.RA.Render else if (e.DamageState < DamageState.Heavy) anim.ReplaceAnim("idle"); } - - public virtual void Selling( Actor self ) - { - if( Info.HasMakeAnimation ) - anim.PlayBackwardsThen( "make", null ); - - foreach (var s in self.Info.Traits.Get().SellSounds) - Sound.PlayToPlayer(self.Owner, s, self.CenterLocation); - } - - public void Sold(Actor self) {} } } diff --git a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs index 7252adfdf1..37b4c1f062 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs @@ -87,10 +87,11 @@ namespace OpenRA.Mods.RA.Render roof.PlayThen(NormalizeSequence(self, "build-top"), () => { isOpen = true; openExit = exit; }); } - public override void Selling( Actor self ) + public void Selling(Actor self) { - self.Trait().anims.Remove( "roof" ); - base.Selling(self); + self.Trait().anims.Remove("roof"); } + + public void Sold(Actor self) { } } }