Skip to content

Commit

Permalink
Prevent recalling enemy units.
Browse files Browse the repository at this point in the history
  • Loading branch information
darkademic committed Feb 14, 2024
1 parent 7a291dc commit 407df87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions OpenRA.Mods.CA/Traits/SupportPowers/RecallPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ sealed class RecallPowerInfo : SupportPowerInfo
[Desc("Target types that cannot be recalled.")]
public readonly BitSet<TargetableType> InvalidTargetTypes = default(BitSet<TargetableType>);

[Desc("Player relationships that can be recalled.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;

[CursorReference]
[Desc("Cursor to display when the targeted area is blocked.")]
public readonly string TargetBlockedCursor = "move-blocked";
Expand Down Expand Up @@ -178,6 +181,9 @@ public bool IsValidTarget(Actor a)
if (a == null || !a.IsInWorld || a.IsDead)
return false;

if (!info.ValidRelationships.HasRelationship(Self.Owner.RelationshipWith(a.Owner)))
return false;

var targetTypes = a.GetEnabledTargetTypes();

if (!targetTypes.Overlaps(info.ValidTargetTypes))
Expand Down

0 comments on commit 407df87

Please sign in to comment.