Allow GrantConditionOnPrerequisite to work on Player:
This commit is contained in:
committed by
abcdefg30
parent
7b6b79493c
commit
f7de5d46be
@@ -41,11 +41,17 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public GrantConditionOnPrerequisite(Actor self, GrantConditionOnPrerequisiteInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
globalManager = self.Owner.PlayerActor.Trait<GrantConditionOnPrerequisiteManager>();
|
||||
}
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
// Special case handling is required for the Player actor.
|
||||
// Created is called before Player.PlayerActor is assigned,
|
||||
// so we must query other player traits from self, knowing that
|
||||
// it refers to the same actor as self.Owner.PlayerActor
|
||||
var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor;
|
||||
|
||||
globalManager = playerActor.Trait<GrantConditionOnPrerequisiteManager>();
|
||||
conditionManager = self.TraitOrDefault<ConditionManager>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user