Change ActorIndex to work in terms of TraitInfo, instead of Trait.
This allows actor.Info.HasTraitInfo to be used when checking if an actor needs to be added to the index, which is a cheaper call than actor.TraitsImplementing.
This commit is contained in:
@@ -60,9 +60,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
readonly World world;
|
||||
readonly Player player;
|
||||
readonly ActorIndex.OwnerAndNamesAndTrait<Transforms> mcvs;
|
||||
readonly ActorIndex.OwnerAndNamesAndTrait<Building> constructionYards;
|
||||
readonly ActorIndex.OwnerAndNamesAndTrait<Building> mcvFactories;
|
||||
readonly ActorIndex.OwnerAndNamesAndTrait<TransformsInfo> mcvs;
|
||||
readonly ActorIndex.OwnerAndNamesAndTrait<BuildingInfo> constructionYards;
|
||||
readonly ActorIndex.OwnerAndNamesAndTrait<BuildingInfo> mcvFactories;
|
||||
|
||||
IBotPositionsUpdated[] notifyPositionsUpdated;
|
||||
IBotRequestUnitProduction[] requestUnitProduction;
|
||||
@@ -76,9 +76,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
world = self.World;
|
||||
player = self.Owner;
|
||||
mcvs = new ActorIndex.OwnerAndNamesAndTrait<Transforms>(world, info.McvTypes, player);
|
||||
constructionYards = new ActorIndex.OwnerAndNamesAndTrait<Building>(world, info.ConstructionYardTypes, player);
|
||||
mcvFactories = new ActorIndex.OwnerAndNamesAndTrait<Building>(world, info.McvFactoryTypes, player);
|
||||
mcvs = new ActorIndex.OwnerAndNamesAndTrait<TransformsInfo>(world, info.McvTypes, player);
|
||||
constructionYards = new ActorIndex.OwnerAndNamesAndTrait<BuildingInfo>(world, info.ConstructionYardTypes, player);
|
||||
mcvFactories = new ActorIndex.OwnerAndNamesAndTrait<BuildingInfo>(world, info.McvFactoryTypes, player);
|
||||
}
|
||||
|
||||
protected override void Created(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user