diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index e9de67301b..6ba96ea6dc 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -72,7 +72,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs index 13ed8c21ad..e6c80d8402 100644 --- a/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs +++ b/OpenRA.Mods.Cnc/Traits/PaletteEffects/LightPaletteRotator.cs @@ -18,8 +18,18 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("Palette effect used for blinking \"animations\" on actors.")] class LightPaletteRotatorInfo : ITraitInfo { + [Desc("Palettes this effect should not apply to.")] public readonly HashSet ExcludePalettes = new HashSet(); + [Desc("'Speed' at which the effect cycles through palette indices.")] + public readonly float TimeStep = .5f; + + [Desc("Palette index to map to rotating color indices.")] + public readonly int ModifyIndex = 103; + + [Desc("Palette indices to rotate through.")] + public readonly int[] RotationIndices = { 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 238, 237, 236, 235, 234, 233, 232, 231 }; + public object Create(ActorInitializer init) { return new LightPaletteRotator(this); } } @@ -33,23 +43,20 @@ namespace OpenRA.Mods.Cnc.Traits this.info = info; } - public void Tick(Actor self) + void ITick.Tick(Actor self) { - t += .5f; + t += info.TimeStep; } - public void AdjustPalette(IReadOnlyDictionary palettes) + void IPaletteModifier.AdjustPalette(IReadOnlyDictionary palettes) { foreach (var pal in palettes) { if (info.ExcludePalettes.Contains(pal.Key)) continue; - var rotate = (int)t % 18; - if (rotate > 9) - rotate = 18 - rotate; - - pal.Value.SetColor(0x67, pal.Value.GetColor(230 + rotate)); + var rotate = (int)t % info.RotationIndices.Length; + pal.Value.SetColor(info.ModifyIndex, pal.Value.GetColor(info.RotationIndices[rotate])); } } } diff --git a/OpenRA.Mods.Cnc/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs similarity index 100% rename from OpenRA.Mods.Cnc/ImportRedAlertLegacyMapCommand.cs rename to OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs diff --git a/OpenRA.Mods.Cnc/ImportTiberianDawnLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs similarity index 100% rename from OpenRA.Mods.Cnc/ImportTiberianDawnLegacyMapCommand.cs rename to OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs