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:
RoosterDragon
2024-09-14 18:32:54 +01:00
committed by Gustas
parent 327c1ba23b
commit ab50182c92
7 changed files with 33 additions and 31 deletions

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
// Units that the bot already knows about and has given a capture order. Any unit not on this list needs to be given a new order.
readonly List<Actor> activeCapturers = new();
readonly ActorIndex.OwnerAndNamesAndTrait<Captures> capturingActors;
readonly ActorIndex.OwnerAndNamesAndTrait<CapturesInfo> capturingActors;
public CaptureManagerBotModule(Actor self, CaptureManagerBotModuleInfo info)
: base(info)
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
maximumCaptureTargetOptions = Math.Max(1, Info.MaximumCaptureTargetOptions);
capturingActors = new ActorIndex.OwnerAndNamesAndTrait<Captures>(world, Info.CapturingActorTypes, player);
capturingActors = new ActorIndex.OwnerAndNamesAndTrait<CapturesInfo>(world, Info.CapturingActorTypes, player);
}
protected override void TraitEnabled(Actor self)