From 5b8c313d55482b87d33d7e3e6d6377d000f74d76 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 15 Jan 2017 12:00:23 +0100 Subject: [PATCH] Remove lint rule for victim scan radii They're now calculated automatically to use the most sensible value by default. Only people who know what they're doing or fool around will use custom values, and in that case a lint rule might actually just annoy people. --- .../Lint/CheckTargetHealthRadius.cs | 92 ------------------- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 - 2 files changed, 93 deletions(-) delete mode 100644 OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs diff --git a/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs b/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs deleted file mode 100644 index 106bd12d68..0000000000 --- a/OpenRA.Mods.Common/Lint/CheckTargetHealthRadius.cs +++ /dev/null @@ -1,92 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2017 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System; -using System.Linq; -using OpenRA.Mods.Common.Projectiles; -using OpenRA.Mods.Common.Traits; -using OpenRA.Mods.Common.Warheads; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Lint -{ - class CheckTargetHealthRadius : ILintRulesPass - { - public void Run(Action emitError, Action emitWarning, Ruleset rules) - { - foreach (var actorInfo in rules.Actors) - { - var healthTraits = actorInfo.Value.TraitInfos().ToList(); - if (!healthTraits.Any()) - continue; - - var targetable = actorInfo.Value.TraitInfos().SelectMany(x => x.GetTargetTypes()).ToList(); - if (!targetable.Any()) - continue; - - foreach (var weaponInfo in rules.Weapons) - { - var warheads = weaponInfo.Value.Warheads.OfType().Where(dw => dw.Damage > 0); - - foreach (var warhead in warheads) - { - // This is a special warhead, like the one on `weathering` in D2k. - if (!warhead.DamageTypes.Any()) - continue; - - // This warhead cannot affect this actor. - if (!warhead.ValidTargets.Overlaps(targetable)) - continue; - - if (healthTraits.Where(x => x.Shape.OuterRadius.Length > warhead.TargetExtraSearchRadius.Length).Any()) - emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of a SpreadDamageWarhead on `{1}`!" - .F(actorInfo.Key, weaponInfo.Key)); - } - - var effectWarheads = weaponInfo.Value.Warheads.OfType(); - - foreach (var warhead in effectWarheads) - { - // This warhead cannot affect this actor. - if (!warhead.ValidTargets.Overlaps(targetable)) - continue; - - if (healthTraits.Where(x => x.Shape.OuterRadius.Length > warhead.TargetSearchRadius.Length).Any()) - emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of a CreateEffectWarhead on `{1}`!" - .F(actorInfo.Key, weaponInfo.Key)); - } - - var bullet = weaponInfo.Value.Projectile as BulletInfo; - var missile = weaponInfo.Value.Projectile as MissileInfo; - var areabeam = weaponInfo.Value.Projectile as AreaBeamInfo; - - if (bullet == null && missile == null && areabeam == null) - continue; - - var targetExtraSearchRadius = WDist.Zero; - - if (bullet != null) - targetExtraSearchRadius = bullet.TargetExtraSearchRadius; - - if (missile != null) - targetExtraSearchRadius = missile.TargetExtraSearchRadius; - - if (areabeam != null) - targetExtraSearchRadius = areabeam.TargetExtraSearchRadius; - - if (healthTraits.Where(x => x.Shape.OuterRadius.Length > targetExtraSearchRadius.Length).Any()) - emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of the projectile on `{1}`!" - .F(actorInfo.Key, weaponInfo.Key)); - } - } - } - } -} diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 9928f29a32..8d9bb7bc9c 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -181,7 +181,6 @@ -