Added positive palette/tileset properties to RotationPaletteEffect

This commit is contained in:
reaperrr
2015-08-23 00:39:20 +02:00
parent 96c7d4345e
commit cd9effaa35
2 changed files with 17 additions and 7 deletions

View File

@@ -18,11 +18,19 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Palette effect used for sprinkle \"animations\".")] [Desc("Palette effect used for sprinkle \"animations\".")]
class RotationPaletteEffectInfo : ITraitInfo 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<string> Palettes = new HashSet<string>();
[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.")] [Desc("Defines which palettes should be excluded from this effect.")]
public readonly HashSet<string> ExcludePalettes = new HashSet<string>(); public readonly HashSet<string> ExcludePalettes = new HashSet<string>();
[Desc("Don't apply the effect for these tileset IDs.")] [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.")] [Desc("Palette index of first RotationRange color.")]
public readonly int RotationBase = 0x60; public readonly int RotationBase = 0x60;
@@ -65,7 +73,10 @@ namespace OpenRA.Mods.Common.Traits
foreach (var kvp in palettes) 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; continue;
var palette = kvp.Value; var palette = kvp.Value;

View File

@@ -68,14 +68,13 @@
PlayerHighlightPalette: PlayerHighlightPalette:
MenuPaletteEffect: MenuPaletteEffect:
RotationPaletteEffect@defaultwater: RotationPaletteEffect@defaultwater:
ExcludePalettes: chrome Palettes: terrain
ExcludeTilesets: DESERT ExcludeTilesets: DESERT
RotationPaletteEffect@actorswater: RotationPaletteEffect@actorswater:
ExcludePalettes: chrome, terrain Palettes: player, effect
ExcludeTilesets: TEMPERAT, SNOW, INTERIOR
RotationPaletteEffect@desertwater: RotationPaletteEffect@desertwater:
ExcludePalettes: chrome, effect, player Palettes: terrain
ExcludeTilesets: TEMPERAT, SNOW, INTERIOR Tilesets: DESERT
RotationBase: 32 RotationBase: 32
LightPaletteRotator: LightPaletteRotator:
ExcludePalettes: terrain, effect ExcludePalettes: terrain, effect