Merge pull request #10965 from RoosterDragon/actor-info-ordering

Strengthen trait ordering rules
This commit is contained in:
Matthias Mailänder
2016-04-03 12:36:20 +02:00
4 changed files with 80 additions and 94 deletions

View File

@@ -80,8 +80,11 @@ namespace OpenRA.Mods.Common.Traits
void INotifyCreated.Created(Actor self)
{
upgradeManager = self.TraitOrDefault<UpgradeManager>();
// The upgrade manager exists, but may not have finished being created yet.
// We'll defer the upgrades until the end of the tick, at which point it will be ready.
if (Cloaked)
GrantUpgrades(self);
self.World.AddFrameEndTask(_ => GrantUpgrades(self));
}
public bool Cloaked { get { return !IsTraitDisabled && remainingTime <= 0; } }