From 1518dc9145a5a897d06ec3f259de64ad6b258c65 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 18 Jul 2015 23:24:48 +0200 Subject: [PATCH] Support multiple WithDeathAnimation traits --- OpenRA.Mods.Common/Traits/Crushable.cs | 3 ++- OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Crushable.cs b/OpenRA.Mods.Common/Traits/Crushable.cs index b088ec9d4a..41e90f6da8 100644 --- a/OpenRA.Mods.Common/Traits/Crushable.cs +++ b/OpenRA.Mods.Common/Traits/Crushable.cs @@ -49,7 +49,8 @@ namespace OpenRA.Mods.Common.Traits public void OnCrush(Actor crusher) { Sound.Play(info.CrushSound, crusher.CenterPosition); - var wda = self.TraitOrDefault(); + var wda = self.TraitsImplementing() + .FirstOrDefault(s => s.Info.CrushedSequence != null); if (wda != null) { var palette = wda.Info.CrushedSequencePalette; diff --git a/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs index 7977656e70..3d9eca847e 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs @@ -82,8 +82,7 @@ namespace OpenRA.Mods.Common.Traits var warhead = e.Warhead as DamageWarhead; var damageType = warhead.DamageTypes.Intersect(Info.DeathTypes.Keys).FirstOrDefault(); if (damageType == null) - throw new Exception("Actor type `{0}` does not define a death animation for weapon with damage types `{1}`!" - .F(self.Info.Name, string.Join(", ", warhead.DamageTypes))); + return; sequence += Info.DeathTypes[damageType]; }