1 #region Copyright & License Information 2 /* 3 * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) 4 * This file is part of OpenRA, which is free software. It is made 5 * available to you under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, either version 3 of 7 * the License, or (at your option) any later version. For more 8 * information, see COPYING. 9 */ 10 #endregion 11 12 using System; 13 using System.Linq; 14 using OpenRA.Mods.Common.Traits; 15 using OpenRA.Traits; 16 17 namespace OpenRA.Mods.Common.Lint 18 { 19 class CheckHitShapes : ILintRulesPass 20 { Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)21 public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules) 22 { 23 foreach (var actorInfo in rules.Actors) 24 { 25 var health = actorInfo.Value.TraitInfoOrDefault<IHealthInfo>(); 26 if (health == null) 27 continue; 28 29 var hitShapes = actorInfo.Value.TraitInfos<HitShapeInfo>(); 30 if (!hitShapes.Any()) 31 emitError("Actor type `{0}` has a Health trait but no HitShape trait!".F(actorInfo.Key)); 32 } 33 } 34 } 35 } 36