Special-case the player actor on GCOnBotOwner.
This commit is contained in:
committed by
abcdefg30
parent
1513068114
commit
51a99cb43c
@@ -44,9 +44,16 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
conditionManager = self.TraitOrDefault<ConditionManager>();
|
// Special case handling is required for the Player actor.
|
||||||
if (conditionManager != null && self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType))
|
// Created is called before Player.IsBot is set, so we
|
||||||
conditionToken = conditionManager.GrantCondition(self, info.Condition);
|
// 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)
|
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||||
|
|||||||
Reference in New Issue
Block a user