Add a lint check for trait placement on hardcoded actor names.

This commit is contained in:
Matthias Mailänder
2021-04-11 14:30:00 +01:00
committed by reaperrr
parent 0d3c624bbc
commit 5a0bcc01a6
129 changed files with 266 additions and 67 deletions

View File

@@ -13,6 +13,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Attach this to the player actor to allow building repair by team mates.")]
class AllyRepairInfo : TraitInfo<AllyRepair> { }

View File

@@ -14,6 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Plays an audio notification and shows a radar ping when a building is attacked.",
"Attach this to the player actor.")]
public class BaseAttackNotifierInfo : TraitInfo

View File

@@ -21,6 +21,7 @@ namespace OpenRA.Mods.Common.Traits
"Will only work together with the Production: trait on the actor that actually does the production.",
"You will also want to add PrimaryBuildings: to let the user choose where new units should exit.",
"The production speed depends on the number of production buildings and units queued at the same time.")]
[TraitLocation(SystemActors.Player)]
public class ClassicParallelProductionQueueInfo : ProductionQueueInfo, Requires<TechTreeInfo>, Requires<PlayerResourcesInfo>
{
[Desc("If you build more actors of the same type,", "the same queue will get its build time lowered for every actor produced there.")]

View File

@@ -16,6 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Attach this to the player actor (not a building!) to define a new shared build queue.",
"Will only work together with the Production: trait on the actor that actually does the production.",
"You will also want to add PrimaryBuildings: to let the user choose where new units should exit.")]

View File

@@ -11,11 +11,11 @@
using System.Linq;
using OpenRA.Network;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
public class ConquestVictoryConditionsInfo : TraitInfo, Requires<MissionObjectivesInfo>
{
[Desc("Delay for the end game notification in milliseconds.")]

View File

@@ -16,6 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Attach this to the player actor.")]
public class DeveloperModeInfo : TraitInfo, ILobbyOptions
{

View File

@@ -15,6 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Tracks neutral and enemy actors' visibility and notifies the player.",
"Attach this to the player actor. The actors to track need the 'AnnounceOnSeen' trait.")]
class EnemyWatcherInfo : TraitInfo

View File

@@ -11,11 +11,11 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Attach this to the player actor.")]
public class GrantConditionOnPrerequisiteManagerInfo : TraitInfo, Requires<TechTreeInfo>
{

View File

@@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Plays an audio notification and shows a radar ping when a harvester is attacked.",
"Attach this to the player actor.")]
[TraitLocation(SystemActors.Player)]
public class HarvesterAttackNotifierInfo : TraitInfo
{
[Desc("Minimum duration (in seconds) between notification events.")]

View File

@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
[TraitLocation(SystemActors.Player)]
public class MissionObjectivesInfo : TraitInfo
{
[Desc("Set this to true if multiple cooperative players have a distinct set of " +
@@ -258,6 +259,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
[TraitLocation(SystemActors.World)]
[Desc("Provides game mode progress information for players.",
"Goes on WorldActor - observers don't have a player it can live on.",
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
@@ -271,6 +273,7 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return new ObjectivesPanel(this); }
}
[TraitLocation(SystemActors.World)]
public class ObjectivesPanel : IObjectivesPanel
{
readonly ObjectivesPanelInfo info;

View File

@@ -14,6 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("A beacon that is constructed from a circle sprite that is animated once and a moving arrow sprite.")]
public class PlaceBeaconInfo : TraitInfo
{

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Mods.Common.Traits
// Allows third party mods to detect whether an actor was created by PlaceBuilding.
public class PlaceBuildingInit : RuntimeFlagInit { }
[TraitLocation(SystemActors.Player)]
[Desc("Allows the player to execute build orders.", " Attach this to the player actor.")]
public class PlaceBuildingInfo : TraitInfo
{

View File

@@ -13,6 +13,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("This trait can be used to track player experience based on units killed with the `GivesExperience` trait.",
"It can also be used as a point score system in scripted maps, for example.",
"Attach this to the player actor.")]

View File

@@ -11,11 +11,11 @@
using System;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
public class PlayerRadarTerrainInfo : TraitInfo, Requires<ShroudInfo>
{
public override object Create(ActorInitializer init)

View File

@@ -16,6 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player | SystemActors.EditorPlayer)]
public class PlayerResourcesInfo : TraitInfo, ILobbyOptions
{
[Desc("Descriptive label for the starting cash option in the lobby.")]

View File

@@ -18,6 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Attach this to the player actor to collect observer stats.")]
public class PlayerStatisticsInfo : TraitInfo
{

View File

@@ -14,6 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
public class ProvidesTechPrerequisiteInfo : TraitInfo, ITechTreePrerequisiteInfo
{
[Desc("Internal id for this tech level.")]

View File

@@ -13,6 +13,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Provides the player with an audible warning when their storage is nearing full.")]
public class ResourceStorageWarningInfo : TraitInfo, Requires<PlayerResourcesInfo>
{

View File

@@ -17,6 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.Player)]
[Desc("Manages build limits and pre-requisites.", " Attach this to the player actor.")]
public class TechTreeInfo : TraitInfo
{

View File

@@ -17,6 +17,7 @@ using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.World)]
[Desc("This trait allows setting a time limit on matches. Attach this to the World actor.")]
public class TimeLimitManagerInfo : TraitInfo, ILobbyOptions, IRulesetLoaded
{