Cache ICrushable traits in actor.

This commit is contained in:
Vapre
2023-12-17 17:57:57 +01:00
committed by Gustas
parent 6026d088c8
commit 64cdfcbeab
10 changed files with 23 additions and 20 deletions

View File

@@ -574,7 +574,7 @@ namespace OpenRA.Mods.Common.Traits
void CrushAction(Actor self, Func<INotifyCrushed, Action<Actor, Actor, BitSet<CrushClass>>> action)
{
var crushables = self.World.ActorMap.GetActorsAt(ToCell, ToSubCell).Where(a => a != self)
.SelectMany(a => a.TraitsImplementing<ICrushable>().Select(t => new TraitPair<ICrushable>(a, t)));
.SelectMany(a => a.Crushables.Select(t => new TraitPair<ICrushable>(a, t)));
// Only crush actors that are on the ground level
foreach (var crushable in crushables)