Reset unit stance on owner change.

This commit is contained in:
matjaeck
2019-02-02 19:53:48 +01:00
committed by reaperrr
parent fd013ad9d0
commit b466b5d660

View File

@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public class AutoTarget : ConditionalTrait<AutoTargetInfo>, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync, INotifyCreated
public class AutoTarget : ConditionalTrait<AutoTargetInfo>, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync, INotifyCreated, INotifyOwnerChanged
{
readonly IEnumerable<AttackBase> 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)