Lint check for distinct sprite body names
This commit is contained in:
committed by
Matthias Mailänder
parent
d060f885e8
commit
1c78073808
32
OpenRA.Mods.Common/Lint/CheckSpriteBodies.cs
Normal file
32
OpenRA.Mods.Common/Lint/CheckSpriteBodies.cs
Normal file
@@ -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<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||||
|
{
|
||||||
|
foreach (var actorInfo in rules.Actors)
|
||||||
|
{
|
||||||
|
var wsbs = actorInfo.Value.TraitInfos<WithSpriteBodyInfo>();
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -198,6 +198,7 @@
|
|||||||
<Compile Include="Lint\CheckChromeHotkeys.cs" />
|
<Compile Include="Lint\CheckChromeHotkeys.cs" />
|
||||||
<Compile Include="Lint\CheckConflictingMouseBounds.cs" />
|
<Compile Include="Lint\CheckConflictingMouseBounds.cs" />
|
||||||
<Compile Include="Lint\CheckLocomotorReferences.cs" />
|
<Compile Include="Lint\CheckLocomotorReferences.cs" />
|
||||||
|
<Compile Include="Lint\CheckSpriteBodies.cs" />
|
||||||
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
||||||
<Compile Include="Lint\LintExts.cs" />
|
<Compile Include="Lint\LintExts.cs" />
|
||||||
<Compile Include="LoadScreens\ModContentLoadScreen.cs" />
|
<Compile Include="LoadScreens\ModContentLoadScreen.cs" />
|
||||||
|
|||||||
@@ -30,9 +30,11 @@ V2RL:
|
|||||||
AttackFrontal:
|
AttackFrontal:
|
||||||
WithFacingSpriteBody:
|
WithFacingSpriteBody:
|
||||||
RequiresCondition: !reloading
|
RequiresCondition: !reloading
|
||||||
|
Name: loaded
|
||||||
WithFacingSpriteBody@EMPTY:
|
WithFacingSpriteBody@EMPTY:
|
||||||
RequiresCondition: reloading
|
RequiresCondition: reloading
|
||||||
Sequence: empty-idle
|
Sequence: empty-idle
|
||||||
|
Name: reloading
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
Explodes:
|
Explodes:
|
||||||
Weapon: V2Explode
|
Weapon: V2Explode
|
||||||
|
|||||||
@@ -111,16 +111,20 @@ NAFNCE:
|
|||||||
RequiresCondition: laserfence-direction-x && active-posts == 2
|
RequiresCondition: laserfence-direction-x && active-posts == 2
|
||||||
Type: laserfence
|
Type: laserfence
|
||||||
Sequence: enabled-x
|
Sequence: enabled-x
|
||||||
|
Name: x-enabled
|
||||||
WithWallSpriteBody@YENABLED:
|
WithWallSpriteBody@YENABLED:
|
||||||
RequiresCondition: laserfence-direction-y && active-posts == 2
|
RequiresCondition: laserfence-direction-y && active-posts == 2
|
||||||
Type: laserfence
|
Type: laserfence
|
||||||
Sequence: enabled-y
|
Sequence: enabled-y
|
||||||
|
Name: y-enabled
|
||||||
WithSpriteBody@XDISABLED:
|
WithSpriteBody@XDISABLED:
|
||||||
RequiresCondition: laserfence-direction-x && active-posts < 2
|
RequiresCondition: laserfence-direction-x && active-posts < 2
|
||||||
Sequence: disabled-x
|
Sequence: disabled-x
|
||||||
|
Name: x-disabled
|
||||||
WithSpriteBody@YDISABLED:
|
WithSpriteBody@YDISABLED:
|
||||||
RequiresCondition: laserfence-direction-y && active-posts < 2
|
RequiresCondition: laserfence-direction-y && active-posts < 2
|
||||||
Sequence: disabled-y
|
Sequence: disabled-y
|
||||||
|
Name: y-disabled
|
||||||
BlocksProjectiles:
|
BlocksProjectiles:
|
||||||
RequiresCondition: active-posts == 2
|
RequiresCondition: active-posts == 2
|
||||||
DamageMultiplier: # Prevent all normal damage, but still allows direct kills from the post
|
DamageMultiplier: # Prevent all normal damage, but still allows direct kills from the post
|
||||||
|
|||||||
Reference in New Issue
Block a user