Support multiple death animation variants.
This commit is contained in:
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public readonly bool CrushedPaletteIsPlayerPalette = false;
|
||||
|
||||
[FieldLoader.LoadUsing("LoadDeathTypes")]
|
||||
[Desc("Death animation to use for each damage type (defined on the warheads).",
|
||||
[Desc("Death animations to use for each damage type (defined on the warheads).",
|
||||
"Is only used if UseDeathTypeSuffix is `True`.")]
|
||||
public readonly Dictionary<string, string> DeathTypes = new Dictionary<string, string>();
|
||||
public readonly Dictionary<string, string[]> DeathTypes = new Dictionary<string, string[]>();
|
||||
|
||||
[Desc("Sequence to use when the actor is killed by some non-standard means (e.g. suicide).")]
|
||||
[SequenceReference] public readonly string FallbackSequence = null;
|
||||
@@ -54,8 +54,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var md = yaml.ToDictionary();
|
||||
|
||||
return md.ContainsKey("DeathTypes")
|
||||
? md["DeathTypes"].ToDictionary(my => FieldLoader.GetValue<string>("(value)", my.Value))
|
||||
: new Dictionary<string, string>();
|
||||
? md["DeathTypes"].ToDictionary(my => FieldLoader.GetValue<string[]>("(value)", my.Value))
|
||||
: new Dictionary<string, string[]>();
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithDeathAnimation(init.Self, this); }
|
||||
@@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (damageType == null)
|
||||
return;
|
||||
|
||||
sequence += Info.DeathTypes[damageType];
|
||||
sequence += Info.DeathTypes[damageType].Random(self.World.SharedRandom);
|
||||
}
|
||||
|
||||
SpawnDeathAnimation(self, self.CenterPosition, rs.GetImage(self), sequence, palette);
|
||||
|
||||
Reference in New Issue
Block a user