Add configurable cursors for entering allied actor targeters

This commit is contained in:
Ivaylo Draganov
2020-05-15 15:40:34 +03:00
committed by abcdefg30
parent 393f6eca3a
commit d5ff5c672b
9 changed files with 40 additions and 12 deletions

View File

@@ -16,13 +16,17 @@ namespace OpenRA.Mods.Common.Orders
{
public class EnterAlliedActorTargeter<T> : UnitOrderTargeter where T : ITraitInfoInterface
{
readonly string enterCursor;
readonly string enterBlockedCursor;
readonly Func<Actor, TargetModifiers, bool> canTarget;
readonly Func<Actor, bool> useEnterCursor;
public EnterAlliedActorTargeter(string order, int priority,
public EnterAlliedActorTargeter(string order, int priority, string enterCursor, string enterBlockedCursor,
Func<Actor, TargetModifiers, bool> canTarget, Func<Actor, bool> useEnterCursor)
: base(order, priority, "enter", false, true)
: base(order, priority, enterCursor, false, true)
{
this.enterCursor = enterCursor;
this.enterBlockedCursor = enterBlockedCursor;
this.canTarget = canTarget;
this.useEnterCursor = useEnterCursor;
}
@@ -32,7 +36,7 @@ namespace OpenRA.Mods.Common.Orders
if (!self.Owner.IsAlliedWith(target.Owner) || !target.Info.HasTraitInfo<T>() || !canTarget(target, modifiers))
return false;
cursor = useEnterCursor(target) ? "enter" : "enter-blocked";
cursor = useEnterCursor(target) ? enterCursor : enterBlockedCursor;
return true;
}