Remove DamageWarhead.DeathType in favor of DamageWarhead.DamageTypes

This commit is contained in:
penev92
2015-04-30 13:43:27 +03:00
parent c76fb51b14
commit 32bb70abca
6 changed files with 57 additions and 31 deletions

View File

@@ -22,7 +22,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Multiply volume with this factor.")]
public readonly float VolumeMultiplier = 1f;
[Desc("DeathTypes that this should be used for. If empty, this will be used as the default sound.")]
[Desc("Damage types that this should be used for (defined on the warheads).",
"If empty, this will be used as the default sound for all death types.")]
public readonly string[] DeathTypes = { };
public object Create(ActorInitializer init) { return new DeathSounds(this); }
@@ -40,8 +41,7 @@ namespace OpenRA.Mods.Common.Traits
if (e.Warhead == null)
return;
if (info.DeathTypes.Contains(e.Warhead.DeathType) || (!info.DeathTypes.Any() &&
!self.Info.Traits.WithInterface<DeathSoundsInfo>().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
if (info.DeathTypes.Intersect(e.Warhead.DamageTypes).Any())
self.PlayVoiceLocal(info.DeathSound, info.VolumeMultiplier);
}
}