From a682670b975ebe920a62daf3ab349d5ad9523d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 27 Mar 2013 08:22:07 +0100 Subject: [PATCH] update developer commentary for weapon traits, crates and palettes clarify that you don't need to update the wiki page manually --- OpenRA.Game/Traits/Render/RenderSimple.cs | 3 +++ OpenRA.Game/Traits/World/Fog.cs | 11 ++++------- OpenRA.Game/Traits/World/PlayerColorPalette.cs | 4 ++++ OpenRA.Mods.RA/Armament.cs | 3 +++ OpenRA.Mods.RA/Attack/AttackBase.cs | 2 ++ OpenRA.Mods.RA/Attack/AttackFrontal.cs | 2 ++ OpenRA.Mods.RA/Attack/AttackMedic.cs | 2 +- OpenRA.Mods.RA/ConquestVictoryConditions.cs | 10 +++++----- OpenRA.Mods.RA/CrateAction.cs | 5 +++++ OpenRA.Mods.RA/Effects/Bullet.cs | 4 +++- OpenRA.Mods.RA/Effects/LaserZap.cs | 2 ++ OpenRA.Mods.RA/Effects/Missile.cs | 1 + OpenRA.Mods.RA/FogPalette.cs | 2 ++ OpenRA.Mods.RA/LightPaletteRotator.cs | 1 + OpenRA.Mods.RA/PaletteFromCurrentTileset.cs | 3 +++ OpenRA.Mods.RA/PaletteFromFile.cs | 4 ++++ OpenRA.Mods.RA/PaletteFromRGBA.cs | 7 +++++++ OpenRA.Mods.RA/PlayerPaletteFromCurrentTileset.cs | 3 +++ OpenRA.Mods.RA/ShroudPalette.cs | 2 ++ OpenRA.Mods.RA/Turreted.cs | 2 ++ OpenRA.Mods.RA/WaterPaletteRotation.cs | 1 + OpenRA.Utility/Command.cs | 6 +++--- 22 files changed, 63 insertions(+), 17 deletions(-) diff --git a/OpenRA.Game/Traits/Render/RenderSimple.cs b/OpenRA.Game/Traits/Render/RenderSimple.cs index eac7bdaa82..d7927c6131 100755 --- a/OpenRA.Game/Traits/Render/RenderSimple.cs +++ b/OpenRA.Game/Traits/Render/RenderSimple.cs @@ -20,8 +20,11 @@ namespace OpenRA.Traits { [Desc("Defaults to the actor name.")] public readonly string Image = null; + [Desc("custom palette name")] public readonly string Palette = null; + [Desc("custom PlayerColorPalette: BaseName")] public readonly string PlayerPalette = "player"; + [Desc("Change the sprite image size.")] public readonly float Scale = 1f; public virtual object Create(ActorInitializer init) { return new RenderSimple(init.self); } diff --git a/OpenRA.Game/Traits/World/Fog.cs b/OpenRA.Game/Traits/World/Fog.cs index 0cad7f43df..2d6d22bf40 100644 --- a/OpenRA.Game/Traits/World/Fog.cs +++ b/OpenRA.Game/Traits/World/Fog.cs @@ -8,15 +8,12 @@ */ #endregion +using OpenRA.FileFormats; + namespace OpenRA.Traits { - public class FogInfo : TraitInfo - { - /* - * This tag trait will enable fog of war in ShroudRenderer. - * Don't forget about HiddenUnderFog and FrozenUnderFog. - */ - } + [Desc("This tag trait will enable fog of war in ShroudRenderer. Don't forget about HiddenUnderFog and FrozenUnderFog.")] + public class FogInfo : TraitInfo { } public class Fog { } } \ No newline at end of file diff --git a/OpenRA.Game/Traits/World/PlayerColorPalette.cs b/OpenRA.Game/Traits/World/PlayerColorPalette.cs index 0b35c05ddc..6739068d2f 100644 --- a/OpenRA.Game/Traits/World/PlayerColorPalette.cs +++ b/OpenRA.Game/Traits/World/PlayerColorPalette.cs @@ -13,10 +13,14 @@ using OpenRA.Graphics; namespace OpenRA.Traits { + [Desc("Add this to the Player actor definition.")] public class PlayerColorPaletteInfo : ITraitInfo { + [Desc("The Name of the palette to base off.")] 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 = {}; public readonly bool AllowModifiers = true; diff --git a/OpenRA.Mods.RA/Armament.cs b/OpenRA.Mods.RA/Armament.cs index a6d9f168df..04bdf153e6 100755 --- a/OpenRA.Mods.RA/Armament.cs +++ b/OpenRA.Mods.RA/Armament.cs @@ -25,13 +25,16 @@ namespace OpenRA.Mods.RA public int Facing; // deviation from turret facing } + [Desc("Allows you to attach weapons to the unit (use @IdentifierSuffix for > 1)")] public class ArmamentInfo : ITraitInfo, Requires { [WeaponReference] [Desc("Has to be defined here and in weapons.yaml.")] public readonly string Weapon = null; public readonly string Turret = "primary"; + [Desc("Move the turret backwards when firing.")] public readonly int Recoil = 0; + [Desc("Time (in frames) until the weapon can fire again.")] public readonly int FireDelay = 0; public readonly float RecoilRecovery = 0.2f; diff --git a/OpenRA.Mods.RA/Attack/AttackBase.cs b/OpenRA.Mods.RA/Attack/AttackBase.cs index 2b47bd84ea..c52b5e0a59 100644 --- a/OpenRA.Mods.RA/Attack/AttackBase.cs +++ b/OpenRA.Mods.RA/Attack/AttackBase.cs @@ -21,7 +21,9 @@ namespace OpenRA.Mods.RA { public readonly bool CanAttackGround = true; + [Desc("Ticks to wait until next AutoTarget: attempt.")] public readonly int MinimumScanTimeInterval = 30; + [Desc("Ticks to wait until next AutoTarget: attempt.")] public readonly int MaximumScanTimeInterval = 60; public abstract object Create(ActorInitializer init); diff --git a/OpenRA.Mods.RA/Attack/AttackFrontal.cs b/OpenRA.Mods.RA/Attack/AttackFrontal.cs index dfcd4bb2e5..2f52e23625 100644 --- a/OpenRA.Mods.RA/Attack/AttackFrontal.cs +++ b/OpenRA.Mods.RA/Attack/AttackFrontal.cs @@ -9,10 +9,12 @@ #endregion using System; +using OpenRA.FileFormats; using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Unit got to face the target")] public class AttackFrontalInfo : AttackBaseInfo { public readonly int FacingTolerance = 1; diff --git a/OpenRA.Mods.RA/Attack/AttackMedic.cs b/OpenRA.Mods.RA/Attack/AttackMedic.cs index e8399eaaf2..ec705f25ba 100644 --- a/OpenRA.Mods.RA/Attack/AttackMedic.cs +++ b/OpenRA.Mods.RA/Attack/AttackMedic.cs @@ -14,7 +14,7 @@ using OpenRA.FileFormats; namespace OpenRA.Mods.RA { - [Desc("Give the unit a \"heal-weapon\".", + [Desc("Give the unit a \"heal-weapon\" that attacks friendly targets if they are damaged.", "It conflicts with any other weapon or Attack*: trait because it will hurt friendlies during the", "heal process then. It also won't work with buildings (use RepairsUnits: for them)")] public class AttackMedicInfo : AttackFrontalInfo diff --git a/OpenRA.Mods.RA/ConquestVictoryConditions.cs b/OpenRA.Mods.RA/ConquestVictoryConditions.cs index 32750b10ed..b868238900 100644 --- a/OpenRA.Mods.RA/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.RA/ConquestVictoryConditions.cs @@ -9,13 +9,15 @@ #endregion using System.Linq; +using OpenRA.FileFormats; using OpenRA.Traits; namespace OpenRA.Mods.RA { public class ConquestVictoryConditionsInfo : ITraitInfo { - public int NotificationDelay = 1500; // Milliseconds + [Desc("Milliseconds")] + public int NotificationDelay = 1500; public object Create(ActorInitializer init) { return new ConquestVictoryConditions(this); } } @@ -85,13 +87,11 @@ namespace OpenRA.Mods.RA } } - /* tag trait for things that must be destroyed for a short game to end */ - + [Desc("Tag trait for things that must be destroyed for a short game to end.")] public class MustBeDestroyedInfo : TraitInfo { } public class MustBeDestroyed { } - // Provides game mode information for players/observers - // Goes on WorldActor - observers don't have a player it can live on + [Desc("Provides game mode information for players/observers. Goes on WorldActor - observers don't have a player it can live on.")] public class ConquestObjectivesPanelInfo : ITraitInfo { public string ObjectivesPanel = null; diff --git a/OpenRA.Mods.RA/CrateAction.cs b/OpenRA.Mods.RA/CrateAction.cs index fbd684f325..0804553051 100644 --- a/OpenRA.Mods.RA/CrateAction.cs +++ b/OpenRA.Mods.RA/CrateAction.cs @@ -10,16 +10,21 @@ using System.Linq; using OpenRA.Mods.RA.Effects; +using OpenRA.FileFormats; using OpenRA.Traits; namespace OpenRA.Mods.RA { public class CrateActionInfo : ITraitInfo { + [Desc("Chance of getting this crate, assuming the collector is compatible.")] public int SelectionShares = 10; + [Desc("An animation defined in sequence yaml(s) to draw.")] public string Effect = null; + [Desc("Audio clip to play when the crate is collected.")] public string Notification = null; [ActorReference] + [Desc("Comma-separated list of actor types the crate action should not apply to.")] public string[] ExcludedActorTypes = { }; public virtual object Create(ActorInitializer init) { return new CrateAction(init.self, this); } diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index 3677b07aef..611b43de8d 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Effects; +using OpenRA.FileFormats; using OpenRA.GameRules; using OpenRA.Graphics; using OpenRA.Traits; @@ -22,7 +23,8 @@ namespace OpenRA.Mods.RA.Effects { public readonly int Speed = 1; public readonly string Trail = null; - public readonly float Inaccuracy = 0; // pixels at maximum range + [Desc("Pixels at maximum range")] + public readonly float Inaccuracy = 0; public readonly string Image = null; public readonly bool High = false; public readonly int RangeLimit = 0; diff --git a/OpenRA.Mods.RA/Effects/LaserZap.cs b/OpenRA.Mods.RA/Effects/LaserZap.cs index de0589ebd1..f5f3b6b82d 100755 --- a/OpenRA.Mods.RA/Effects/LaserZap.cs +++ b/OpenRA.Mods.RA/Effects/LaserZap.cs @@ -13,10 +13,12 @@ using System.Drawing; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.FileFormats; using OpenRA.Traits; namespace OpenRA.Mods.RA.Effects { + [Desc("Not a sprite, but an engine effect.")] class LaserZapInfo : IProjectileInfo { public readonly int BeamRadius = 1; diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index 457230315d..9f68de481b 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA.Effects public readonly string Image = null; [Desc("Rate of Turning")] public readonly int ROT = 5; + [Desc("Explode when following the target longer than this.")] public readonly int RangeLimit = 0; public readonly bool TurboBoost = false; public readonly int TrailInterval = 2; diff --git a/OpenRA.Mods.RA/FogPalette.cs b/OpenRA.Mods.RA/FogPalette.cs index 642bb4e684..92ee39cee6 100644 --- a/OpenRA.Mods.RA/FogPalette.cs +++ b/OpenRA.Mods.RA/FogPalette.cs @@ -15,8 +15,10 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Adds the hard-coded fog palette to the game")] class FogPaletteInfo : ITraitInfo { + [Desc("internal palette name")] public readonly string Name = "fog"; public object Create(ActorInitializer init) { return new FogPalette(this); } } diff --git a/OpenRA.Mods.RA/LightPaletteRotator.cs b/OpenRA.Mods.RA/LightPaletteRotator.cs index ba32a4f8d5..f92f05c75e 100644 --- a/OpenRA.Mods.RA/LightPaletteRotator.cs +++ b/OpenRA.Mods.RA/LightPaletteRotator.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Palette effect used for blinking \"animations\" on actors.")] class LightPaletteRotatorInfo : ITraitInfo { public readonly string[] ExcludePalettes = {}; diff --git a/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs b/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs index 8c045aef07..59072acb04 100644 --- a/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs +++ b/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs @@ -13,9 +13,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Loads the palette specified in the tileset definition")] class PaletteFromCurrentTilesetInfo : ITraitInfo { + [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; diff --git a/OpenRA.Mods.RA/PaletteFromFile.cs b/OpenRA.Mods.RA/PaletteFromFile.cs index 6a60aa8d67..fc1642eda7 100644 --- a/OpenRA.Mods.RA/PaletteFromFile.cs +++ b/OpenRA.Mods.RA/PaletteFromFile.cs @@ -16,9 +16,13 @@ namespace OpenRA.Mods.RA { class PaletteFromFileInfo : ITraitInfo { + [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("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; diff --git a/OpenRA.Mods.RA/PaletteFromRGBA.cs b/OpenRA.Mods.RA/PaletteFromRGBA.cs index 4f8a33c14f..b7ead89448 100644 --- a/OpenRA.Mods.RA/PaletteFromRGBA.cs +++ b/OpenRA.Mods.RA/PaletteFromRGBA.cs @@ -15,13 +15,20 @@ using OpenRA.Graphics; namespace OpenRA.Mods.RA { + [Desc("Creates a single color palette without any base palette file.")] class PaletteFromRGBAInfo : ITraitInfo { + [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; diff --git a/OpenRA.Mods.RA/PlayerPaletteFromCurrentTileset.cs b/OpenRA.Mods.RA/PlayerPaletteFromCurrentTileset.cs index a28fac7522..33d62fd07a 100644 --- a/OpenRA.Mods.RA/PlayerPaletteFromCurrentTileset.cs +++ b/OpenRA.Mods.RA/PlayerPaletteFromCurrentTileset.cs @@ -15,8 +15,11 @@ namespace OpenRA.Mods.RA { class PlayerPaletteFromCurrentTilesetInfo : ITraitInfo { + [Desc("internal palette name")] public readonly string Name = null; + [Desc("Map listed indices to shadow.")] public readonly int[] ShadowIndex = { }; + [Desc("Apply palette rotatotors or not.")] public readonly bool AllowModifiers = true; public object Create(ActorInitializer init) { return new PlayerPaletteFromCurrentTileset(init.world, this); } diff --git a/OpenRA.Mods.RA/ShroudPalette.cs b/OpenRA.Mods.RA/ShroudPalette.cs index 5437a1987f..3fed81a6eb 100644 --- a/OpenRA.Mods.RA/ShroudPalette.cs +++ b/OpenRA.Mods.RA/ShroudPalette.cs @@ -15,8 +15,10 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Adds the hard-coded shroud palette to the game")] class ShroudPaletteInfo : ITraitInfo { + [Desc("internal palette name")] public readonly string Name = "shroud"; public object Create(ActorInitializer init) { return new ShroudPalette(this); } } diff --git a/OpenRA.Mods.RA/Turreted.cs b/OpenRA.Mods.RA/Turreted.cs index f9c305f755..8f910df26f 100755 --- a/OpenRA.Mods.RA/Turreted.cs +++ b/OpenRA.Mods.RA/Turreted.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using OpenRA.Mods.RA.Render; +using OpenRA.FileFormats; using OpenRA.Traits; namespace OpenRA.Mods.RA @@ -17,6 +18,7 @@ namespace OpenRA.Mods.RA public class TurretedInfo : ITraitInfo, UsesInit { public readonly string Turret = "primary"; + [Desc("Rate of Turning")] public readonly int ROT = 255; public readonly int InitialFacing = 128; public readonly int[] Offset = {0,0}; diff --git a/OpenRA.Mods.RA/WaterPaletteRotation.cs b/OpenRA.Mods.RA/WaterPaletteRotation.cs index a8a24127c1..74bab088fe 100644 --- a/OpenRA.Mods.RA/WaterPaletteRotation.cs +++ b/OpenRA.Mods.RA/WaterPaletteRotation.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Palette effect used for sprinkle \"animations\" on terrain tiles.")] class WaterPaletteRotationInfo : ITraitInfo { public readonly string[] ExcludePalettes = {}; diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index b357c122c2..96097dfb75 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -493,10 +493,10 @@ namespace OpenRA.Utility Console.WriteLine("## Documentation"); Console.WriteLine( - "This documentation is aimed at modders and contributers of OpenRA. It displays all traits with default values and developer commentary. " + + "This documentation is aimed at modders and contributors of OpenRA. It displays all traits with default values and developer commentary. " + "Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been automatically generated on {0}. " + - "Type `make docs` to create a new one and put it on https://github.com/OpenRA/OpenRA/wiki/Traits afterwards. " + - "A copy of this is compiled to HTML and shipped with every release during the automated packaging process.", DateTime.Now); + "Type `make docs` to create a new one. A copy of this is uploaded to https://github.com/OpenRA/OpenRA/wiki/Traits " + + "as well as compiled to HTML and shipped with every release during the automated packaging process.", DateTime.Now); Console.WriteLine("```yaml"); Console.WriteLine();