From dbcfb0c92e07626e9316772e75445f8f3b5f2501 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 11 Jul 2017 06:41:29 +0200 Subject: [PATCH] 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. --- OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj | 1 + OpenRA.Mods.Cnc/Traits/Attack/AttackPopupTurreted.cs | 3 ++- .../Traits/Render/WithEmbeddedTurretSpriteBody.cs | 12 +++++++----- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 - OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 4 ++++ mods/cnc/rules/structures.yaml | 4 ++-- mods/ra/rules/structures.yaml | 6 +++--- 7 files changed, 19 insertions(+), 12 deletions(-) rename OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs => OpenRA.Mods.Cnc/Traits/Render/WithEmbeddedTurretSpriteBody.cs (82%) diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index 2067200577..59cb4a691c 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -67,6 +67,7 @@ + diff --git a/OpenRA.Mods.Cnc/Traits/Attack/AttackPopupTurreted.cs b/OpenRA.Mods.Cnc/Traits/Attack/AttackPopupTurreted.cs index ced8857a80..d29db4ad64 100644 --- a/OpenRA.Mods.Cnc/Traits/Attack/AttackPopupTurreted.cs +++ b/OpenRA.Mods.Cnc/Traits/Attack/AttackPopupTurreted.cs @@ -10,6 +10,7 @@ #endregion using System.Linq; +using OpenRA.Mods.Cnc.Traits.Render; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits.Render; using OpenRA.Traits; @@ -17,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits { [Desc("Actor's turret rises from the ground before attacking.")] - class AttackPopupTurretedInfo : AttackTurretedInfo, Requires, Requires + class AttackPopupTurretedInfo : AttackTurretedInfo, Requires, Requires { [Desc("How many game ticks should pass before closing the actor's turret.")] public int CloseDelay = 125; diff --git a/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs b/OpenRA.Mods.Cnc/Traits/Render/WithEmbeddedTurretSpriteBody.cs similarity index 82% rename from OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs rename to OpenRA.Mods.Cnc/Traits/Render/WithEmbeddedTurretSpriteBody.cs index 942ec05694..720993a14d 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs +++ b/OpenRA.Mods.Cnc/Traits/Render/WithEmbeddedTurretSpriteBody.cs @@ -14,14 +14,16 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Graphics; using OpenRA.Mods.Common.Graphics; +using OpenRA.Mods.Common.Traits; +using OpenRA.Mods.Common.Traits.Render; 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.")] - public class WithTurretedSpriteBodyInfo : WithSpriteBodyInfo, Requires, Requires + public class WithEmbeddedTurretSpriteBodyInfo : WithSpriteBodyInfo, Requires, Requires { - 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 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; @@ -47,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits.Render return () => turreted.TurretFacing; } - public WithTurretedSpriteBody(ActorInitializer init, WithSpriteBodyInfo info) + public WithEmbeddedTurretSpriteBody(ActorInitializer init, WithSpriteBodyInfo info) : base(init, info, MakeTurretFacingFunc(init.Self)) { turreted = init.Self.TraitsImplementing().FirstOrDefault(); diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 8b21715476..e43725e035 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -418,7 +418,6 @@ - diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 93ebda8359..a2e85c9064 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -985,8 +985,12 @@ namespace OpenRA.Mods.Common.UtilityCommands } if (engineVersion < 20170915) + { if (node.Key.StartsWith("WithTurretedAttackAnimation", StringComparison.Ordinal)) RenameNodeKey(node, "WithTurretAttackAnimation"); + if (node.Key.StartsWith("WithTurretedSpriteBody", StringComparison.Ordinal)) + RenameNodeKey(node, "WithEmbeddedTurretSpriteBody"); + } UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); } diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 1691b4ef55..f8829e0da2 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -761,7 +761,7 @@ GUN: TurnSpeed: 12 InitialFacing: 56 -WithSpriteBody: - WithTurretedSpriteBody: + WithEmbeddedTurretSpriteBody: Armament: Weapon: TurretGun LocalOffset: 512,0,112 @@ -811,7 +811,7 @@ SAM: InitialFacing: 0 RealignDelay: -1 -WithSpriteBody: - WithTurretedSpriteBody: + WithEmbeddedTurretSpriteBody: AutoSelectionSize: Armament: Weapon: Dragon diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 3cb31eab70..436f52cc07 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -548,7 +548,7 @@ AGUN: TurnSpeed: 15 InitialFacing: 224 -WithSpriteBody: - WithTurretedSpriteBody: + WithEmbeddedTurretSpriteBody: Armament: Weapon: ZSU-23 LocalOffset: 520,100,450, 520,-150,450 @@ -751,7 +751,7 @@ GUN: TurnSpeed: 12 InitialFacing: 56 -WithSpriteBody: - WithTurretedSpriteBody: + WithEmbeddedTurretSpriteBody: Armament: Weapon: TurretGun LocalOffset: 512,0,112 @@ -848,7 +848,7 @@ SAM: TurnSpeed: 30 InitialFacing: 0 -WithSpriteBody: - WithTurretedSpriteBody: + WithEmbeddedTurretSpriteBody: Armament: Weapon: Nike LocalOffset: 0,0,320