Add a lint check for cursor definitions.

This commit is contained in:
Matthias Mailänder
2021-03-14 16:01:33 +01:00
committed by reaperrr
parent cefb2e7cc6
commit bbbed49f82
40 changed files with 211 additions and 28 deletions

View File

@@ -40,7 +40,11 @@ namespace OpenRA.Mods.Common.Traits
"If empty, the list given in the `Produces` property of the `Production` trait will be used.")]
public readonly string[] ProductionQueues = { };
public override object Create(ActorInitializer init) { return new PrimaryBuilding(init.Self, this); }
[CursorReference]
[Desc("Cursor to display when setting the primary building.")]
public readonly string Cursor = "deploy";
public override object Create(ActorInitializer init) { return new PrimaryBuilding(this); }
}
public class PrimaryBuilding : ConditionalTrait<PrimaryBuildingInfo>, IIssueOrder, IResolveOrder
@@ -51,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
public bool IsPrimary { get; private set; }
public PrimaryBuilding(Actor self, PrimaryBuildingInfo info)
public PrimaryBuilding(PrimaryBuildingInfo info)
: base(info) { }
IEnumerable<IOrderTargeter> IIssueOrder.Orders
@@ -61,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
if (IsTraitDisabled)
yield break;
yield return new DeployOrderTargeter(OrderID, 1);
yield return new DeployOrderTargeter(OrderID, 1, () => Info.Cursor);
}
}

View File

@@ -30,6 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[SequenceReference(nameof(Image), allowNullImage: true)]
public readonly string CirclesSequence = "circles";
[CursorReference]
[Desc("Cursor to display when rally point can be set.")]
public readonly string Cursor = "ability";

View File

@@ -34,9 +34,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Require the force-move modifier to display the move cursor.")]
public readonly bool RequiresForceMove = false;
[CursorReference]
[Desc("Cursor to display when able to land at target building.")]
public readonly string EnterCursor = "enter";
[CursorReference]
[Desc("Cursor to display when unable to land at target building.")]
public readonly string EnterBlockedCursor = "enter-blocked";

View File

@@ -20,9 +20,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Add to a building to expose a move cursor that triggers Transforms and issues an enter tunnel order to the transformed actor.")]
public class TransformsIntoEntersTunnelsInfo : ConditionalTraitInfo, Requires<TransformsInfo>
{
[CursorReference]
[Desc("Cursor to display when able to enter target tunnel.")]
public readonly string EnterCursor = "enter";
[CursorReference]
[Desc("Cursor to display when unable to enter target tunnel.")]
public readonly string EnterBlockedCursor = "enter-blocked";

View File

@@ -25,9 +25,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Locomotor used by the transformed actor. Must be defined on the World actor.")]
public readonly string Locomotor = null;
[CursorReference]
[Desc("Cursor to display when a move order can be issued at target location.")]
public readonly string Cursor = "move";
[CursorReference]
[Desc("Cursor to display when a move order cannot be issued at target location.")]
public readonly string BlockedCursor = "move-blocked";

View File

@@ -33,9 +33,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Require the force-move modifier to display the enter cursor.")]
public readonly bool RequiresForceMove = false;
[CursorReference]
[Desc("Cursor to display when able to enter target actor.")]
public readonly string EnterCursor = "enter";
[CursorReference]
[Desc("Cursor to display when unable to enter target actor.")]
public readonly string EnterBlockedCursor = "enter-blocked";

View File

@@ -34,9 +34,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Require the force-move modifier to display the enter cursor.")]
public readonly bool RequiresForceMove = false;
[CursorReference]
[Desc("Cursor to display when able to be repaired at target actor.")]
public readonly string EnterCursor = "enter";
[CursorReference]
[Desc("Cursor to display when unable to be repaired at target actor.")]
public readonly string EnterBlockedCursor = "enter-blocked";