Fix CombatProperties not accounting for multiple AttackBase traits
This commit is contained in:
@@ -78,12 +78,12 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
[ScriptPropertyGroup("Combat")]
|
[ScriptPropertyGroup("Combat")]
|
||||||
public class GeneralCombatProperties : ScriptActorProperties, Requires<AttackBaseInfo>
|
public class GeneralCombatProperties : ScriptActorProperties, Requires<AttackBaseInfo>
|
||||||
{
|
{
|
||||||
readonly AttackBase attackBase;
|
readonly AttackBase[] attackBases;
|
||||||
|
|
||||||
public GeneralCombatProperties(ScriptContext context, Actor self)
|
public GeneralCombatProperties(ScriptContext context, Actor self)
|
||||||
: base(context, self)
|
: base(context, self)
|
||||||
{
|
{
|
||||||
attackBase = self.Trait<AttackBase>();
|
attackBases = self.TraitsImplementing<AttackBase>().ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Attack the target actor. The target actor needs to be visible.")]
|
[Desc("Attack the target actor. The target actor needs to be visible.")]
|
||||||
@@ -96,7 +96,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
if (!targetActor.Info.HasTraitInfo<FrozenUnderFogInfo>() && !targetActor.CanBeViewedByPlayer(Self.Owner))
|
if (!targetActor.Info.HasTraitInfo<FrozenUnderFogInfo>() && !targetActor.CanBeViewedByPlayer(Self.Owner))
|
||||||
Log.Write("lua", "{1} is not revealed for player {0}!", Self.Owner, targetActor);
|
Log.Write("lua", "{1} is not revealed for player {0}!", Self.Owner, targetActor);
|
||||||
|
|
||||||
attackBase.AttackTarget(target, true, allowMove, forceAttack);
|
foreach (var attack in attackBases)
|
||||||
|
attack.AttackTarget(target, true, allowMove, forceAttack);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Checks if the targeted actor is a valid target for this actor.")]
|
[Desc("Checks if the targeted actor is a valid target for this actor.")]
|
||||||
|
|||||||
Reference in New Issue
Block a user