Add configurable target cursors to various traits

This commit is contained in:
Ivaylo Draganov
2020-05-15 01:16:29 +03:00
committed by abcdefg30
parent d193ef856e
commit 393f6eca3a
4 changed files with 22 additions and 10 deletions

View File

@@ -93,6 +93,9 @@ namespace OpenRA.Mods.Cnc.Traits
"A dictionary of [actor id]: [condition].")]
public readonly Dictionary<string, string> DisguisedAsConditions = new Dictionary<string, string>();
[Desc("Cursor to show when hovering over a valid actor to disguise as.")]
public readonly string Cursor = "ability";
[GrantedConditionReference]
public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } }
@@ -284,7 +287,7 @@ namespace OpenRA.Mods.Cnc.Traits
readonly DisguiseInfo info;
public DisguiseOrderTargeter(DisguiseInfo info)
: base("Disguise", 7, "ability", true, true)
: base("Disguise", 7, info.Cursor, true, true)
{
this.info = info;
ForceAttack = false;

View File

@@ -50,6 +50,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Cursor to display when unable to drop off the passengers at location.")]
public readonly string DropOffBlockedCursor = "move-blocked";
[Desc("Cursor to display when picking up the passengers.")]
public readonly string PickUpCursor = "ability";
[VoiceReference]
public readonly string Voice = "Action";
@@ -266,7 +269,7 @@ namespace OpenRA.Mods.Common.Traits
{
get
{
yield return new CarryallPickupOrderTargeter();
yield return new CarryallPickupOrderTargeter(Info);
yield return new DeployOrderTargeter("Unload", 10,
() => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor);
yield return new CarryallDeliverUnitTargeter(aircraftInfo, Info);
@@ -332,8 +335,8 @@ namespace OpenRA.Mods.Common.Traits
class CarryallPickupOrderTargeter : UnitOrderTargeter
{
public CarryallPickupOrderTargeter()
: base("PickupUnit", 5, "ability", false, true)
public CarryallPickupOrderTargeter(CarryallInfo info)
: base("PickupUnit", 5, info.PickUpCursor, false, true)
{
}

View File

@@ -32,6 +32,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sound to play when delivering cash")]
public readonly string[] Sounds = { };
[Desc("Cursor to show when hovering over a valid actor to deliver cash to.")]
public readonly string Cursor = "enter";
[VoiceReference]
public readonly string Voice = "Action";
@@ -49,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
public IEnumerable<IOrderTargeter> Orders
{
get { yield return new DeliversCashOrderTargeter(); }
get { yield return new DeliversCashOrderTargeter(info); }
}
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
@@ -87,8 +90,8 @@ namespace OpenRA.Mods.Common.Traits
public class DeliversCashOrderTargeter : UnitOrderTargeter
{
public DeliversCashOrderTargeter()
: base("DeliverCash", 5, "enter", false, true) { }
public DeliversCashOrderTargeter(DeliversCashInfo info)
: base("DeliverCash", 5, info.Cursor, false, true) { }
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
{

View File

@@ -26,6 +26,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Identifier checked against AcceptsDeliveredExperience.ValidTypes. Only needed if the latter is not empty.")]
public readonly string Type = null;
[Desc("Cursor to show when hovering over a valid actor to deliver experience to.")]
public readonly string Cursor = "enter";
[VoiceReference]
public readonly string Voice = "Action";
@@ -50,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
get
{
if (gainsExperience.Level != 0)
yield return new DeliversExperienceOrderTargeter();
yield return new DeliversExperienceOrderTargeter(info);
}
}
@@ -90,8 +93,8 @@ namespace OpenRA.Mods.Common.Traits
public class DeliversExperienceOrderTargeter : UnitOrderTargeter
{
public DeliversExperienceOrderTargeter()
: base("DeliverExperience", 5, "enter", true, true) { }
public DeliversExperienceOrderTargeter(DeliversExperienceInfo info)
: base("DeliverExperience", 5, info.Cursor, true, true) { }
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
{