From 118782a85ecbdd6e67d02625bbc12f4c2aa1ab55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 19 Jul 2015 18:08:17 +0200 Subject: [PATCH 1/2] check palette references --- OpenRA.Game/Traits/LintAttributes.cs | 7 ++ .../Traits/Player/FixedColorPalette.cs | 9 +- .../Traits/Player/PlayerColorPalette.cs | 6 +- OpenRA.Game/Traits/World/ResourceType.cs | 2 +- .../Traits/SupportPowers/IonCannonPower.cs | 2 +- OpenRA.Mods.Common/Effects/Bullet.cs | 4 +- OpenRA.Mods.Common/Effects/GravityBomb.cs | 2 +- OpenRA.Mods.Common/Effects/LaserZap.cs | 2 +- OpenRA.Mods.Common/Effects/Missile.cs | 5 +- OpenRA.Mods.Common/Lint/CheckPalettes.cs | 91 +++++++++++++++++++ OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 + OpenRA.Mods.Common/Traits/Armament.cs | 2 +- .../Traits/Attack/AttackGarrisoned.cs | 2 +- OpenRA.Mods.Common/Traits/Buildable.cs | 2 +- OpenRA.Mods.Common/Traits/Buildings/Bib.cs | 2 +- .../Traits/Buildings/RepairableBuilding.cs | 2 +- OpenRA.Mods.Common/Traits/Cloak.cs | 2 +- .../Traits/Crates/CrateAction.cs | 2 +- OpenRA.Mods.Common/Traits/GainsExperience.cs | 2 +- .../Traits/Modifiers/UpgradeOverlay.cs | 2 +- OpenRA.Mods.Common/Traits/Parachutable.cs | 4 +- .../Traits/Player/PlaceBuilding.cs | 2 +- .../Traits/Render/LeavesTrails.cs | 2 +- .../Traits/Render/RenderSprites.cs | 2 +- .../Traits/Render/RenderVoxels.cs | 8 +- .../Traits/Render/SelectionDecorations.cs | 2 +- .../Traits/Render/WithBuildingExplosion.cs | 2 +- .../Render/WithBuildingPlacedOverlay.cs | 2 +- .../Traits/Render/WithChargeOverlay.cs | 2 +- .../Traits/Render/WithDecoration.cs | 2 +- .../Traits/Render/WithHarvestOverlay.cs | 2 +- .../Traits/Render/WithProductionOverlay.cs | 2 +- .../Traits/Render/WithShadow.cs | 2 +- .../Traits/SupportPowers/SupportPower.cs | 4 +- .../Traits/VeteranProductionIconOverlay.cs | 2 +- .../Traits/World/PaletteFromCurrentTileset.cs | 4 +- .../Traits/World/PaletteFromFile.cs | 6 +- .../World/PaletteFromPaletteWithAlpha.cs | 4 +- .../Traits/World/PaletteFromRGBA.cs | 8 +- .../World/PlayerPaletteFromCurrentTileset.cs | 2 +- .../Traits/World/ShroudPalette.cs | 1 + .../Traits/World/ShroudRenderer.cs | 4 +- .../Traits/World/SmudgeLayer.cs | 4 +- .../Traits/World/VoxelNormalsPalette.cs | 1 + .../Traits/Render/WithAttackOverlay.cs | 2 +- .../Traits/Render/WithCrumbleOverlay.cs | 2 +- .../Traits/Render/WithDeliveryOverlay.cs | 2 +- .../Traits/World/FogPaletteFromR8.cs | 5 +- OpenRA.Mods.D2k/Traits/World/PaletteFromR8.cs | 5 +- .../Traits/World/PaletteFromScaledPalette.cs | 4 +- OpenRA.Mods.RA/Effects/TeslaZap.cs | 2 +- .../Traits/World/TSShroudPalette.cs | 1 + mods/cnc/rules/palettes.yaml | 1 + mods/ra/rules/palettes.yaml | 1 + mods/ts/rules/palettes.yaml | 1 + 55 files changed, 191 insertions(+), 58 deletions(-) create mode 100644 OpenRA.Mods.Common/Lint/CheckPalettes.cs diff --git a/OpenRA.Game/Traits/LintAttributes.cs b/OpenRA.Game/Traits/LintAttributes.cs index 9c5c9cc209..6efbd58c67 100644 --- a/OpenRA.Game/Traits/LintAttributes.cs +++ b/OpenRA.Game/Traits/LintAttributes.cs @@ -43,4 +43,11 @@ namespace OpenRA.Traits [AttributeUsage(AttributeTargets.Field)] public sealed class UpgradeUsedReferenceAttribute : Attribute { } + + [AttributeUsage(AttributeTargets.Field)] + public sealed class PaletteDefinitionAttribute : Attribute { } + + // TODO: differentiate player palettes + [AttributeUsage(AttributeTargets.Field)] + public sealed class PaletteReferenceAttribute : Attribute { } } diff --git a/OpenRA.Game/Traits/Player/FixedColorPalette.cs b/OpenRA.Game/Traits/Player/FixedColorPalette.cs index 5b5d62443f..5997f777f4 100644 --- a/OpenRA.Game/Traits/Player/FixedColorPalette.cs +++ b/OpenRA.Game/Traits/Player/FixedColorPalette.cs @@ -16,15 +16,20 @@ namespace OpenRA.Traits public class FixedColorPaletteInfo : ITraitInfo { [Desc("The name of the palette to base off.")] - public readonly string Base = "terrain"; + [PaletteReference] public readonly string Base = "terrain"; + [Desc("The name of the resulting palette")] - public readonly string Name = "resources"; + [PaletteDefinition] public readonly string Name = "resources"; + [Desc("Remap these indices to pre-defined colors.")] public readonly int[] RemapIndex = { }; + [Desc("The fixed color to remap.")] public readonly HSLColor Color; + [Desc("Luminosity range to span.")] public readonly float Ramp = 0.05f; + [Desc("Allow palette modifiers to change the palette.")] public readonly bool AllowModifiers = true; diff --git a/OpenRA.Game/Traits/Player/PlayerColorPalette.cs b/OpenRA.Game/Traits/Player/PlayerColorPalette.cs index c45fbc8fa8..9942af3db3 100644 --- a/OpenRA.Game/Traits/Player/PlayerColorPalette.cs +++ b/OpenRA.Game/Traits/Player/PlayerColorPalette.cs @@ -17,13 +17,17 @@ namespace OpenRA.Traits public class PlayerColorPaletteInfo : ITraitInfo { [Desc("The name of the palette to base off.")] - public readonly string BasePalette = null; + [PaletteReference] public readonly string BasePalette = null; + [Desc("The prefix for the resulting player palettes")] public readonly string BaseName = "player"; + [Desc("Remap these indices to player colors.")] public readonly int[] RemapIndex = { }; + [Desc("Luminosity range to span.")] public readonly float Ramp = 0.05f; + [Desc("Allow palette modifiers to change the palette.")] public readonly bool AllowModifiers = true; diff --git a/OpenRA.Game/Traits/World/ResourceType.cs b/OpenRA.Game/Traits/World/ResourceType.cs index bd175eae9a..bd7004090d 100644 --- a/OpenRA.Game/Traits/World/ResourceType.cs +++ b/OpenRA.Game/Traits/World/ResourceType.cs @@ -17,7 +17,7 @@ namespace OpenRA.Traits { public readonly string Sequence = "resources"; [SequenceReference("Sequence")] public readonly string[] Variants = { }; - public readonly string Palette = "terrain"; + [PaletteReference] public readonly string Palette = "terrain"; public readonly int ResourceType = 1; public readonly int ValuePerUnit = 0; diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs index b85aaf83f8..526d1bd795 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("Effect sequence to display")] public readonly string Effect = "ionsfx"; - public readonly string EffectPalette = "effect"; + [PaletteReference] public readonly string EffectPalette = "effect"; [Desc("Which weapon to fire"), WeaponReference] public readonly string Weapon = "IonCannon"; diff --git a/OpenRA.Mods.Common/Effects/Bullet.cs b/OpenRA.Mods.Common/Effects/Bullet.cs index e8576b3078..ba4577266c 100644 --- a/OpenRA.Mods.Common/Effects/Bullet.cs +++ b/OpenRA.Mods.Common/Effects/Bullet.cs @@ -35,13 +35,13 @@ namespace OpenRA.Mods.Common.Effects [SequenceReference("Image")] public readonly string Sequence = "idle"; [Desc("The palette used to draw this projectile.")] - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; [Desc("Does this projectile have a shadow?")] public readonly bool Shadow = false; [Desc("Palette to use for this projectile's shadow if Shadow is true.")] - public readonly string ShadowPalette = "shadow"; + [PaletteReference] public readonly string ShadowPalette = "shadow"; [Desc("Trail animation.")] public readonly string Trail = null; diff --git a/OpenRA.Mods.Common/Effects/GravityBomb.cs b/OpenRA.Mods.Common/Effects/GravityBomb.cs index 196053eb50..2038ad1017 100644 --- a/OpenRA.Mods.Common/Effects/GravityBomb.cs +++ b/OpenRA.Mods.Common/Effects/GravityBomb.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Effects [Desc("Sequence to play when launched. Skipped if null or empty.")] [SequenceReference("Image")] public readonly string OpenSequence = null; - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; public readonly bool Shadow = false; diff --git a/OpenRA.Mods.Common/Effects/LaserZap.cs b/OpenRA.Mods.Common/Effects/LaserZap.cs index 6018af5273..f59be66867 100644 --- a/OpenRA.Mods.Common/Effects/LaserZap.cs +++ b/OpenRA.Mods.Common/Effects/LaserZap.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Effects [Desc("Sequence of impact animation to use.")] [SequenceReference("HitAnim")] public readonly string HitAnimSequence = "idle"; - public readonly string HitAnimPalette = "effect"; + [PaletteReference] public readonly string HitAnimPalette = "effect"; public IEffect Create(ProjectileArgs args) { diff --git a/OpenRA.Mods.Common/Effects/Missile.cs b/OpenRA.Mods.Common/Effects/Missile.cs index db719094c4..456201b9ac 100644 --- a/OpenRA.Mods.Common/Effects/Missile.cs +++ b/OpenRA.Mods.Common/Effects/Missile.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Effects public readonly string Image = null; [SequenceReference("Image")] public readonly string Sequence = "idle"; - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; public readonly bool Shadow = false; @@ -59,7 +59,8 @@ namespace OpenRA.Mods.Common.Effects [Desc("Interval in ticks between each spawned Trail animation.")] public readonly int TrailInterval = 2; - public readonly string TrailPalette = "effect"; + [PaletteReference] public readonly string TrailPalette = "effect"; + public readonly bool TrailUsePlayerPalette = false; public readonly int ContrailLength = 0; public readonly Color ContrailColor = Color.White; diff --git a/OpenRA.Mods.Common/Lint/CheckPalettes.cs b/OpenRA.Mods.Common/Lint/CheckPalettes.cs new file mode 100644 index 0000000000..bc32cf45c9 --- /dev/null +++ b/OpenRA.Mods.Common/Lint/CheckPalettes.cs @@ -0,0 +1,91 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using OpenRA.Mods.Common.Traits; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Lint +{ + class CheckPalettes : ILintPass + { + public void Run(Action emitError, Action emitWarning, Map map) + { + if (map != null && !map.RuleDefinitions.Any()) + return; + + var rules = map == null ? Game.ModData.DefaultRules : map.Rules; + + var palettes = GetPalettes(emitError, rules).ToList(); + + foreach (var actorInfo in rules.Actors) + { + foreach (var traitInfo in actorInfo.Value.Traits) + { + var fields = traitInfo.GetType().GetFields(); + foreach (var field in fields.Where(x => x.HasAttribute())) + { + var references = LintExts.GetFieldValues(traitInfo, field, emitError); + foreach (var reference in references) + { + if (string.IsNullOrEmpty(reference)) + continue; + + if (!palettes.Contains(reference)) + emitError("Undefined palette reference {0} detected at {1}".F(reference, traitInfo)); + } + } + } + } + + foreach (var weaponInfo in rules.Weapons) + { + var projectileInfo = weaponInfo.Value.Projectile; + if (projectileInfo == null) + continue; + + foreach (var field in projectileInfo.GetType().GetFields()) + { + if (field.HasAttribute()) + { + var references = LintExts.GetFieldValues(projectileInfo, field, emitError); + foreach (var reference in references) + { + if (string.IsNullOrEmpty(reference)) + continue; + + if (!palettes.Contains(reference)) + emitError("Undefined palette reference {0} detected at weapon {1}.".F(reference, weaponInfo.Key)); + } + } + } + } + } + + static IEnumerable GetPalettes(Action emitError, Ruleset rules) + { + foreach (var actorInfo in rules.Actors) + { + foreach (var traitInfo in actorInfo.Value.Traits) + { + var fields = traitInfo.GetType().GetFields(); + foreach (var field in fields.Where(x => x.HasAttribute())) + { + var values = LintExts.GetFieldValues(traitInfo, field, emitError); + foreach (var value in values) + yield return value; + } + } + } + } + } +} diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 457091346f..9bf8805b53 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -178,6 +178,7 @@ + diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 7d61442ce1..d4ba3049f5 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string MuzzleSequence = null; [Desc("Palette to render Muzzle flash sequence in")] - public readonly string MuzzlePalette = "effect"; + [PaletteReference] public readonly string MuzzlePalette = "effect"; [Desc("Use multiple muzzle images if non-zero")] public readonly int MuzzleSplitFacings = 0; diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs index 87a502dc00..c2dcea7fff 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Fire port yaw cone angle.")] public readonly WAngle[] PortCones = null; - public readonly string MuzzlePalette = "effect"; + [PaletteReference] public readonly string MuzzlePalette = "effect"; public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/Buildable.cs b/OpenRA.Mods.Common/Traits/Buildable.cs index 29dca7abc0..47499267f9 100644 --- a/OpenRA.Mods.Common/Traits/Buildable.cs +++ b/OpenRA.Mods.Common/Traits/Buildable.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string ForceFaction = null; [Desc("Palette used for the production icon.")] - public readonly string IconPalette = "chrome"; + [PaletteReference] public readonly string IconPalette = "chrome"; // TODO: UI fluff; doesn't belong here public readonly int BuildPaletteOrder = 9999; diff --git a/OpenRA.Mods.Common/Traits/Buildings/Bib.cs b/OpenRA.Mods.Common/Traits/Buildings/Bib.cs index 86c3c0aeee..d29e100c77 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Bib.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Bib.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class BibInfo : ITraitInfo, Requires, IRenderActorPreviewSpritesInfo, Requires { [SequenceReference] public readonly string Sequence = "bib"; - public readonly string Palette = "terrain"; + [PaletteReference] public readonly string Palette = "terrain"; public readonly bool HasMinibib = false; public object Create(ActorInitializer init) { return new Bib(init.Self, this); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index 0568746e4e..c3a92eb91d 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits [SequenceReference("IndicatorImage")] public readonly string IndicatorSequence = "repair"; [Desc("Overrides the IndicatorPalettePrefix.")] - public readonly string IndicatorPalette = ""; + [PaletteReference] public readonly string IndicatorPalette = ""; [Desc("Suffixed by the interal repairing player name.")] public readonly string IndicatorPalettePrefix = "player"; diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 7c9916321e..5f67f8327e 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string CloakSound = null; public readonly string UncloakSound = null; - public readonly string Palette = "cloak"; + [PaletteReference] public readonly string Palette = "cloak"; public readonly string[] CloakTypes = { "Cloak" }; diff --git a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs index 63b77f1914..8f5941446d 100644 --- a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Effect = null; [Desc("Palette to draw the animation in.")] - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; [Desc("Audio clip to play when the crate is collected.")] public readonly string Notification = null; diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs index 8aad943df3..bf81233b17 100644 --- a/OpenRA.Mods.Common/Traits/GainsExperience.cs +++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Dictionary Upgrades = null; [Desc("Palette for the level up sprite.")] - public readonly string LevelUpPalette = "effect"; + [PaletteReference] public readonly string LevelUpPalette = "effect"; [Desc("Should the level-up animation be suppressed when actor is created?")] public readonly bool SuppressLevelupAnimation = true; diff --git a/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs b/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs index 53ef3ffdca..5daf8527e5 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/UpgradeOverlay.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class UpgradeOverlayInfo : UpgradableTraitInfo { [Desc("Palette to use when rendering the overlay")] - public readonly string Palette = "invuln"; + [PaletteReference] public readonly string Palette = "invuln"; public override object Create(ActorInitializer init) { return new UpgradeOverlay(this); } } diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 98be7fcccb..8fd097f4bd 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -24,11 +24,11 @@ namespace OpenRA.Mods.Common.Traits public readonly string GroundImpactSound = null; [SequenceReference("CorpseSequenceCollection")] public readonly string GroundCorpseSequence = "corpse"; - public readonly string GroundCorpsePalette = "effect"; + [PaletteReference] public readonly string GroundCorpsePalette = "effect"; public readonly string WaterImpactSound = null; [SequenceReference("CorpseSequenceCollection")] public readonly string WaterCorpseSequence = null; - public readonly string WaterCorpsePalette = "effect"; + [PaletteReference] public readonly string WaterCorpsePalette = "effect"; public readonly int FallRate = 13; diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index 07113bad52..7b5140d034 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits public class PlaceBuildingInfo : ITraitInfo { [Desc("Palette to use for rendering the placement sprite.")] - public readonly string Palette = "terrain"; + [PaletteReference] public readonly string Palette = "terrain"; [Desc("Play NewOptionsNotification this many ticks after building placement.")] public readonly int NewOptionsNotificationDelay = 10; diff --git a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs index 68ad69aedc..cdd0f751a9 100644 --- a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs +++ b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits public class LeavesTrailsInfo : ITraitInfo { public readonly string Image = null; - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; [Desc("Only do so when the terrain types match with the previous cell.")] public readonly string[] TerrainTypes = { }; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs index 7eceef2ecb..480f733565 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits public readonly Dictionary RaceImages = null; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom PlayerColorPalette: BaseName")] public readonly string PlayerPalette = "player"; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs index 42adab4235..815c390e72 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs @@ -28,12 +28,12 @@ namespace OpenRA.Mods.Common.Traits public readonly string Image = null; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom PlayerColorPalette: BaseName")] - public readonly string PlayerPalette = "player"; - public readonly string NormalsPalette = "normals"; - public readonly string ShadowPalette = "shadow"; + [PaletteReference] public readonly string PlayerPalette = "player"; + [PaletteReference] public readonly string NormalsPalette = "normals"; + [PaletteReference] public readonly string ShadowPalette = "shadow"; [Desc("Change the image size.")] public readonly float Scale = 10; diff --git a/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs index 2f603ede9c..331b4e729e 100644 --- a/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs +++ b/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits { public class SelectionDecorationsInfo : ITraitInfo, ISelectionDecorationsInfo { - public readonly string Palette = "chrome"; + [PaletteReference] public readonly string Palette = "chrome"; [Desc("Visual bounds for selection box. If null, it uses AutoSelectionSize.", "The first two values define the bounds' size, the optional third and fourth", diff --git a/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs b/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs index 6c08be2cc3..07f282c6c1 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int Delay = 0; [Desc("Custom palette name")] - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; public object Create(ActorInitializer init) { return new WithBuildingExplosion(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs index 87cf8a5ae6..3a24d7d4f2 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBuildingPlacedOverlay.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WVec Offset = WVec.Zero; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; diff --git a/OpenRA.Mods.Common/Traits/Render/WithChargeOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithChargeOverlay.cs index ce5a9eb6fa..c83a938a5d 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithChargeOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithChargeOverlay.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits [SequenceReference] public readonly string Sequence = "active"; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs index 7a3c33b6cf..be2c4014bf 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecoration.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public readonly string Sequence = null; [Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")] - public readonly string Palette = "chrome"; + [PaletteReference] public readonly string Palette = "chrome"; [Desc("Point in the actor's bounding box used as reference for offsetting the decoration image." + "Possible values are any combination of Top, VCenter, Bottom and Left, HCenter, Right separated by a comma.")] diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs index 295eadc1bb..03e71b21b8 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Position relative to body")] public readonly WVec Offset = WVec.Zero; - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; public object Create(ActorInitializer init) { return new WithHarvestOverlay(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs index da73cf03dd..e6ddc77fd5 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithProductionOverlay.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WVec Offset = WVec.Zero; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; diff --git a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs index b12e5f9f19..5fdfe7685e 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Clones the aircraft sprite with another palette below it.")] class WithShadowInfo : ITraitInfo { - public readonly string Palette = "shadow"; + [PaletteReference] public readonly string Palette = "shadow"; public object Create(ActorInitializer init) { return new WithShadow(this); } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 8e5ce89f40..a4cc279cea 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -40,13 +40,13 @@ namespace OpenRA.Mods.Common.Traits public readonly bool DisplayTimer = false; [Desc("Palette used for the icon.")] - public readonly string IconPalette = "chrome"; + [PaletteReference] public readonly string IconPalette = "chrome"; [Desc("Beacons are only supported on the Airstrike and Nuke powers")] public readonly bool DisplayBeacon = false; public readonly string BeaconPalettePrefix = "player"; public readonly string BeaconPoster = null; - public readonly string BeaconPosterPalette = "chrome"; + [PaletteReference] public readonly string BeaconPosterPalette = "chrome"; public readonly bool DisplayRadarPing = false; diff --git a/OpenRA.Mods.Common/Traits/VeteranProductionIconOverlay.cs b/OpenRA.Mods.Common/Traits/VeteranProductionIconOverlay.cs index 3925a0c528..ec283cc8a7 100644 --- a/OpenRA.Mods.Common/Traits/VeteranProductionIconOverlay.cs +++ b/OpenRA.Mods.Common/Traits/VeteranProductionIconOverlay.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits [SequenceReference("Image")] public readonly string Sequence = null; [Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")] - public readonly string Palette = "chrome"; + [PaletteReference] public readonly string Palette = "chrome"; [Desc("Point on the production icon's used as reference for offsetting the overlay. ", "Possible values are any combination of Top, VCenter, Bottom and Left, HCenter, Right separated by a comma.")] diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromCurrentTileset.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromCurrentTileset.cs index 5cbe1fb7b7..c0997e4ed3 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromCurrentTileset.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromCurrentTileset.cs @@ -18,11 +18,13 @@ namespace OpenRA.Mods.Common.Traits [Desc("Loads the palette specified in the tileset definition")] class PaletteFromCurrentTilesetInfo : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("internal palette name")] public readonly string Name = null; + [Desc("Map listed indices to shadow. Ignores previous color.")] public readonly int[] ShadowIndex = { }; + public readonly bool AllowModifiers = true; public object Create(ActorInitializer init) { return new PaletteFromCurrentTileset(init.World, this); } diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs index 49b62b1e3e..1cb85da799 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromFile.cs @@ -17,16 +17,20 @@ namespace OpenRA.Mods.Common.Traits { class PaletteFromFileInfo : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("internal palette name")] public readonly string Name = null; + [Desc("If defined, load the palette only for this tileset.")] public readonly string Tileset = null; + [FieldLoader.Require] [Desc("filename to load")] public readonly string Filename = null; + [Desc("Map listed indices to shadow. Ignores previous color.")] public readonly int[] ShadowIndex = { }; + public readonly bool AllowModifiers = true; public object Create(ActorInitializer init) { return new PaletteFromFile(init.World, this); } diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromPaletteWithAlpha.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromPaletteWithAlpha.cs index 96fc2b484a..a7e96b2998 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromPaletteWithAlpha.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromPaletteWithAlpha.cs @@ -19,11 +19,11 @@ namespace OpenRA.Mods.Common.Traits [Desc("Create a palette by applying alpha transparency to another palette.")] class PaletteFromPaletteWithAlphaInfo : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("Internal palette name")] public readonly string Name = null; - [FieldLoader.Require] + [FieldLoader.Require, PaletteReference] [Desc("The name of the palette to base off.")] public readonly string BasePalette = null; diff --git a/OpenRA.Mods.Common/Traits/World/PaletteFromRGBA.cs b/OpenRA.Mods.Common/Traits/World/PaletteFromRGBA.cs index 18afeb6fc3..ad979eb87c 100644 --- a/OpenRA.Mods.Common/Traits/World/PaletteFromRGBA.cs +++ b/OpenRA.Mods.Common/Traits/World/PaletteFromRGBA.cs @@ -18,19 +18,25 @@ namespace OpenRA.Mods.Common.Traits [Desc("Creates a single color palette without any base palette file.")] class PaletteFromRGBAInfo : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("internal palette name")] public readonly string Name = null; + [Desc("If defined, load the palette only for this tileset.")] public readonly string Tileset = null; + [Desc("red color component")] public readonly int R = 0; + [Desc("green color component")] public readonly int G = 0; + [Desc("blue color component")] public readonly int B = 0; + [Desc("alpha channel (transparency)")] public readonly int A = 255; + public readonly bool AllowModifiers = true; public object Create(ActorInitializer init) { return new PaletteFromRGBA(init.World, this); } diff --git a/OpenRA.Mods.Common/Traits/World/PlayerPaletteFromCurrentTileset.cs b/OpenRA.Mods.Common/Traits/World/PlayerPaletteFromCurrentTileset.cs index b55b7b6cd1..e71b07b4ce 100644 --- a/OpenRA.Mods.Common/Traits/World/PlayerPaletteFromCurrentTileset.cs +++ b/OpenRA.Mods.Common/Traits/World/PlayerPaletteFromCurrentTileset.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits { class PlayerPaletteFromCurrentTilesetInfo : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("internal palette name")] public readonly string Name = null; [Desc("Map listed indices to shadow.")] diff --git a/OpenRA.Mods.Common/Traits/World/ShroudPalette.cs b/OpenRA.Mods.Common/Traits/World/ShroudPalette.cs index 98810c6be1..4f1fbd2dfb 100644 --- a/OpenRA.Mods.Common/Traits/World/ShroudPalette.cs +++ b/OpenRA.Mods.Common/Traits/World/ShroudPalette.cs @@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Traits class ShroudPaletteInfo : ITraitInfo { [Desc("Internal palette name")] + [FieldLoader.Require, PaletteDefinition] public readonly string Name = "shroud"; [Desc("Palette type")] diff --git a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs index c5169ebe7b..4fe359c186 100644 --- a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs @@ -26,8 +26,8 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] ShroudVariants = new[] { "shroud" }; public readonly string[] FogVariants = new[] { "fog" }; - public readonly string ShroudPalette = "shroud"; - public readonly string FogPalette = "fog"; + [PaletteReference] public readonly string ShroudPalette = "shroud"; + [PaletteReference] public readonly string FogPalette = "fog"; [Desc("Bitfield of shroud directions for each frame. Lower four bits are", "corners clockwise from TL; upper four are edges clockwise from top")] diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index 1dacf21c94..fb82c9e082 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -31,9 +31,9 @@ namespace OpenRA.Mods.Common.Traits public readonly string SmokeType = "smoke_m"; [SequenceReference("SmokeType")] public readonly string SmokeSequence = "idle"; - public readonly string SmokePalette = "effect"; + [PaletteReference] public readonly string SmokePalette = "effect"; - public readonly string Palette = "terrain"; + [PaletteReference] public readonly string Palette = "terrain"; public object Create(ActorInitializer init) { return new SmudgeLayer(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/World/VoxelNormalsPalette.cs b/OpenRA.Mods.Common/Traits/World/VoxelNormalsPalette.cs index e5afaf9fe6..3d0ea27625 100644 --- a/OpenRA.Mods.Common/Traits/World/VoxelNormalsPalette.cs +++ b/OpenRA.Mods.Common/Traits/World/VoxelNormalsPalette.cs @@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Traits { public class VoxelNormalsPaletteInfo : ITraitInfo { + [PaletteDefinition] public readonly string Name = "normals"; [Desc("Can be TiberianSun or RedAlert2")] diff --git a/OpenRA.Mods.D2k/Traits/Render/WithAttackOverlay.cs b/OpenRA.Mods.D2k/Traits/Render/WithAttackOverlay.cs index dea8aa6c38..923ded4c1b 100644 --- a/OpenRA.Mods.D2k/Traits/Render/WithAttackOverlay.cs +++ b/OpenRA.Mods.D2k/Traits/Render/WithAttackOverlay.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.D2k.Traits [SequenceReference] public readonly string Sequence = null; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; diff --git a/OpenRA.Mods.D2k/Traits/Render/WithCrumbleOverlay.cs b/OpenRA.Mods.D2k/Traits/Render/WithCrumbleOverlay.cs index dcdb7c914a..7597967c7c 100644 --- a/OpenRA.Mods.D2k/Traits/Render/WithCrumbleOverlay.cs +++ b/OpenRA.Mods.D2k/Traits/Render/WithCrumbleOverlay.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.D2k.Traits [SequenceReference] public readonly string Sequence = "crumble-overlay"; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; diff --git a/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs b/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs index b150eff70a..48cc33babd 100644 --- a/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs +++ b/OpenRA.Mods.D2k/Traits/Render/WithDeliveryOverlay.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.D2k.Traits public readonly WVec Offset = WVec.Zero; [Desc("Custom palette name")] - public readonly string Palette = null; + [PaletteReference] public readonly string Palette = null; [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; diff --git a/OpenRA.Mods.D2k/Traits/World/FogPaletteFromR8.cs b/OpenRA.Mods.D2k/Traits/World/FogPaletteFromR8.cs index bbf61dfd62..91d7e19c2a 100644 --- a/OpenRA.Mods.D2k/Traits/World/FogPaletteFromR8.cs +++ b/OpenRA.Mods.D2k/Traits/World/FogPaletteFromR8.cs @@ -19,14 +19,17 @@ namespace OpenRA.Mods.D2k.Traits { class FogPaletteFromR8Info : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("Internal palette name")] public readonly string Name = null; + [FieldLoader.Require] [Desc("Filename to load")] public readonly string Filename = null; + [Desc("Palette byte offset")] public readonly long Offset = 0; + public readonly bool AllowModifiers = true; public readonly bool InvertColor = false; diff --git a/OpenRA.Mods.D2k/Traits/World/PaletteFromR8.cs b/OpenRA.Mods.D2k/Traits/World/PaletteFromR8.cs index de390ef405..bb757ee323 100644 --- a/OpenRA.Mods.D2k/Traits/World/PaletteFromR8.cs +++ b/OpenRA.Mods.D2k/Traits/World/PaletteFromR8.cs @@ -19,14 +19,17 @@ namespace OpenRA.Mods.D2k.Traits { class PaletteFromR8Info : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("Internal palette name")] public readonly string Name = null; + [FieldLoader.Require] [Desc("Filename to load")] public readonly string Filename = null; + [Desc("Palette byte offset")] public readonly long Offset = 0; + public readonly bool AllowModifiers = true; public readonly bool InvertColor = false; diff --git a/OpenRA.Mods.D2k/Traits/World/PaletteFromScaledPalette.cs b/OpenRA.Mods.D2k/Traits/World/PaletteFromScaledPalette.cs index 976555843e..1a27f58e4e 100644 --- a/OpenRA.Mods.D2k/Traits/World/PaletteFromScaledPalette.cs +++ b/OpenRA.Mods.D2k/Traits/World/PaletteFromScaledPalette.cs @@ -19,11 +19,11 @@ namespace OpenRA.Mods.D2k.Traits [Desc("Create a palette by applying a scale and offset to the colors in another palette.")] class PaletteFromScaledPaletteInfo : ITraitInfo { - [FieldLoader.Require] + [FieldLoader.Require, PaletteDefinition] [Desc("Internal palette name")] public readonly string Name = null; - [FieldLoader.Require] + [FieldLoader.Require, PaletteReference] [Desc("The name of the palette to base off.")] public readonly string BasePalette = null; diff --git a/OpenRA.Mods.RA/Effects/TeslaZap.cs b/OpenRA.Mods.RA/Effects/TeslaZap.cs index e65dfd6b9d..4784752e3a 100644 --- a/OpenRA.Mods.RA/Effects/TeslaZap.cs +++ b/OpenRA.Mods.RA/Effects/TeslaZap.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Effects [SequenceReference("Image")] public readonly string BrightSequence = "bright"; [SequenceReference("Image")] public readonly string DimSequence = "dim"; - public readonly string Palette = "effect"; + [PaletteReference] public readonly string Palette = "effect"; public readonly int BrightZaps = 1; public readonly int DimZaps = 2; diff --git a/OpenRA.Mods.TS/Traits/World/TSShroudPalette.cs b/OpenRA.Mods.TS/Traits/World/TSShroudPalette.cs index 77bc73060a..82fe8cd0e2 100644 --- a/OpenRA.Mods.TS/Traits/World/TSShroudPalette.cs +++ b/OpenRA.Mods.TS/Traits/World/TSShroudPalette.cs @@ -20,6 +20,7 @@ namespace OpenRA.Mods.TS.Traits [Desc("Adds the hard-coded shroud palette to the game")] class TSShroudPaletteInfo : ITraitInfo { + [FieldLoader.Require, PaletteDefinition] [Desc("Internal palette name")] public readonly string Name = "shroud"; diff --git a/mods/cnc/rules/palettes.yaml b/mods/cnc/rules/palettes.yaml index ad0081679a..e789ef80f7 100644 --- a/mods/cnc/rules/palettes.yaml +++ b/mods/cnc/rules/palettes.yaml @@ -54,6 +54,7 @@ B: 0 A: 180 ShroudPalette@shroud: + Name: shroud Type: Shroud ShroudPalette@fog: Name: fog diff --git a/mods/ra/rules/palettes.yaml b/mods/ra/rules/palettes.yaml index 70eb65a5f2..16878f3e3c 100644 --- a/mods/ra/rules/palettes.yaml +++ b/mods/ra/rules/palettes.yaml @@ -56,6 +56,7 @@ B: 0 A: 180 ShroudPalette@shroud: + Name: shroud Type: Shroud ShroudPalette@fog: Name: fog diff --git a/mods/ts/rules/palettes.yaml b/mods/ts/rules/palettes.yaml index 0219f4429f..50ca0c6601 100644 --- a/mods/ts/rules/palettes.yaml +++ b/mods/ts/rules/palettes.yaml @@ -80,6 +80,7 @@ BasePalette: ra Alpha: 0.75 TSShroudPalette@shroud: + Name: shroud Type: Shroud VoxelNormalsPalette@normals: Name: normals From 322358ff3d9cba12338efda3dd5c51590061318e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 17 Aug 2015 21:36:55 +0200 Subject: [PATCH 2/2] also check shroud sequences --- OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs index 4fe359c186..01cc2224ff 100644 --- a/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/ShroudRenderer.cs @@ -23,8 +23,8 @@ namespace OpenRA.Mods.Common.Traits public class ShroudRendererInfo : ITraitInfo { public readonly string Sequence = "shroud"; - public readonly string[] ShroudVariants = new[] { "shroud" }; - public readonly string[] FogVariants = new[] { "fog" }; + [SequenceReference("Sequence")] public readonly string[] ShroudVariants = new[] { "shroud" }; + [SequenceReference("Sequence")] public readonly string[] FogVariants = new[] { "fog" }; [PaletteReference] public readonly string ShroudPalette = "shroud"; [PaletteReference] public readonly string FogPalette = "fog"; @@ -37,11 +37,11 @@ namespace OpenRA.Mods.Common.Traits public readonly bool UseExtendedIndex = false; [Desc("Override for source art that doesn't define a fully shrouded tile")] - public readonly string OverrideFullShroud = null; + [SequenceReference("Sequence")] public readonly string OverrideFullShroud = null; public readonly int OverrideShroudIndex = 15; [Desc("Override for source art that doesn't define a fully fogged tile")] - public readonly string OverrideFullFog = null; + [SequenceReference("Sequence")] public readonly string OverrideFullFog = null; public readonly int OverrideFogIndex = 15; public readonly BlendMode ShroudBlend = BlendMode.Alpha;