update developer commentary

for weapon traits, crates and palettes
clarify that you don't need to update the wiki page manually
This commit is contained in:
Matthias Mailänder
2013-03-27 08:22:07 +01:00
parent fc1a3f9916
commit a682670b97
22 changed files with 63 additions and 17 deletions

View File

@@ -20,8 +20,11 @@ namespace OpenRA.Traits
{ {
[Desc("Defaults to the actor name.")] [Desc("Defaults to the actor name.")]
public readonly string Image = null; public readonly string Image = null;
[Desc("custom palette name")]
public readonly string Palette = null; public readonly string Palette = null;
[Desc("custom PlayerColorPalette: BaseName")]
public readonly string PlayerPalette = "player"; public readonly string PlayerPalette = "player";
[Desc("Change the sprite image size.")]
public readonly float Scale = 1f; public readonly float Scale = 1f;
public virtual object Create(ActorInitializer init) { return new RenderSimple(init.self); } public virtual object Create(ActorInitializer init) { return new RenderSimple(init.self); }

View File

@@ -8,15 +8,12 @@
*/ */
#endregion #endregion
using OpenRA.FileFormats;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
public class FogInfo : TraitInfo<Fog> [Desc("This tag trait will enable fog of war in ShroudRenderer. Don't forget about HiddenUnderFog and FrozenUnderFog.")]
{ public class FogInfo : TraitInfo<Fog> { }
/*
* This tag trait will enable fog of war in ShroudRenderer.
* Don't forget about HiddenUnderFog and FrozenUnderFog.
*/
}
public class Fog { } public class Fog { }
} }

View File

@@ -13,10 +13,14 @@ using OpenRA.Graphics;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
[Desc("Add this to the Player actor definition.")]
public class PlayerColorPaletteInfo : ITraitInfo public class PlayerColorPaletteInfo : ITraitInfo
{ {
[Desc("The Name of the palette to base off.")]
public readonly string BasePalette = null; public readonly string BasePalette = null;
[Desc("The prefix for the resulting player palettes")]
public readonly string BaseName = "player"; public readonly string BaseName = "player";
[Desc("Remap these indices to player colors.")]
public readonly int[] RemapIndex = {}; public readonly int[] RemapIndex = {};
public readonly bool AllowModifiers = true; public readonly bool AllowModifiers = true;

View File

@@ -25,13 +25,16 @@ namespace OpenRA.Mods.RA
public int Facing; // deviation from turret facing 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<AttackBaseInfo> public class ArmamentInfo : ITraitInfo, Requires<AttackBaseInfo>
{ {
[WeaponReference] [WeaponReference]
[Desc("Has to be defined here and in weapons.yaml.")] [Desc("Has to be defined here and in weapons.yaml.")]
public readonly string Weapon = null; public readonly string Weapon = null;
public readonly string Turret = "primary"; public readonly string Turret = "primary";
[Desc("Move the turret backwards when firing.")]
public readonly int Recoil = 0; public readonly int Recoil = 0;
[Desc("Time (in frames) until the weapon can fire again.")]
public readonly int FireDelay = 0; public readonly int FireDelay = 0;
public readonly float RecoilRecovery = 0.2f; public readonly float RecoilRecovery = 0.2f;

View File

@@ -21,7 +21,9 @@ namespace OpenRA.Mods.RA
{ {
public readonly bool CanAttackGround = true; public readonly bool CanAttackGround = true;
[Desc("Ticks to wait until next AutoTarget: attempt.")]
public readonly int MinimumScanTimeInterval = 30; public readonly int MinimumScanTimeInterval = 30;
[Desc("Ticks to wait until next AutoTarget: attempt.")]
public readonly int MaximumScanTimeInterval = 60; public readonly int MaximumScanTimeInterval = 60;
public abstract object Create(ActorInitializer init); public abstract object Create(ActorInitializer init);

View File

@@ -9,10 +9,12 @@
#endregion #endregion
using System; using System;
using OpenRA.FileFormats;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Unit got to face the target")]
public class AttackFrontalInfo : AttackBaseInfo public class AttackFrontalInfo : AttackBaseInfo
{ {
public readonly int FacingTolerance = 1; public readonly int FacingTolerance = 1;

View File

@@ -14,7 +14,7 @@ using OpenRA.FileFormats;
namespace OpenRA.Mods.RA 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", "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)")] "heal process then. It also won't work with buildings (use RepairsUnits: for them)")]
public class AttackMedicInfo : AttackFrontalInfo public class AttackMedicInfo : AttackFrontalInfo

View File

@@ -9,13 +9,15 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
public class ConquestVictoryConditionsInfo : ITraitInfo public class ConquestVictoryConditionsInfo : ITraitInfo
{ {
public int NotificationDelay = 1500; // Milliseconds [Desc("Milliseconds")]
public int NotificationDelay = 1500;
public object Create(ActorInitializer init) { return new ConquestVictoryConditions(this); } 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<MustBeDestroyed> { } public class MustBeDestroyedInfo : TraitInfo<MustBeDestroyed> { }
public class MustBeDestroyed { } public class MustBeDestroyed { }
// Provides game mode information for players/observers [Desc("Provides game mode information for players/observers. Goes on WorldActor - observers don't have a player it can live on.")]
// Goes on WorldActor - observers don't have a player it can live on
public class ConquestObjectivesPanelInfo : ITraitInfo public class ConquestObjectivesPanelInfo : ITraitInfo
{ {
public string ObjectivesPanel = null; public string ObjectivesPanel = null;

View File

@@ -10,16 +10,21 @@
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.FileFormats;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
public class CrateActionInfo : ITraitInfo public class CrateActionInfo : ITraitInfo
{ {
[Desc("Chance of getting this crate, assuming the collector is compatible.")]
public int SelectionShares = 10; public int SelectionShares = 10;
[Desc("An animation defined in sequence yaml(s) to draw.")]
public string Effect = null; public string Effect = null;
[Desc("Audio clip to play when the crate is collected.")]
public string Notification = null; public string Notification = null;
[ActorReference] [ActorReference]
[Desc("Comma-separated list of actor types the crate action should not apply to.")]
public string[] ExcludedActorTypes = { }; public string[] ExcludedActorTypes = { };
public virtual object Create(ActorInitializer init) { return new CrateAction(init.self, this); } public virtual object Create(ActorInitializer init) { return new CrateAction(init.self, this); }

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.FileFormats;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
@@ -22,7 +23,8 @@ namespace OpenRA.Mods.RA.Effects
{ {
public readonly int Speed = 1; public readonly int Speed = 1;
public readonly string Trail = null; 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 string Image = null;
public readonly bool High = false; public readonly bool High = false;
public readonly int RangeLimit = 0; public readonly int RangeLimit = 0;

View File

@@ -13,10 +13,12 @@ using System.Drawing;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.FileFormats;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.RA.Effects
{ {
[Desc("Not a sprite, but an engine effect.")]
class LaserZapInfo : IProjectileInfo class LaserZapInfo : IProjectileInfo
{ {
public readonly int BeamRadius = 1; public readonly int BeamRadius = 1;

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA.Effects
public readonly string Image = null; public readonly string Image = null;
[Desc("Rate of Turning")] [Desc("Rate of Turning")]
public readonly int ROT = 5; public readonly int ROT = 5;
[Desc("Explode when following the target longer than this.")]
public readonly int RangeLimit = 0; public readonly int RangeLimit = 0;
public readonly bool TurboBoost = false; public readonly bool TurboBoost = false;
public readonly int TrailInterval = 2; public readonly int TrailInterval = 2;

View File

@@ -15,8 +15,10 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Adds the hard-coded fog palette to the game")]
class FogPaletteInfo : ITraitInfo class FogPaletteInfo : ITraitInfo
{ {
[Desc("internal palette name")]
public readonly string Name = "fog"; public readonly string Name = "fog";
public object Create(ActorInitializer init) { return new FogPalette(this); } public object Create(ActorInitializer init) { return new FogPalette(this); }
} }

View File

@@ -15,6 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Palette effect used for blinking \"animations\" on actors.")]
class LightPaletteRotatorInfo : ITraitInfo class LightPaletteRotatorInfo : ITraitInfo
{ {
public readonly string[] ExcludePalettes = {}; public readonly string[] ExcludePalettes = {};

View File

@@ -13,9 +13,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Loads the palette specified in the tileset definition")]
class PaletteFromCurrentTilesetInfo : ITraitInfo class PaletteFromCurrentTilesetInfo : ITraitInfo
{ {
[Desc("internal palette name")]
public readonly string Name = null; public readonly string Name = null;
[Desc("Map listed indices to shadow. Ignores previous color.")]
public readonly int[] ShadowIndex = { }; public readonly int[] ShadowIndex = { };
public readonly bool AllowModifiers = true; public readonly bool AllowModifiers = true;

View File

@@ -16,9 +16,13 @@ namespace OpenRA.Mods.RA
{ {
class PaletteFromFileInfo : ITraitInfo class PaletteFromFileInfo : ITraitInfo
{ {
[Desc("internal palette name")]
public readonly string Name = null; public readonly string Name = null;
[Desc("If defined, load the palette only for this tileset.")]
public readonly string Tileset = null; public readonly string Tileset = null;
[Desc("filename to load")]
public readonly string Filename = null; public readonly string Filename = null;
[Desc("Map listed indices to shadow. Ignores previous color.")]
public readonly int[] ShadowIndex = { }; public readonly int[] ShadowIndex = { };
public readonly bool AllowModifiers = true; public readonly bool AllowModifiers = true;

View File

@@ -15,13 +15,20 @@ using OpenRA.Graphics;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Creates a single color palette without any base palette file.")]
class PaletteFromRGBAInfo : ITraitInfo class PaletteFromRGBAInfo : ITraitInfo
{ {
[Desc("internal palette name")]
public readonly string Name = null; public readonly string Name = null;
[Desc("If defined, load the palette only for this tileset.")]
public readonly string Tileset = null; public readonly string Tileset = null;
[Desc("red color component")]
public readonly int R = 0; public readonly int R = 0;
[Desc("green color component")]
public readonly int G = 0; public readonly int G = 0;
[Desc("blue color component")]
public readonly int B = 0; public readonly int B = 0;
[Desc("alpha channel (transparency)")]
public readonly int A = 255; public readonly int A = 255;
public readonly bool AllowModifiers = true; public readonly bool AllowModifiers = true;

View File

@@ -15,8 +15,11 @@ namespace OpenRA.Mods.RA
{ {
class PlayerPaletteFromCurrentTilesetInfo : ITraitInfo class PlayerPaletteFromCurrentTilesetInfo : ITraitInfo
{ {
[Desc("internal palette name")]
public readonly string Name = null; public readonly string Name = null;
[Desc("Map listed indices to shadow.")]
public readonly int[] ShadowIndex = { }; public readonly int[] ShadowIndex = { };
[Desc("Apply palette rotatotors or not.")]
public readonly bool AllowModifiers = true; public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new PlayerPaletteFromCurrentTileset(init.world, this); } public object Create(ActorInitializer init) { return new PlayerPaletteFromCurrentTileset(init.world, this); }

View File

@@ -15,8 +15,10 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Adds the hard-coded shroud palette to the game")]
class ShroudPaletteInfo : ITraitInfo class ShroudPaletteInfo : ITraitInfo
{ {
[Desc("internal palette name")]
public readonly string Name = "shroud"; public readonly string Name = "shroud";
public object Create(ActorInitializer init) { return new ShroudPalette(this); } public object Create(ActorInitializer init) { return new ShroudPalette(this); }
} }

View File

@@ -10,6 +10,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Mods.RA.Render; using OpenRA.Mods.RA.Render;
using OpenRA.FileFormats;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -17,6 +18,7 @@ namespace OpenRA.Mods.RA
public class TurretedInfo : ITraitInfo, UsesInit<TurretFacingInit> public class TurretedInfo : ITraitInfo, UsesInit<TurretFacingInit>
{ {
public readonly string Turret = "primary"; public readonly string Turret = "primary";
[Desc("Rate of Turning")]
public readonly int ROT = 255; public readonly int ROT = 255;
public readonly int InitialFacing = 128; public readonly int InitialFacing = 128;
public readonly int[] Offset = {0,0}; public readonly int[] Offset = {0,0};

View File

@@ -15,6 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
[Desc("Palette effect used for sprinkle \"animations\" on terrain tiles.")]
class WaterPaletteRotationInfo : ITraitInfo class WaterPaletteRotationInfo : ITraitInfo
{ {
public readonly string[] ExcludePalettes = {}; public readonly string[] ExcludePalettes = {};

View File

@@ -493,10 +493,10 @@ namespace OpenRA.Utility
Console.WriteLine("## Documentation"); Console.WriteLine("## Documentation");
Console.WriteLine( 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}. " + "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. " + "Type `make docs` to create a new one. A copy of this is uploaded to https://github.com/OpenRA/OpenRA/wiki/Traits " +
"A copy of this is compiled to HTML and shipped with every release during the automated packaging process.", DateTime.Now); "as well as compiled to HTML and shipped with every release during the automated packaging process.", DateTime.Now);
Console.WriteLine("```yaml"); Console.WriteLine("```yaml");
Console.WriteLine(); Console.WriteLine();