diff --git a/OpenRA.Mods.Common/Util.cs b/OpenRA.Mods.Common/Util.cs index f2820bf75e..c1b8f33521 100644 --- a/OpenRA.Mods.Common/Util.cs +++ b/OpenRA.Mods.Common/Util.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Linq; +using OpenRA.GameRules; using OpenRA.Mods.Common.Traits; using OpenRA.Support; using OpenRA.Traits; @@ -175,5 +176,18 @@ namespace OpenRA.Mods.Common return world.SharedRandom.Next(range[0], range[1]); } + + // TODO: Investigate caching this or moving it to ActorMapInfo + public static WDist MinimumRequiredVictimScanRadius(Ruleset rules) + { + return rules.Actors.SelectMany(a => a.Value.TraitInfos()).Max(h => h.Shape.OuterRadius); + } + + // TODO: Investigate caching this or moving it to ActorMapInfo + public static WDist MinimumRequiredBlockerScanRadius(Ruleset rules) + { + return rules.Actors.Where(a => a.Value.HasTraitInfo()) + .SelectMany(a => a.Value.TraitInfos()).Max(h => h.Shape.OuterRadius); + } } }