From c92d1342f01f8f3c8fe4efdf6e75231211309dbb Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 21 Mar 2015 15:56:34 +0000 Subject: [PATCH] Allow mods to define Defaults for all animations in a sequence. --- OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 5286bb9210..a32a2cdaf2 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -28,8 +28,16 @@ namespace OpenRA.Mods.Common.Graphics public IReadOnlyDictionary ParseSequences(ModData modData, TileSet tileSet, SpriteCache cache, MiniYamlNode node) { var sequences = new Dictionary(); + var nodes = node.Value.ToDictionary(); - foreach (var kvp in node.Value.ToDictionary()) + MiniYaml defaults; + if (nodes.TryGetValue("Defaults", out defaults)) + { + nodes.Remove("Defaults"); + nodes = nodes.ToDictionary(kv => kv.Key, kv => MiniYaml.MergeStrict(kv.Value, defaults)); + } + + foreach (var kvp in nodes) { using (new Support.PerfTimer("new Sequence(\"{0}\")".F(node.Key), 20)) {