diff --git a/OpenRA.Game/FieldSaver.cs b/OpenRA.Game/FieldSaver.cs index 53da76c6b6..9795653302 100644 --- a/OpenRA.Game/FieldSaver.cs +++ b/OpenRA.Game/FieldSaver.cs @@ -79,9 +79,12 @@ namespace OpenRA if (t.IsArray) { var elems = ((Array)v).OfType(); - return elems.JoinWith(","); + return elems.JoinWith(", "); } + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(OpenRA.Primitives.Cache<,>)) + return ""; // TODO + if (t == typeof(DateTime)) return ((DateTime)v).ToString("yyyy-MM-dd HH-mm-ss", CultureInfo.InvariantCulture); diff --git a/OpenRA.Game/Traits/DebugPauseState.cs b/OpenRA.Game/Traits/DebugPauseState.cs index d7ec732273..fc64fb1451 100644 --- a/OpenRA.Game/Traits/DebugPauseState.cs +++ b/OpenRA.Game/Traits/DebugPauseState.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -10,6 +10,7 @@ namespace OpenRA.Traits { + [Desc("Checks for pause related desyncs. Attach this to the world actor.")] public class DebugPauseStateInfo : ITraitInfo { public object Create(ActorInitializer init) { return new DebugPauseState(init.world); } diff --git a/OpenRA.Game/Traits/Player/DeveloperMode.cs b/OpenRA.Game/Traits/Player/DeveloperMode.cs index b3627627bc..7d75df19c6 100644 --- a/OpenRA.Game/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Game/Traits/Player/DeveloperMode.cs @@ -10,6 +10,7 @@ namespace OpenRA.Traits { + [Desc("Attach this to the player actor.")] public class DeveloperModeInfo : ITraitInfo { public int Cash = 20000; diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index e04ff8483b..dea1db7658 100755 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,6 +15,7 @@ using OpenRA.Graphics; namespace OpenRA.Traits { + [Desc("Required for FrozenUnderFog to work. Attach this to the player actor.")] public class FrozenActorLayerInfo : ITraitInfo { public object Create(ActorInitializer init) { return new FrozenActorLayer(init.self); } diff --git a/OpenRA.Game/Traits/ValidateOrder.cs b/OpenRA.Game/Traits/ValidateOrder.cs index 56fa58acdb..f5055ee969 100644 --- a/OpenRA.Game/Traits/ValidateOrder.cs +++ b/OpenRA.Game/Traits/ValidateOrder.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -12,6 +12,7 @@ using OpenRA.Network; namespace OpenRA.Traits { + [Desc("Used to detect exploits. Attach this to the world actor.")] public class ValidateOrderInfo : TraitInfo { } public class ValidateOrder : IValidateOrder diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index 83c692c824..0928f0e159 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,6 +15,7 @@ using System.Linq; namespace OpenRA.Traits { + [Desc("Required for shroud and fog visibility checks. Add this to the player actor.")] public class ShroudInfo : ITraitInfo { public object Create(ActorInitializer init) { return new Shroud(init.self); } diff --git a/OpenRA.Mods.D2k/D2kResourceLayer.cs b/OpenRA.Mods.D2k/D2kResourceLayer.cs index 5484ef9008..59fbc3c168 100644 --- a/OpenRA.Mods.D2k/D2kResourceLayer.cs +++ b/OpenRA.Mods.D2k/D2kResourceLayer.cs @@ -16,9 +16,9 @@ using OpenRA.Traits; namespace OpenRA.Mods.D2k { + [Desc("Used to render spice with round borders.")] public class D2kResourceLayerInfo : TraitInfo { } - [Desc("Used to render spice with round borders.")] public class D2kResourceLayer : ResourceLayer { [Flags] enum ClearSides : byte diff --git a/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs b/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs index 9565e37892..4a49cb52b5 100644 --- a/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs +++ b/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")] class ChronoshiftPaletteEffectInfo : TraitInfo { } public class ChronoshiftPaletteEffect : IPaletteModifier, ITick diff --git a/OpenRA.Mods.RA/Console/ChatCommands.cs b/OpenRA.Mods.RA/Console/ChatCommands.cs index 7539ab1857..c3b65a1958 100644 --- a/OpenRA.Mods.RA/Console/ChatCommands.cs +++ b/OpenRA.Mods.RA/Console/ChatCommands.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Enables commands triggered by typing them into the chatbox. Attach this to the world actor.")] public class ChatCommandsInfo : TraitInfo { } public class ChatCommands : INotifyChat diff --git a/OpenRA.Mods.RA/Console/DevCommands.cs b/OpenRA.Mods.RA/Console/DevCommands.cs index 53d983010a..7d0cf5ec52 100644 --- a/OpenRA.Mods.RA/Console/DevCommands.cs +++ b/OpenRA.Mods.RA/Console/DevCommands.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Enables developer cheats via the chatbox. Attach this to the world actor.")] public class DevCommandsInfo : TraitInfo { } public class DevCommands : IChatCommand, IWorldLoaded diff --git a/OpenRA.Mods.RA/Console/HelpCommand.cs b/OpenRA.Mods.RA/Console/HelpCommand.cs index 4296c6c05f..cd38f68b9f 100644 --- a/OpenRA.Mods.RA/Console/HelpCommand.cs +++ b/OpenRA.Mods.RA/Console/HelpCommand.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Shows a list of available commands in the chatbox. Attach this to the world actor.")] public class HelpCommandInfo : TraitInfo { } public class HelpCommand : IChatCommand, IWorldLoaded diff --git a/OpenRA.Mods.RA/Console/PlayerCommands.cs b/OpenRA.Mods.RA/Console/PlayerCommands.cs index fd88f94912..43ec351e73 100644 --- a/OpenRA.Mods.RA/Console/PlayerCommands.cs +++ b/OpenRA.Mods.RA/Console/PlayerCommands.cs @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Allows the player to pause or surrender the game via the chatbox. Attach this to the world actor.")] public class PlayerCommandsInfo : TraitInfo { } public class PlayerCommands : IChatCommand, IWorldLoaded diff --git a/OpenRA.Mods.RA/ContainsCrate.cs b/OpenRA.Mods.RA/ContainsCrate.cs index c71e218d4a..52d9346315 100644 --- a/OpenRA.Mods.RA/ContainsCrate.cs +++ b/OpenRA.Mods.RA/ContainsCrate.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Leave a \"crate\" actor after destruction.")] public class ContainsCrateInfo : TraitInfo { } public class ContainsCrate : INotifyKilled diff --git a/OpenRA.Mods.RA/CreateMPPlayers.cs b/OpenRA.Mods.RA/CreateMPPlayers.cs index 9b80119368..7755d0502c 100644 --- a/OpenRA.Mods.RA/CreateMPPlayers.cs +++ b/OpenRA.Mods.RA/CreateMPPlayers.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Attach this to the world actor.")] public class CreateMPPlayersInfo : TraitInfo { } public class CreateMPPlayers : ICreatePlayers @@ -72,7 +73,7 @@ namespace OpenRA.Mods.RA if (p.PlayerReference.Enemies.Contains(q.InternalName)) return Stance.Enemy; - // Hack: Map players share a ClientID with the host, so would + // HACK: Map players share a ClientID with the host, so would // otherwise take the host's team stance instead of being neutral if (p.PlayerReference.Playable && q.PlayerReference.Playable) { diff --git a/OpenRA.Mods.RA/Fake.cs b/OpenRA.Mods.RA/Fake.cs index a8b523d43e..1846e72a26 100644 --- a/OpenRA.Mods.RA/Fake.cs +++ b/OpenRA.Mods.RA/Fake.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Display a sprite tag \"fake\" when selected.")] class FakeInfo : TraitInfo { } class Fake : ITags diff --git a/OpenRA.Mods.RA/MPStartUnits.cs b/OpenRA.Mods.RA/MPStartUnits.cs index 00934a2665..d2d1f331cd 100644 --- a/OpenRA.Mods.RA/MPStartUnits.cs +++ b/OpenRA.Mods.RA/MPStartUnits.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -12,6 +12,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Used by SpawnMPUnits. Attach these to the world actor. You can have multiple variants by adding @suffixes.")] public class MPStartUnitsInfo : TraitInfo { public readonly string Class = "none"; diff --git a/OpenRA.Mods.RA/Mine.cs b/OpenRA.Mods.RA/Mine.cs index 2af8a6aa2d..89d7374db6 100644 --- a/OpenRA.Mods.RA/Mine.cs +++ b/OpenRA.Mods.RA/Mine.cs @@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA } } - /* tag trait for stuff that shouldnt trigger mines */ + [Desc("Tag trait for stuff that should not trigger mines.")] class MineImmuneInfo : TraitInfo { } class MineImmune { } } diff --git a/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs b/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs index 843407085b..56d6ba6cac 100644 --- a/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs +++ b/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("The actor stays invisible under fog of war.")] public class HiddenUnderFogInfo : TraitInfo { } public class HiddenUnderFog : IRenderModifier, IVisibilityModifier diff --git a/OpenRA.Mods.RA/NukePaletteEffect.cs b/OpenRA.Mods.RA/NukePaletteEffect.cs index b028c06757..f7819b328c 100644 --- a/OpenRA.Mods.RA/NukePaletteEffect.cs +++ b/OpenRA.Mods.RA/NukePaletteEffect.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Apply palette full screen rotations during atom bomb explosions. Add this to the world actor.")] class NukePaletteEffectInfo : TraitInfo { } public class NukePaletteEffect : IPaletteModifier, ITick diff --git a/OpenRA.Mods.RA/Player/ActorGroupProxy.cs b/OpenRA.Mods.RA/Player/ActorGroupProxy.cs index 8b86f07a04..4262526f82 100755 --- a/OpenRA.Mods.RA/Player/ActorGroupProxy.cs +++ b/OpenRA.Mods.RA/Player/ActorGroupProxy.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Part of the unfinished group-movement system. Attach this to the player actor.")] class ActorGroupProxyInfo : TraitInfo { } class ActorGroupProxy : IResolveOrder diff --git a/OpenRA.Mods.RA/Player/AllyRepair.cs b/OpenRA.Mods.RA/Player/AllyRepair.cs index b193af2089..91b8df54c4 100644 --- a/OpenRA.Mods.RA/Player/AllyRepair.cs +++ b/OpenRA.Mods.RA/Player/AllyRepair.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -12,7 +12,9 @@ using OpenRA.Mods.RA.Buildings; using OpenRA.Traits; namespace OpenRA.Mods.RA + { + [Desc("Attach this to the player actor to allow building repair by team mates.")] class AllyRepairInfo : TraitInfo { } class AllyRepair : IResolveOrder diff --git a/OpenRA.Mods.RA/Player/PlayerStatistics.cs b/OpenRA.Mods.RA/Player/PlayerStatistics.cs index 066cefe41b..863487c874 100644 --- a/OpenRA.Mods.RA/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.RA/Player/PlayerStatistics.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Attach this to the player actor to collect observer stats.")] public class PlayerStatisticsInfo : ITraitInfo { public object Create(ActorInitializer init) { return new PlayerStatistics(init.self); } @@ -108,6 +109,7 @@ namespace OpenRA.Mods.RA } } + [Desc("Attach this to a unit to update observer stats.")] public class UpdatesPlayerStatisticsInfo : TraitInfo { } public class UpdatesPlayerStatistics : INotifyKilled diff --git a/OpenRA.Mods.RA/ProvidesRadar.cs b/OpenRA.Mods.RA/ProvidesRadar.cs index f9174ee4ae..176180b359 100755 --- a/OpenRA.Mods.RA/ProvidesRadar.cs +++ b/OpenRA.Mods.RA/ProvidesRadar.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - [Desc("This actor provides radar.")] + [Desc("This actor enables the radar minimap.")] public class ProvidesRadarInfo : TraitInfo { } public class ProvidesRadar : ITick @@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA } } - [Desc("Jams radar signal.")] + [Desc("When an actor with this trait is in range of an actor with ProvidesRadar, it will temporarily disable the radar minimap for the enemy player.")] class JamsRadarInfo : TraitInfo { [Desc("Range for jamming.")] diff --git a/OpenRA.Mods.RA/RemoveImmediately.cs b/OpenRA.Mods.RA/RemoveImmediately.cs index d9bd1b6c33..35675d252d 100644 --- a/OpenRA.Mods.RA/RemoveImmediately.cs +++ b/OpenRA.Mods.RA/RemoveImmediately.cs @@ -12,6 +12,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Destroy the actor right after being added to the game world.")] public class RemoveImmediatelyInfo : TraitInfo {} public class RemoveImmediately : INotifyAddedToWorld diff --git a/OpenRA.Mods.RA/Render/RenderNameTag.cs b/OpenRA.Mods.RA/Render/RenderNameTag.cs index 1081ad20ba..bc6bb568d0 100644 --- a/OpenRA.Mods.RA/Render/RenderNameTag.cs +++ b/OpenRA.Mods.RA/Render/RenderNameTag.cs @@ -15,9 +15,13 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Displays the player name above the unit")] class RenderNameTagInfo : ITraitInfo { public readonly int MaxLength = 10; + + public readonly string Font = "TinyBold"; + public object Create(ActorInitializer init) { return new RenderNameTag(init.self, this); } } @@ -29,7 +33,7 @@ namespace OpenRA.Mods.RA.Render public RenderNameTag(Actor self, RenderNameTagInfo info) { - font = Game.Renderer.Fonts["TinyBold"]; + font = Game.Renderer.Fonts[info.Font]; color = self.Owner.Color.RGB; if (self.Owner.PlayerName.Length > info.MaxLength) diff --git a/OpenRA.Mods.RA/Render/WithVoxelBody.cs b/OpenRA.Mods.RA/Render/WithVoxelBody.cs index 7db92c7482..af28a54528 100755 --- a/OpenRA.Mods.RA/Render/WithVoxelBody.cs +++ b/OpenRA.Mods.RA/Render/WithVoxelBody.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,21 +15,24 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Also returns a default selection size that is calculated automatically from the voxel dimensions.")] public class WithVoxelBodyInfo : ITraitInfo, Requires { - public object Create(ActorInitializer init) { return new WithVoxelBody(init.self); } + public readonly string Sequence = "idle"; + + public object Create(ActorInitializer init) { return new WithVoxelBody(init.self, this); } } public class WithVoxelBody : IAutoSelectionSize { int2 size; - public WithVoxelBody(Actor self) + public WithVoxelBody(Actor self, WithVoxelBodyInfo info) { var body = self.Trait(); var rv = self.Trait(); - var voxel = VoxelProvider.GetVoxel(rv.Image, "idle"); + var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence); rv.Add(new VoxelAnimation(voxel, () => WVec.Zero, () => new[]{ body.QuantizeOrientation(self, self.Orientation) }, () => false, () => 0)); diff --git a/OpenRA.Mods.RA/Scripting/LuaScript.cs b/OpenRA.Mods.RA/Scripting/LuaScript.cs index 9ea1c2831b..1a23e62235 100644 --- a/OpenRA.Mods.RA/Scripting/LuaScript.cs +++ b/OpenRA.Mods.RA/Scripting/LuaScript.cs @@ -15,6 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Scripting { + [Desc("Part of the new Lua API.")] public class LuaScriptInfo : ITraitInfo, Requires { public readonly string[] Scripts = { }; diff --git a/OpenRA.Mods.RA/Scripting/LuaScriptContext.cs b/OpenRA.Mods.RA/Scripting/LuaScriptContext.cs index 0c301e4919..c57a982648 100644 --- a/OpenRA.Mods.RA/Scripting/LuaScriptContext.cs +++ b/OpenRA.Mods.RA/Scripting/LuaScriptContext.cs @@ -18,6 +18,7 @@ using OpenRA.Primitives; namespace OpenRA.Mods.RA.Scripting { + [Desc("Part of the legacy Lua API.")] public sealed class LuaScriptContext : IDisposable { public Lua Lua { get; private set; } diff --git a/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs b/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs index b8edf9a657..7dfdc049b6 100644 --- a/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs +++ b/OpenRA.Mods.RA/Scripting/LuaScriptEvents.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -13,6 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Scripting { + [Desc("Part of the legacy Lua API.")] public class LuaScriptEventsInfo : TraitInfo { } public class LuaScriptEvents : INotifyKilled, INotifyAddedToWorld, INotifyRemovedFromWorld, diff --git a/OpenRA.Mods.RA/Scripting/LuaScriptInterface.cs b/OpenRA.Mods.RA/Scripting/LuaScriptInterface.cs index 2e48ccfdf9..84cf7020fc 100644 --- a/OpenRA.Mods.RA/Scripting/LuaScriptInterface.cs +++ b/OpenRA.Mods.RA/Scripting/LuaScriptInterface.cs @@ -25,6 +25,7 @@ using WorldRenderer = OpenRA.Graphics.WorldRenderer; namespace OpenRA.Mods.RA.Scripting { + [Desc("Part of the legacy Lua API.")] public class LuaScriptInterfaceInfo : ITraitInfo, Requires { public readonly string[] LuaScripts = { }; diff --git a/OpenRA.Mods.RA/SpawnMPUnits.cs b/OpenRA.Mods.RA/SpawnMPUnits.cs index dafbb53a75..f97f43a318 100644 --- a/OpenRA.Mods.RA/SpawnMPUnits.cs +++ b/OpenRA.Mods.RA/SpawnMPUnits.cs @@ -17,6 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. Both are defined at MPStartUnits. Attach this to the world actor.")] public class SpawnMPUnitsInfo : TraitInfo, Requires, Requires { } public class SpawnMPUnits : IWorldLoaded @@ -37,7 +38,6 @@ namespace OpenRA.Mods.RA if (unitGroup == null) throw new InvalidOperationException("No starting units defined for country {0} with class {1}".F(p.Country.Race, spawnClass)); - // Spawn base actor at the spawnpoint if (unitGroup.BaseActor != null) { w.CreateActor(unitGroup.BaseActor.ToLowerInvariant(), new TypeDictionary @@ -51,7 +51,6 @@ namespace OpenRA.Mods.RA if (!unitGroup.SupportActors.Any()) return; - // Spawn support units in an annulus around the base actor var supportSpawnCells = w.Map.FindTilesInAnnulus(sp, unitGroup.InnerSupportRadius + 1, unitGroup.OuterSupportRadius); foreach (var s in unitGroup.SupportActors) diff --git a/OpenRA.Mods.RA/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/SupportPowers/GpsPower.cs index 6561603630..231851e421 100755 --- a/OpenRA.Mods.RA/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/GpsPower.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -16,6 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Required for GpsPower. Attach this to the player actor.")] class GpsWatcherInfo : ITraitInfo { public object Create (ActorInitializer init) { return new GpsWatcher(init.self.Owner); } diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs b/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs index ba705da377..2011c21438 100644 --- a/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -14,19 +14,27 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Display the time remaining until the super weapon attached to the actor is ready to the player and his allies.")] class SupportPowerChargeBarInfo : ITraitInfo { - public object Create(ActorInitializer init) { return new SupportPowerChargeBar(init.self); } + public readonly Color Color = Color.Magenta; + + public object Create(ActorInitializer init) { return new SupportPowerChargeBar(init.self, this); } } class SupportPowerChargeBar : ISelectionBar { - Actor self; - public SupportPowerChargeBar(Actor self) { this.self = self; } + readonly Actor self; + readonly SupportPowerChargeBarInfo info; + + public SupportPowerChargeBar(Actor self, SupportPowerChargeBarInfo info) + { + this.self = self; + this.info = info; + } public float GetValue() { - // only people we like should see our charge status. if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) return 0; @@ -38,6 +46,6 @@ namespace OpenRA.Mods.RA return 1 - (float)power.RemainingTime / power.TotalTime; } - public Color GetColor() { return Color.Magenta; } + public Color GetColor() { return info.Color; } } } diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs index ec7fb92a10..d271c42fe3 100644 --- a/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs @@ -16,6 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Attach this to the player actor.")] public class SupportPowerManagerInfo : ITraitInfo, Requires, Requires { public object Create(ActorInitializer init) { return new SupportPowerManager(init); } diff --git a/OpenRA.Mods.RA/VoxelNormalsPalette.cs b/OpenRA.Mods.RA/VoxelNormalsPalette.cs index 76227f05a1..af3f5e6d1f 100644 --- a/OpenRA.Mods.RA/VoxelNormalsPalette.cs +++ b/OpenRA.Mods.RA/VoxelNormalsPalette.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -17,6 +17,8 @@ namespace OpenRA.Mods.RA public class VoxelNormalsPaletteInfo : ITraitInfo { public readonly string Name = "normals"; + + [Desc("Can be TiberianSun or RedAlert2")] public readonly NormalType Type = NormalType.TiberianSun; public object Create(ActorInitializer init) { return new VoxelNormalsPalette(this); } diff --git a/OpenRA.Mods.RA/World/BuildableTerrainLayer.cs b/OpenRA.Mods.RA/World/BuildableTerrainLayer.cs index 481db4b25f..043dd62c21 100644 --- a/OpenRA.Mods.RA/World/BuildableTerrainLayer.cs +++ b/OpenRA.Mods.RA/World/BuildableTerrainLayer.cs @@ -14,6 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Attach this to the world actor. Required for LaysTerrain to work.")] public class BuildableTerrainLayerInfo : TraitInfo { } public class BuildableTerrainLayer : IRenderOverlay, IWorldLoaded, ITickRender { diff --git a/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs b/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs index 8c95e2e5e6..6962ceba73 100644 --- a/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs +++ b/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -17,21 +17,25 @@ namespace OpenRA.Mods.RA { class ChooseBuildTabOnSelectInfo : ITraitInfo { - public object Create(ActorInitializer init) { return new ChooseBuildTabOnSelect(init); } + public readonly string BuildPaletteWidgetName = "INGAME_BUILD_PALETTE"; + + public object Create(ActorInitializer init) { return new ChooseBuildTabOnSelect(init, this); } } class ChooseBuildTabOnSelect : INotifySelection { readonly World world; + readonly ChooseBuildTabOnSelectInfo info; - public ChooseBuildTabOnSelect(ActorInitializer init) + public ChooseBuildTabOnSelect(ActorInitializer init, ChooseBuildTabOnSelectInfo info) { world = init.world; + this.info = info; } public void SelectionChanged() { - var palette = Ui.Root.GetOrNull("INGAME_BUILD_PALETTE"); + var palette = Ui.Root.GetOrNull(info.BuildPaletteWidgetName); if (palette == null) return; diff --git a/OpenRA.Mods.RA/World/PathfinderDebugOverlay.cs b/OpenRA.Mods.RA/World/PathfinderDebugOverlay.cs index c23d0474d0..3b4b43cc88 100644 --- a/OpenRA.Mods.RA/World/PathfinderDebugOverlay.cs +++ b/OpenRA.Mods.RA/World/PathfinderDebugOverlay.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -18,6 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { + [Desc("Required for the A* PathDebug from DeveloperMode. Attach this to the world actor.")] class PathfinderDebugOverlayInfo : TraitInfo { } class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded { diff --git a/OpenRA.Mods.RA/World/ResourceClaimLayer.cs b/OpenRA.Mods.RA/World/ResourceClaimLayer.cs index 1f94d71676..baa49c36b7 100644 --- a/OpenRA.Mods.RA/World/ResourceClaimLayer.cs +++ b/OpenRA.Mods.RA/World/ResourceClaimLayer.cs @@ -4,9 +4,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - public sealed class ResourceClaimLayerInfo : TraitInfo - { - } + [Desc("Allows harvesters to coordinate their operations. Attach this to the world actor.")] + public sealed class ResourceClaimLayerInfo : TraitInfo { } public sealed class ResourceClaimLayer : IWorldLoaded { diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index 907471c3e9..3de900d1c0 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -257,6 +257,9 @@ namespace OpenRA.Utility if (t.IsSubclassOf(typeof(Array))) return "Multiple {0}".F(FriendlyTypeName(t.GetElementType())); + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(OpenRA.Primitives.Cache<,>)) + return "Cached<{0},{1}>".F(t.GetGenericArguments().Select(FriendlyTypeName).ToArray()); + if (t == typeof(int) || t == typeof(uint)) return "Integer";