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].")] "A dictionary of [actor id]: [condition].")]
public readonly Dictionary<string, string> DisguisedAsConditions = new Dictionary<string, string>(); 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] [GrantedConditionReference]
public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } } public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } }
@@ -284,7 +287,7 @@ namespace OpenRA.Mods.Cnc.Traits
readonly DisguiseInfo info; readonly DisguiseInfo info;
public DisguiseOrderTargeter(DisguiseInfo info) public DisguiseOrderTargeter(DisguiseInfo info)
: base("Disguise", 7, "ability", true, true) : base("Disguise", 7, info.Cursor, true, true)
{ {
this.info = info; this.info = info;
ForceAttack = false; 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.")] [Desc("Cursor to display when unable to drop off the passengers at location.")]
public readonly string DropOffBlockedCursor = "move-blocked"; public readonly string DropOffBlockedCursor = "move-blocked";
[Desc("Cursor to display when picking up the passengers.")]
public readonly string PickUpCursor = "ability";
[VoiceReference] [VoiceReference]
public readonly string Voice = "Action"; public readonly string Voice = "Action";
@@ -266,7 +269,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
get get
{ {
yield return new CarryallPickupOrderTargeter(); yield return new CarryallPickupOrderTargeter(Info);
yield return new DeployOrderTargeter("Unload", 10, yield return new DeployOrderTargeter("Unload", 10,
() => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor); () => CanUnload() ? Info.UnloadCursor : Info.UnloadBlockedCursor);
yield return new CarryallDeliverUnitTargeter(aircraftInfo, Info); yield return new CarryallDeliverUnitTargeter(aircraftInfo, Info);
@@ -332,8 +335,8 @@ namespace OpenRA.Mods.Common.Traits
class CarryallPickupOrderTargeter : UnitOrderTargeter class CarryallPickupOrderTargeter : UnitOrderTargeter
{ {
public CarryallPickupOrderTargeter() public CarryallPickupOrderTargeter(CarryallInfo info)
: base("PickupUnit", 5, "ability", false, true) : 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")] [Desc("Sound to play when delivering cash")]
public readonly string[] Sounds = { }; public readonly string[] Sounds = { };
[Desc("Cursor to show when hovering over a valid actor to deliver cash to.")]
public readonly string Cursor = "enter";
[VoiceReference] [VoiceReference]
public readonly string Voice = "Action"; public readonly string Voice = "Action";
@@ -49,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
public IEnumerable<IOrderTargeter> Orders 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) 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 class DeliversCashOrderTargeter : UnitOrderTargeter
{ {
public DeliversCashOrderTargeter() public DeliversCashOrderTargeter(DeliversCashInfo info)
: base("DeliverCash", 5, "enter", false, true) { } : base("DeliverCash", 5, info.Cursor, false, true) { }
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor) 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.")] [Desc("Identifier checked against AcceptsDeliveredExperience.ValidTypes. Only needed if the latter is not empty.")]
public readonly string Type = null; 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] [VoiceReference]
public readonly string Voice = "Action"; public readonly string Voice = "Action";
@@ -50,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
get get
{ {
if (gainsExperience.Level != 0) 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 class DeliversExperienceOrderTargeter : UnitOrderTargeter
{ {
public DeliversExperienceOrderTargeter() public DeliversExperienceOrderTargeter(DeliversExperienceInfo info)
: base("DeliverExperience", 5, "enter", true, true) { } : base("DeliverExperience", 5, info.Cursor, true, true) { }
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor) public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
{ {