Only use largest blocker instead of largest actor for projectile blocker overscan
Before this, we unconditionally used the largest OuterRadius of all actors inside a mod for overscanning of blockable projectiles. However, in many mods the only blockable actors are 1-cell walls, and even if there are gates like in TS, they usually aren't the largest actors in terms of hit-shape. So this measure should save a bit of performance by reducing the overscan radius of blockable projectiles, especially in mods where walls are the only blocking actors.
This commit is contained in:
@@ -184,6 +184,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Predicate<Actor> actorShouldBeRemoved;
|
||||
|
||||
public WDist LargestActorRadius { get; private set; }
|
||||
public WDist LargestBlockingActorRadius { get; private set; }
|
||||
|
||||
public ActorMap(World world, ActorMapInfo info)
|
||||
{
|
||||
@@ -202,6 +203,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
actorShouldBeRemoved = removeActorPosition.Contains;
|
||||
|
||||
LargestActorRadius = map.Rules.Actors.SelectMany(a => a.Value.TraitInfos<HitShapeInfo>()).Max(h => h.Type.OuterRadius);
|
||||
var blockers = map.Rules.Actors.Where(a => a.Value.HasTraitInfo<IBlocksProjectilesInfo>());
|
||||
LargestBlockingActorRadius = blockers.Any() ? blockers.SelectMany(a => a.Value.TraitInfos<HitShapeInfo>()).Max(h => h.Type.OuterRadius) : WDist.Zero;
|
||||
}
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user