diff --git a/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs b/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs index 33e98a5fbc..98234ea692 100644 --- a/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/ShakeOnDeath.cs @@ -9,12 +9,16 @@ */ #endregion +using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { public class ShakeOnDeathInfo : TraitInfo { + [Desc("DeathType(s) that trigger the shake. Leave empty to always trigger a shake.")] + public readonly BitSet DeathTypes = default(BitSet); + public readonly int Duration = 10; public readonly int Intensity = 1; public override object Create(ActorInitializer init) { return new ShakeOnDeath(this); } @@ -31,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits void INotifyKilled.Killed(Actor self, AttackInfo e) { + if (!info.DeathTypes.IsEmpty && !e.Damage.DamageTypes.Overlaps(info.DeathTypes)) + return; + self.World.WorldActor.Trait().AddEffect(info.Duration, self.CenterPosition, info.Intensity); } }