From cd9effaa35c3983c2afd5542a19bf53aa3b18b5d Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 23 Aug 2015 00:39:20 +0200 Subject: [PATCH] Added positive palette/tileset properties to RotationPaletteEffect --- .../PaletteEffects/RotationPaletteEffect.cs | 15 +++++++++++++-- mods/ra/rules/palettes.yaml | 9 ++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs b/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs index 8a343594e1..d5d105a41c 100644 --- a/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs +++ b/OpenRA.Mods.Common/Traits/PaletteEffects/RotationPaletteEffect.cs @@ -18,11 +18,19 @@ namespace OpenRA.Mods.Common.Traits [Desc("Palette effect used for sprinkle \"animations\".")] class RotationPaletteEffectInfo : ITraitInfo { + [Desc("Defines to which palettes this effect should be applied to.", + "If none specified, it applies to all palettes not explicitly excluded.")] + public readonly HashSet Palettes = new HashSet(); + + [Desc("Defines for which tileset IDs this effect should be loaded.", + "If none specified, it applies to all tileset IDs not explicitly excluded.")] + public readonly string[] Tilesets = null; + [Desc("Defines which palettes should be excluded from this effect.")] public readonly HashSet ExcludePalettes = new HashSet(); [Desc("Don't apply the effect for these tileset IDs.")] - public readonly string[] ExcludeTilesets = { }; + public readonly string[] ExcludeTilesets = null; [Desc("Palette index of first RotationRange color.")] public readonly int RotationBase = 0x60; @@ -65,7 +73,10 @@ namespace OpenRA.Mods.Common.Traits foreach (var kvp in palettes) { - if (info.ExcludePalettes.Contains(kvp.Key) || info.ExcludeTilesets.Contains(world.TileSet.Id)) + if ((info.Palettes.Count > 0 && !info.Palettes.Any(kvp.Key.StartsWith)) + || (info.Tilesets != null && !info.Tilesets.Contains(world.TileSet.Id)) + || (info.ExcludePalettes.Count > 0 && info.ExcludePalettes.Any(kvp.Key.StartsWith)) + || (info.ExcludeTilesets != null && info.ExcludeTilesets.Contains(world.TileSet.Id))) continue; var palette = kvp.Value; diff --git a/mods/ra/rules/palettes.yaml b/mods/ra/rules/palettes.yaml index a4a91689a8..56813c0b4e 100644 --- a/mods/ra/rules/palettes.yaml +++ b/mods/ra/rules/palettes.yaml @@ -68,14 +68,13 @@ PlayerHighlightPalette: MenuPaletteEffect: RotationPaletteEffect@defaultwater: - ExcludePalettes: chrome + Palettes: terrain ExcludeTilesets: DESERT RotationPaletteEffect@actorswater: - ExcludePalettes: chrome, terrain - ExcludeTilesets: TEMPERAT, SNOW, INTERIOR + Palettes: player, effect RotationPaletteEffect@desertwater: - ExcludePalettes: chrome, effect, player - ExcludeTilesets: TEMPERAT, SNOW, INTERIOR + Palettes: terrain + Tilesets: DESERT RotationBase: 32 LightPaletteRotator: ExcludePalettes: terrain, effect