diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 374ce1713f..2c66eb7845 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -406,7 +406,6 @@
-
@@ -427,6 +426,7 @@
+
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderBuildingCharge.cs b/OpenRA.Mods.Common/Traits/Render/RenderBuildingCharge.cs
deleted file mode 100644
index f1f5104620..0000000000
--- a/OpenRA.Mods.Common/Traits/Render/RenderBuildingCharge.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region Copyright & License Information
-/*
- * Copyright 2007-2015 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. For more information,
- * see COPYING.
- */
-#endregion
-
-using OpenRA.Traits;
-
-namespace OpenRA.Mods.Common.Traits
-{
- [Desc("Used for tesla coil and obelisk.")]
- public class RenderBuildingChargeInfo : RenderBuildingInfo
- {
- [Desc("Sequence to use for building charge animation.")]
- [SequenceReference] public readonly string ChargeSequence = "active";
-
- public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); }
- }
-
- public class RenderBuildingCharge : RenderBuilding, INotifyCharging
- {
- RenderBuildingChargeInfo info;
-
- public RenderBuildingCharge(ActorInitializer init, RenderBuildingChargeInfo info)
- : base(init, info)
- {
- this.info = info;
- }
-
- public void Charging(Actor self, Target target)
- {
- PlayCustomAnim(self, info.ChargeSequence);
- }
- }
-}
diff --git a/OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs
new file mode 100644
index 0000000000..b48b9733d2
--- /dev/null
+++ b/OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs
@@ -0,0 +1,40 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2015 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. For more information,
+ * see COPYING.
+ */
+#endregion
+
+using OpenRA.Traits;
+
+namespace OpenRA.Mods.Common.Traits
+{
+ [Desc("This actor displays a charge-up animation before firing.")]
+ public class WithChargeAnimationInfo : ITraitInfo, Requires, Requires
+ {
+ [Desc("Sequence to use for charge animation.")]
+ [SequenceReference] public readonly string ChargeSequence = "active";
+
+ public object Create(ActorInitializer init) { return new WithChargeAnimation(init, this); }
+ }
+
+ public class WithChargeAnimation : INotifyCharging
+ {
+ readonly WithChargeAnimationInfo info;
+ readonly WithSpriteBody wsb;
+
+ public WithChargeAnimation(ActorInitializer init, WithChargeAnimationInfo info)
+ {
+ this.info = info;
+ wsb = init.Self.Trait();
+ }
+
+ public void Charging(Actor self, Target target)
+ {
+ wsb.PlayCustomAnimation(self, info.ChargeSequence);
+ }
+ }
+}
diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
index 7ff22a81a2..c78ed091fd 100644
--- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
+++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs
@@ -1810,6 +1810,39 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
+ if (engineVersion < 20150826)
+ {
+ // Replaced RenderBuildingCharge with RenderSprites + WithSpriteBody + WithChargeAnimation (+AutoSelectionSize)
+ if (depth == 0)
+ {
+ var childKeySequence = new[] { "ChargeSequence" };
+ var childKeysExcludeFromRS = new[] { "Sequence", "ChargeSequence", "PauseOnLowPower" };
+
+ var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuildingCharge"));
+ if (rb != null)
+ {
+ rb.Key = "WithChargeAnimation";
+
+ var rsNodes = rb.Value.Nodes.Where(n => !childKeysExcludeFromRS.Contains(n.Key)).ToList();
+ var wsbNodes = rb.Value.Nodes.Where(n => childKeySequence.Contains(n.Key)).ToList();
+
+ if (rsNodes.Any())
+ node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes)));
+ else
+ node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", ""));
+
+ node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", ""));
+
+ rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n));
+ rb.Value.Nodes.RemoveAll(n => wsbNodes.Contains(n));
+ }
+
+ var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuildingCharge"));
+ if (rrb != null)
+ rrb.Key = "-WithChargeAnimation";
+ }
+ }
+
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}
diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml
index ad7a68d28d..4f311e3596 100644
--- a/mods/cnc/rules/structures.yaml
+++ b/mods/cnc/rules/structures.yaml
@@ -730,7 +730,9 @@ OBLI:
Range: 8c0
Bib:
HasMinibib: Yes
- RenderBuildingCharge:
+ RenderSprites:
+ WithSpriteBody:
+ WithChargeAnimation:
Armament:
Weapon: Laser
LocalOffset: 0,0,725
@@ -745,6 +747,7 @@ OBLI:
Range: 5
Power:
Amount: -150
+ -WithMakeAnimation:
GTWR:
Inherits: ^Defense
diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml
index fb4105f562..2922c4f633 100644
--- a/mods/ra/rules/structures.yaml
+++ b/mods/ra/rules/structures.yaml
@@ -401,7 +401,9 @@ TSLA:
Range: 8c0
Bib:
HasMinibib: Yes
- RenderBuildingCharge:
+ RenderSprites:
+ WithSpriteBody:
+ WithChargeAnimation:
Armament:
Weapon: TeslaZap
LocalOffset: 0,0,427
@@ -415,6 +417,7 @@ TSLA:
DetectCloaked:
Range: 8
ProvidesPrerequisite@buildingname:
+ -WithMakeAnimation:
AGUN:
Inherits: ^Defense