Don't allow movement for actors without IMove
However, this does not check if any existing IMove traits are enabled.
This commit is contained in:
@@ -127,6 +127,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class AutoTarget : ConditionalTrait<AutoTargetInfo>, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync, INotifyOwnerChanged
|
||||
{
|
||||
public readonly IEnumerable<AttackBase> ActiveAttackBases;
|
||||
|
||||
readonly bool allowMovement;
|
||||
|
||||
[Sync]
|
||||
int nextScanTime = 0;
|
||||
|
||||
@@ -187,6 +190,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
stance = self.Owner.IsBot || !self.Owner.Playable ? info.InitialStanceAI : info.InitialStance;
|
||||
|
||||
PredictedStance = stance;
|
||||
|
||||
allowMovement = Info.AllowMovement && self.TraitOrDefault<IMove>() != null;
|
||||
}
|
||||
|
||||
protected override void Created(Actor self)
|
||||
@@ -244,7 +249,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// Don't fire at an invisible enemy when we can't move to reveal it
|
||||
var allowMove = Info.AllowMovement && Stance > UnitStance.Defend;
|
||||
var allowMove = allowMovement && Stance > UnitStance.Defend;
|
||||
if (!allowMove && !attacker.CanBeViewedByPlayer(self.Owner))
|
||||
return;
|
||||
|
||||
@@ -267,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (IsTraitDisabled || Stance < UnitStance.Defend)
|
||||
return;
|
||||
|
||||
var allowMove = Info.AllowMovement && Stance > UnitStance.Defend;
|
||||
var allowMove = allowMovement && Stance > UnitStance.Defend;
|
||||
var allowTurn = Info.AllowTurning && Stance > UnitStance.HoldFire;
|
||||
ScanAndAttack(self, allowMove, allowTurn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user