diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index 01321ed228..59ea75b303 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Traits } } - public class AutoTarget : ConditionalTrait, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync, INotifyCreated + public class AutoTarget : ConditionalTrait, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync, INotifyCreated, INotifyOwnerChanged { readonly IEnumerable activeAttackBases; readonly AttackFollow[] attackFollows; @@ -177,6 +177,12 @@ namespace OpenRA.Mods.Common.Traits ApplyStanceCondition(self); } + void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) + { + PredictedStance = self.Owner.IsBot || !self.Owner.Playable ? Info.InitialStanceAI : Info.InitialStance; + SetStance(self, PredictedStance); + } + void IResolveOrder.ResolveOrder(Actor self, Order order) { if (order.OrderString == "SetUnitStance" && Info.EnableStances)