Special-case the player actor on GCOnBotOwner.

This commit is contained in:
Zimmermann Gyula
2018-07-26 20:22:22 +02:00
committed by abcdefg30
parent 1513068114
commit 51a99cb43c

View File

@@ -43,10 +43,17 @@ namespace OpenRA.Mods.Common.Traits
}
void INotifyCreated.Created(Actor self)
{
// Special case handling is required for the Player actor.
// Created is called before Player.IsBot is set, so we
// must use a different method to enable this trait if
// it's defined on the PlayerActor.
self.World.AddFrameEndTask(w =>
{
conditionManager = self.TraitOrDefault<ConditionManager>();
if (conditionManager != null && self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType))
conditionToken = conditionManager.GrantCondition(self, info.Condition);
});
}
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)