Move the creation of the CrushedSequence to WithDeathAnimation
This commit is contained in:
@@ -57,17 +57,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
Game.Sound.Play(info.CrushSound, crusher.CenterPosition);
|
||||
|
||||
var wda = self.TraitsImplementing<WithDeathAnimation>()
|
||||
.FirstOrDefault(s => s.Info.CrushedSequence != null);
|
||||
if (wda != null)
|
||||
{
|
||||
var palette = wda.Info.CrushedSequencePalette;
|
||||
if (wda.Info.CrushedPaletteIsPlayerPalette)
|
||||
palette += self.Owner.InternalName;
|
||||
|
||||
wda.SpawnDeathAnimation(self, wda.Info.CrushedSequence, palette);
|
||||
}
|
||||
|
||||
self.Kill(crusher);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyCrushed.OnCrush(Actor self, Actor crusher, HashSet<string> crushClasses)
|
||||
{
|
||||
crushed = true;
|
||||
|
||||
if (Info.CrushedSequence == null)
|
||||
return;
|
||||
|
||||
var crushPalette = Info.CrushedSequencePalette;
|
||||
if (Info.CrushedPaletteIsPlayerPalette)
|
||||
crushPalette += self.Owner.InternalName;
|
||||
|
||||
SpawnDeathAnimation(self, Info.CrushedSequence, crushPalette);
|
||||
}
|
||||
|
||||
void INotifyCrushed.WarnCrush(Actor self, Actor crusher, HashSet<string> crushClasses) { }
|
||||
|
||||
Reference in New Issue
Block a user