Remove workarounds for querying the PlayerActor in Created
This commit is contained in:
@@ -141,19 +141,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
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;
|
||||
|
||||
playerPower = playerActor.TraitOrDefault<PowerManager>();
|
||||
playerResources = playerActor.Trait<PlayerResources>();
|
||||
developerMode = playerActor.Trait<DeveloperMode>();
|
||||
techTree = playerActor.Trait<TechTree>();
|
||||
playerPower = self.Owner.PlayerActor.TraitOrDefault<PowerManager>();
|
||||
playerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
|
||||
developerMode = self.Owner.PlayerActor.Trait<DeveloperMode>();
|
||||
techTree = self.Owner.PlayerActor.Trait<TechTree>();
|
||||
|
||||
productionTraits = self.TraitsImplementing<Production>().Where(p => p.Info.Produces.Contains(Info.Type)).ToArray();
|
||||
CacheProducibles(playerActor);
|
||||
CacheProducibles(self.Owner.PlayerActor);
|
||||
}
|
||||
|
||||
protected void ClearQueue()
|
||||
|
||||
Reference in New Issue
Block a user