diff --git a/OpenRA.Mods.Common/Lint/CheckSpriteBodies.cs b/OpenRA.Mods.Common/Lint/CheckSpriteBodies.cs new file mode 100644 index 0000000000..b02c62f0b3 --- /dev/null +++ b/OpenRA.Mods.Common/Lint/CheckSpriteBodies.cs @@ -0,0 +1,32 @@ +#region Copyright & License Information +/* + * Copyright 2007-2018 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.Traits.Render; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Lint +{ + class CheckSpriteBodies : ILintRulesPass + { + public void Run(Action emitError, Action emitWarning, Ruleset rules) + { + foreach (var actorInfo in rules.Actors) + { + var wsbs = actorInfo.Value.TraitInfos(); + foreach (var wsb in wsbs) + if (wsbs.Any(w => w != wsb && w.Name == wsb.Name)) + emitError("Actor type `{0}` has more than one *SpriteBody with Name: {1}!".F(actorInfo.Key, wsb.Name)); + } + } + } +} diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 9fb2edccf9..09cba80057 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -198,6 +198,7 @@ + diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 5a8ee8da9c..94b1b2654a 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -30,9 +30,11 @@ V2RL: AttackFrontal: WithFacingSpriteBody: RequiresCondition: !reloading + Name: loaded WithFacingSpriteBody@EMPTY: RequiresCondition: reloading Sequence: empty-idle + Name: reloading SelectionDecorations: Explodes: Weapon: V2Explode diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 0b77e5ffe2..8725787a74 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -111,16 +111,20 @@ NAFNCE: RequiresCondition: laserfence-direction-x && active-posts == 2 Type: laserfence Sequence: enabled-x + Name: x-enabled WithWallSpriteBody@YENABLED: RequiresCondition: laserfence-direction-y && active-posts == 2 Type: laserfence Sequence: enabled-y + Name: y-enabled WithSpriteBody@XDISABLED: RequiresCondition: laserfence-direction-x && active-posts < 2 Sequence: disabled-x + Name: x-disabled WithSpriteBody@YDISABLED: RequiresCondition: laserfence-direction-y && active-posts < 2 Sequence: disabled-y + Name: y-disabled BlocksProjectiles: RequiresCondition: active-posts == 2 DamageMultiplier: # Prevent all normal damage, but still allows direct kills from the post