Assign Player.IsBot before calling INotifyCreated.Created

This commit is contained in:
abcdefg30
2020-05-25 17:24:13 +02:00
committed by reaperrr
parent 27d0465891
commit 44d3691fa1
2 changed files with 5 additions and 10 deletions

View File

@@ -42,15 +42,8 @@ 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 =>
{
if (self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType))
conditionToken = self.GrantCondition(info.Condition);
});
if (self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType))
conditionToken = self.GrantCondition(info.Condition);
}
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)