Fix botmodules querying the Player actor before it is assigned.
This commit is contained in:
@@ -60,9 +60,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
player = self.Owner;
|
||||
}
|
||||
|
||||
protected override void TraitEnabled(Actor self)
|
||||
protected override void Created(Actor self)
|
||||
{
|
||||
requestPause = player.PlayerActor.TraitsImplementing<IBotRequestPauseUnitProduction>().ToArray();
|
||||
// Special case handling is required for the Player actor.
|
||||
// Created is called before Player.PlayerActor is assigned,
|
||||
// so we must query player traits from self, which refers
|
||||
// for bot modules always to the Player actor.
|
||||
requestPause = self.TraitsImplementing<IBotRequestPauseUnitProduction>().ToArray();
|
||||
}
|
||||
|
||||
void IBotNotifyIdleBaseUnits.UpdatedIdleBaseUnits(List<Actor> idleUnits)
|
||||
|
||||
Reference in New Issue
Block a user