From 5d2a6ff2e742791a548bdbcd308b2ef3579ee32d Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 4 Oct 2016 10:02:18 +0200 Subject: [PATCH] Add a CanTarget method to lua --- OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs index ea43794824..4140b949b4 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs @@ -98,5 +98,11 @@ namespace OpenRA.Mods.Common.Scripting attackBase.AttackTarget(target, true, allowMove, forceAttack); } + + [Desc("Checks if the targeted actor is a valid target for this actor.")] + public bool CanTarget(Actor targetActor) + { + return Target.FromActor(targetActor).IsValidFor(Self); + } } }