From 44613799633444ff366ca6b94350e877d8e23cb0 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Thu, 26 May 2016 17:41:20 +0200 Subject: [PATCH] Make the Attack lua method available for non-mobile actors --- .../Scripting/Properties/CombatProperties.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs index d5ecb836fb..b50d1bdbe7 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs @@ -23,13 +23,11 @@ namespace OpenRA.Mods.Common.Scripting public class CombatProperties : ScriptActorProperties, Requires, Requires { readonly IMove move; - readonly AttackBase attackBase; public CombatProperties(ScriptContext context, Actor self) : base(context, self) { move = self.Trait(); - attackBase = self.Trait(); } [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 + { + readonly AttackBase attackBase; + + public GeneralCombatProperties(ScriptContext context, Actor self) + : base(context, self) + { + attackBase = self.Trait(); + } [Desc("Attack the target actor. The target actor needs to be visible.")] public void Attack(Actor targetActor, bool allowMove = true, bool forceAttack = false)