Add a lint test for projectile target search radius.
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
using OpenRA.Mods.Common.Effects;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Mods.Common.Warheads;
|
using OpenRA.Mods.Common.Warheads;
|
||||||
using OpenRA.Traits;
|
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}`!"
|
emitError("Actor type `{0}` has a health radius exceeding the victim scan radius of a warhead on `{1}`!"
|
||||||
.F(actorInfo.Key, weaponInfo.Key));
|
.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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user