Make the Attack lua method available for non-mobile actors

This commit is contained in:
abcdefg30
2016-05-26 17:41:20 +02:00
parent 19482863fd
commit 4461379963

View File

@@ -23,13 +23,11 @@ namespace OpenRA.Mods.Common.Scripting
public class CombatProperties : ScriptActorProperties, Requires<AttackBaseInfo>, Requires<IMoveInfo>
{
readonly IMove move;
readonly AttackBase attackBase;
public CombatProperties(ScriptContext context, Actor self)
: base(context, self)
{
move = self.Trait<IMove>();
attackBase = self.Trait<AttackBase>();
}
[ScriptActorPropertyActivity]
@@ -75,6 +73,18 @@ namespace OpenRA.Mods.Common.Scripting
using (var f = func.CopyReference() as LuaFunction)
Self.QueueActivity(new CallFunc(() => PatrolUntil(waypoints, f, wait)));
}
}
[ScriptPropertyGroup("Combat")]
public class GeneralCombatProperties : ScriptActorProperties, Requires<AttackBaseInfo>
{
readonly AttackBase attackBase;
public GeneralCombatProperties(ScriptContext context, Actor self)
: base(context, self)
{
attackBase = self.Trait<AttackBase>();
}
[Desc("Attack the target actor. The target actor needs to be visible.")]
public void Attack(Actor targetActor, bool allowMove = true, bool forceAttack = false)