Use nameof for additional robustness in trait documentation.

This commit is contained in:
Matthias Mailänder
2021-05-08 10:04:39 +02:00
committed by Paul Chote
parent 52a4b5acd7
commit 6876fe45e1
16 changed files with 33 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Scripting
hasLighting = lighting != null;
}
[Desc("Controls the `FlashPaletteEffect` trait.")]
[Desc("Controls the `" + nameof(FlashPaletteEffect) + "` trait.")]
public void Flash(string type = null, int ticks = -1)
{
foreach (var effect in flashPaletteEffects)

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
{
[ActorReference]
[FieldLoader.Require]
[Desc("Name of the delivering actor. This actor must have the `Carryall` trait")]
[Desc("Name of the delivering actor. This actor must have the `" + nameof(Carryall) + "` trait")]
public readonly string DeliveringActor = null;
[Desc("Cell coordinates for spawning the delivering actor. If left blank, the closest edge cell will be chosen.")]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string SelectionNotification = null;
[Desc("List of production queues for which the primary flag should be set.",
"If empty, the list given in the `Produces` property of the `Production` trait will be used.")]
"If empty, the list given in the `Produces` property of the `" + nameof(Production) + "` trait will be used.")]
public readonly string[] ProductionQueues = { };
[CursorReference]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
[FieldLoader.Require]
[ActorReference(typeof(AircraftInfo))]
[Desc("Cargo aircraft used for delivery. Must have the `Aircraft` trait.")]
[Desc("Cargo aircraft used for delivery. Must have the `" + nameof(Aircraft) + "` trait.")]
public readonly string ActorType = null;
[Desc("The cargo aircraft will spawn at the player baseline (map edge closest to the player spawn)")]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Can be carried by actors with the `Carryall` trait.")]
[Desc("Can be carried by actors with the `" + nameof(Carryall) + "` trait.")]
public class CarryableInfo : ConditionalTraitInfo
{
[GrantedConditionReference]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Transports actors with the `Carryable` trait.")]
[Desc("Transports actors with the `" + nameof(Carryable) + "` trait.")]
public class CarryallInfo : TraitInfo, Requires<BodyOrientationInfo>, Requires<AircraftInfo>
{
[ActorReference(typeof(CarryableInfo))]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Donate money to actors with the `AcceptsDeliveredCash` trait.")]
[Desc("Donate money to actors with the `" + nameof(AcceptsDeliveredCash) + "` trait.")]
class DeliversCashInfo : TraitInfo
{
[Desc("The amount of cash the owner receives.")]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can grant experience levels equal to it's own current level via entering to other actors with the `AcceptsDeliveredExperience` trait.")]
[Desc("This actor can grant experience levels equal to it's own current level via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")]
class DeliversExperienceInfo : TraitInfo, Requires<GainsExperienceInfo>
{
[Desc("The amount of experience the donating player receives.")]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -14,7 +14,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.",
[Desc("This trait can be used to track player experience based on units killed with the `" + nameof(GivesExperience) + "` trait.",
"It can also be used as a point score system in scripted maps, for example.",
"Attach this to the player actor.")]
public class PlayerExperienceInfo : TraitInfo

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Radius of the reveal around this actor.")]
public readonly WDist Radius = new WDist(1536);
[Desc("Can this actor be revealed through shroud generated by the CreatesShroud trait?")]
[Desc("Can this actor be revealed through shroud generated by the `" + nameof(CreatesShroud) + "` trait?")]
public readonly bool RevealGeneratedShroud = true;
[Desc("DeathTypes for which shroud will be revealed.",

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Radius of the reveal around this actor.")]
public readonly WDist Radius = new WDist(1536);
[Desc("Can this actor be revealed through shroud generated by the CreatesShroud trait?")]
[Desc("Can this actor be revealed through shroud generated by the `" + nameof(CreatesShroud) + "` trait?")]
public readonly bool RevealGeneratedShroud = true;
public override object Create(ActorInitializer init) { return new RevealOnFire(init.Self, this); }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Relationships the watching player needs to see the shroud removed.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;
[Desc("Can this actor reveal shroud generated by the `CreatesShroud` trait?")]
[Desc("Can this actor reveal shroud generated by the `" + nameof(CreatesShroud) + "` trait?")]
public readonly bool RevealGeneratedShroud = true;
public override object Create(ActorInitializer init) { return new RevealsMap(this); }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Relationships the watching player needs to see the shroud removed.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;
[Desc("Can this actor reveal shroud generated by the CreatesShroud trait?")]
[Desc("Can this actor reveal shroud generated by the `" + nameof(CreatesShroud) + "` trait?")]
public readonly bool RevealGeneratedShroud = true;
public override object Create(ActorInitializer init) { return new RevealsShroud(init.Self, this); }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Range of cells the camera should reveal around target cell.")]
public readonly WDist CameraRange = WDist.Zero;
[Desc("Can the camera reveal shroud generated by the CreatesShroud trait?")]
[Desc("Can the camera reveal shroud generated by the `" + nameof(CreatesShroud) + "` trait?")]
public readonly bool RevealGeneratedShroud = true;
[Desc("Reveal cells to players with these relationships only.")]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[TraitLocation(SystemActors.World)]
[Desc("Part of the combat overlay from DeveloperMode. Attach this to the world actor.")]
[Desc("Part of the combat overlay from `" + nameof(DeveloperMode) + "`. Attach this to the world actor.")]
public class WarheadDebugOverlayInfo : TraitInfo
{
public readonly int DisplayDuration = 25;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2021 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, either version 3 of
@@ -10,6 +10,7 @@
#endregion
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
@@ -45,7 +46,7 @@ namespace OpenRA.Mods.Common.Warheads
int IWarhead.Delay => Delay;
[Desc("The color used for this warhead's visualization in the world's `WarheadDebugOverlay` trait.")]
[Desc("The color used for this warhead's visualization in the world's `" + nameof(WarheadDebugOverlay) + "` trait.")]
public readonly Color DebugOverlayColor = Color.Red;
protected bool IsValidTarget(BitSet<TargetableType> targetTypes)