Rename and move WithTurretedSpriteBody

The name wasn't in line with our implicit naming convention and ambigous on top of that.
Also, only used by RA and TD so moved to Mods.Cnc.
This commit is contained in:
reaperrr
2017-07-11 06:41:29 +02:00
committed by Paul Chote
parent c611b5aeeb
commit dbcfb0c92e
7 changed files with 19 additions and 12 deletions

View File

@@ -67,6 +67,7 @@
<Compile Include="Traits\Attack\AttackPopupTurreted.cs" /> <Compile Include="Traits\Attack\AttackPopupTurreted.cs" />
<Compile Include="Traits\Buildings\ProductionAirdrop.cs" /> <Compile Include="Traits\Buildings\ProductionAirdrop.cs" />
<Compile Include="Traits\Render\WithGunboatBody.cs" /> <Compile Include="Traits\Render\WithGunboatBody.cs" />
<Compile Include="Traits\Render\WithEmbeddedTurretSpriteBody.cs" />
<Compile Include="Traits\Render\WithCargo.cs" /> <Compile Include="Traits\Render\WithCargo.cs" />
<Compile Include="Traits\Render\WithDeliveryAnimation.cs" /> <Compile Include="Traits\Render\WithDeliveryAnimation.cs" />
<Compile Include="Traits\Render\WithReloadingSpriteTurret.cs" /> <Compile Include="Traits\Render\WithReloadingSpriteTurret.cs" />

View File

@@ -10,6 +10,7 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Mods.Cnc.Traits.Render;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Traits.Render; using OpenRA.Mods.Common.Traits.Render;
using OpenRA.Traits; using OpenRA.Traits;
@@ -17,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits namespace OpenRA.Mods.Cnc.Traits
{ {
[Desc("Actor's turret rises from the ground before attacking.")] [Desc("Actor's turret rises from the ground before attacking.")]
class AttackPopupTurretedInfo : AttackTurretedInfo, Requires<BuildingInfo>, Requires<WithTurretedSpriteBodyInfo> class AttackPopupTurretedInfo : AttackTurretedInfo, Requires<BuildingInfo>, Requires<WithEmbeddedTurretSpriteBodyInfo>
{ {
[Desc("How many game ticks should pass before closing the actor's turret.")] [Desc("How many game ticks should pass before closing the actor's turret.")]
public int CloseDelay = 125; public int CloseDelay = 125;

View File

@@ -14,14 +14,16 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Traits.Render;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits.Render namespace OpenRA.Mods.Cnc.Traits.Render
{ {
[Desc("This actor has turret art with facings baked into the sprite.")] [Desc("This actor has turret art with facings baked into the sprite.")]
public class WithTurretedSpriteBodyInfo : WithSpriteBodyInfo, Requires<TurretedInfo>, Requires<BodyOrientationInfo> public class WithEmbeddedTurretSpriteBodyInfo : WithSpriteBodyInfo, Requires<TurretedInfo>, Requires<BodyOrientationInfo>
{ {
public override object Create(ActorInitializer init) { return new WithTurretedSpriteBody(init, this); } public override object Create(ActorInitializer init) { return new WithEmbeddedTurretSpriteBody(init, this); }
public override IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) public override IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{ {
@@ -36,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render
} }
} }
public class WithTurretedSpriteBody : WithSpriteBody public class WithEmbeddedTurretSpriteBody : WithSpriteBody
{ {
readonly Turreted turreted; readonly Turreted turreted;
@@ -47,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return () => turreted.TurretFacing; return () => turreted.TurretFacing;
} }
public WithTurretedSpriteBody(ActorInitializer init, WithSpriteBodyInfo info) public WithEmbeddedTurretSpriteBody(ActorInitializer init, WithSpriteBodyInfo info)
: base(init, info, MakeTurretFacingFunc(init.Self)) : base(init, info, MakeTurretFacingFunc(init.Self))
{ {
turreted = init.Self.TraitsImplementing<Turreted>().FirstOrDefault(); turreted = init.Self.TraitsImplementing<Turreted>().FirstOrDefault();

View File

@@ -418,7 +418,6 @@
<Compile Include="Traits\Render\LeavesTrails.cs" /> <Compile Include="Traits\Render\LeavesTrails.cs" />
<Compile Include="Traits\Render\RenderSpritesEditorOnly.cs" /> <Compile Include="Traits\Render\RenderSpritesEditorOnly.cs" />
<Compile Include="Traits\Render\WithTurretAttackAnimation.cs" /> <Compile Include="Traits\Render\WithTurretAttackAnimation.cs" />
<Compile Include="Traits\Render\WithTurretedSpriteBody.cs" />
<Compile Include="Traits\Render\RenderUtils.cs" /> <Compile Include="Traits\Render\RenderUtils.cs" />
<Compile Include="Traits\Render\RenderDebugState.cs" /> <Compile Include="Traits\Render\RenderDebugState.cs" />
<Compile Include="Traits\Render\RenderNameTag.cs" /> <Compile Include="Traits\Render\RenderNameTag.cs" />

View File

@@ -985,8 +985,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
} }
if (engineVersion < 20170915) if (engineVersion < 20170915)
{
if (node.Key.StartsWith("WithTurretedAttackAnimation", StringComparison.Ordinal)) if (node.Key.StartsWith("WithTurretedAttackAnimation", StringComparison.Ordinal))
RenameNodeKey(node, "WithTurretAttackAnimation"); RenameNodeKey(node, "WithTurretAttackAnimation");
if (node.Key.StartsWith("WithTurretedSpriteBody", StringComparison.Ordinal))
RenameNodeKey(node, "WithEmbeddedTurretSpriteBody");
}
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
} }

View File

@@ -761,7 +761,7 @@ GUN:
TurnSpeed: 12 TurnSpeed: 12
InitialFacing: 56 InitialFacing: 56
-WithSpriteBody: -WithSpriteBody:
WithTurretedSpriteBody: WithEmbeddedTurretSpriteBody:
Armament: Armament:
Weapon: TurretGun Weapon: TurretGun
LocalOffset: 512,0,112 LocalOffset: 512,0,112
@@ -811,7 +811,7 @@ SAM:
InitialFacing: 0 InitialFacing: 0
RealignDelay: -1 RealignDelay: -1
-WithSpriteBody: -WithSpriteBody:
WithTurretedSpriteBody: WithEmbeddedTurretSpriteBody:
AutoSelectionSize: AutoSelectionSize:
Armament: Armament:
Weapon: Dragon Weapon: Dragon

View File

@@ -548,7 +548,7 @@ AGUN:
TurnSpeed: 15 TurnSpeed: 15
InitialFacing: 224 InitialFacing: 224
-WithSpriteBody: -WithSpriteBody:
WithTurretedSpriteBody: WithEmbeddedTurretSpriteBody:
Armament: Armament:
Weapon: ZSU-23 Weapon: ZSU-23
LocalOffset: 520,100,450, 520,-150,450 LocalOffset: 520,100,450, 520,-150,450
@@ -751,7 +751,7 @@ GUN:
TurnSpeed: 12 TurnSpeed: 12
InitialFacing: 56 InitialFacing: 56
-WithSpriteBody: -WithSpriteBody:
WithTurretedSpriteBody: WithEmbeddedTurretSpriteBody:
Armament: Armament:
Weapon: TurretGun Weapon: TurretGun
LocalOffset: 512,0,112 LocalOffset: 512,0,112
@@ -848,7 +848,7 @@ SAM:
TurnSpeed: 30 TurnSpeed: 30
InitialFacing: 0 InitialFacing: 0
-WithSpriteBody: -WithSpriteBody:
WithTurretedSpriteBody: WithEmbeddedTurretSpriteBody:
Armament: Armament:
Weapon: Nike Weapon: Nike
LocalOffset: 0,0,320 LocalOffset: 0,0,320