Make the Attack lua method available for non-mobile actors
This commit is contained in:
@@ -23,13 +23,11 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public class CombatProperties : ScriptActorProperties, Requires<AttackBaseInfo>, Requires<IMoveInfo>
|
public class CombatProperties : ScriptActorProperties, Requires<AttackBaseInfo>, Requires<IMoveInfo>
|
||||||
{
|
{
|
||||||
readonly IMove move;
|
readonly IMove move;
|
||||||
readonly AttackBase attackBase;
|
|
||||||
|
|
||||||
public CombatProperties(ScriptContext context, Actor self)
|
public CombatProperties(ScriptContext context, Actor self)
|
||||||
: base(context, self)
|
: base(context, self)
|
||||||
{
|
{
|
||||||
move = self.Trait<IMove>();
|
move = self.Trait<IMove>();
|
||||||
attackBase = self.Trait<AttackBase>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
@@ -75,6 +73,18 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
using (var f = func.CopyReference() as LuaFunction)
|
using (var f = func.CopyReference() as LuaFunction)
|
||||||
Self.QueueActivity(new CallFunc(() => PatrolUntil(waypoints, f, wait)));
|
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.")]
|
[Desc("Attack the target actor. The target actor needs to be visible.")]
|
||||||
public void Attack(Actor targetActor, bool allowMove = true, bool forceAttack = false)
|
public void Attack(Actor targetActor, bool allowMove = true, bool forceAttack = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user