document traits

This commit is contained in:
Matthias Mailänder
2014-07-20 13:57:39 +02:00
parent 907188ccba
commit 1071a94d1d
28 changed files with 50 additions and 24 deletions

View File

@@ -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); }

View File

@@ -10,6 +10,7 @@
namespace OpenRA.Traits
{
[Desc("Attach this to the player actor.")]
public class DeveloperModeInfo : ITraitInfo
{
public int Cash = 20000;

View File

@@ -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); }

View File

@@ -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<ValidateOrder> { }
public class ValidateOrder : IValidateOrder

View File

@@ -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); }

View File

@@ -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<ChronoshiftPaletteEffect> { }
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick

View File

@@ -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<ChatCommands> { }
public class ChatCommands : INotifyChat

View File

@@ -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<DevCommands> { }
public class DevCommands : IChatCommand, IWorldLoaded

View File

@@ -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<HelpCommand> { }
public class HelpCommand : IChatCommand, IWorldLoaded

View File

@@ -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<PlayerCommands> { }
public class PlayerCommands : IChatCommand, IWorldLoaded

View File

@@ -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<ContainsCrate> { }
public class ContainsCrate : INotifyKilled

View File

@@ -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<CreateMPPlayers> { }
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)
{

View File

@@ -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<Fake> { }
class Fake : ITags

View File

@@ -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<MPStartUnits>
{
public readonly string Class = "none";

View File

@@ -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<MineImmune> { }
class MineImmune { }
}

View File

@@ -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<HiddenUnderFog> { }
public class HiddenUnderFog : IRenderModifier, IVisibilityModifier

View File

@@ -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<NukePaletteEffect> { }
public class NukePaletteEffect : IPaletteModifier, ITick

View File

@@ -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<ActorGroupProxy> { }
class ActorGroupProxy : IResolveOrder

View File

@@ -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<AllyRepair> { }
class AllyRepair : IResolveOrder

View File

@@ -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<UpdatesPlayerStatistics> { }
public class UpdatesPlayerStatistics : INotifyKilled

View File

@@ -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<RemoveImmediately> {}
public class RemoveImmediately : INotifyAddedToWorld

View File

@@ -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<SpawnMPUnits>, Requires<MPStartLocationsInfo>, Requires<MPStartUnitsInfo> { }
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)

View File

@@ -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); }

View File

@@ -16,6 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
[Desc("Attach this to the player actor.")]
public class SupportPowerManagerInfo : ITraitInfo, Requires<DeveloperModeInfo>, Requires<TechTreeInfo>
{
public object Create(ActorInitializer init) { return new SupportPowerManager(init); }

View File

@@ -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); }

View File

@@ -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<BuildableTerrainLayer> { }
public class BuildableTerrainLayer : IRenderOverlay, IWorldLoaded, ITickRender
{

View File

@@ -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<PathfinderDebugOverlay> { }
class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded
{

View File

@@ -4,9 +4,8 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public sealed class ResourceClaimLayerInfo : TraitInfo<ResourceClaimLayer>
{
}
[Desc("Allows harvesters to coordinate their operations. Attach this to the world actor.")]
public sealed class ResourceClaimLayerInfo : TraitInfo<ResourceClaimLayer> { }
public sealed class ResourceClaimLayer : IWorldLoaded
{