Add a lint test for projectile target search radius.

This commit is contained in:
Paul Chote
2015-12-19 13:15:23 +00:00
parent a44b50c2ad
commit 124e7b389a

View File

@@ -10,6 +10,8 @@
using System;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Warheads;
using OpenRA.Traits;
@@ -48,6 +50,21 @@ namespace OpenRA.Mods.Common.Lint
emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of a warhead 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 = bullet != null ? bullet.TargetExtraSearchRadius :
missile != null ? missile.TargetExtraSearchRadius :
areabeam != null ? areabeam.TargetExtraSearchRadius : WDist.Zero;
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));
}
}
}