diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 25653a76b8..3397a472f7 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -402,6 +402,7 @@
+
diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs
index 008d8d6ce3..b36c0da401 100644
--- a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs
+++ b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs
@@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits
() => PortOffset(self, port),
() => false,
() => false,
- p => WithTurret.ZOffsetFromCenter(self, p, 1024));
+ p => RenderUtils.ZOffsetFromCenter(self, p, 1024));
muzzles.Add(muzzleFlash);
muzzleAnim.PlayThen(sequence, () => muzzles.Remove(muzzleFlash));
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderUtils.cs b/OpenRA.Mods.Common/Traits/Render/RenderUtils.cs
new file mode 100644
index 0000000000..6632719ecb
--- /dev/null
+++ b/OpenRA.Mods.Common/Traits/Render/RenderUtils.cs
@@ -0,0 +1,23 @@
+#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
+{
+ public class RenderUtils
+ {
+ public static int ZOffsetFromCenter(Actor self, WPos pos, int offset)
+ {
+ var delta = self.CenterPosition - pos;
+ return delta.Y + delta.Z + offset;
+ }
+ }
+}
diff --git a/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs
index b5461f15e7..5bc15e1852 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => turreted.TurretFacing);
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
rs.Add(new AnimationWithOffset(
- DefaultAnimation, () => BarrelOffset(), () => IsTraitDisabled, () => false, p => WithTurret.ZOffsetFromCenter(self, p, 0)));
+ DefaultAnimation, () => BarrelOffset(), () => IsTraitDisabled, () => false, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
// Restrict turret facings to match the sprite
turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs
index ff17176474..a3cad29148 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
() => IsTraitDisabled || !buildComplete,
() => (info.PauseOnLowPower && self.IsDisabled()) || !buildComplete,
- p => WithTurret.ZOffsetFromCenter(self, p, 1));
+ p => RenderUtils.ZOffsetFromCenter(self, p, 1));
rs.Add(anim, info.Palette, info.IsPlayerPalette);
}
diff --git a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs
index 8de5835859..0acff4e932 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
() => info.IgnoreOffset ? WVec.Zero : armClosure.MuzzleOffset(self, barrel),
() => IsTraitDisabled || !visible[barrel],
() => false,
- p => WithTurret.ZOffsetFromCenter(self, p, 2)));
+ p => RenderUtils.ZOffsetFromCenter(self, p, 2)));
}
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs
index bd43a7f7a0..bddf9ec297 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Traits
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
() => IsTraitDisabled && !renderProlonged,
() => false,
- p => WithTurret.ZOffsetFromCenter(self, p, 1));
+ p => RenderUtils.ZOffsetFromCenter(self, p, 1));
var rs = self.Trait();
rs.Add(anim, info.Palette);
diff --git a/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs
index b270703063..3bbb52a100 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
() => !visible || !buildComplete,
() => info.PauseOnLowPower && self.IsDisabled(),
- p => WithTurret.ZOffsetFromCenter(self, p, 1));
+ p => RenderUtils.ZOffsetFromCenter(self, p, 1));
rs.Add(anim, info.Palette, info.IsPlayerPalette);
}
diff --git a/OpenRA.Mods.Common/Traits/Render/WithTurret.cs b/OpenRA.Mods.Common/Traits/Render/WithTurret.cs
index e5089c1f13..47140634fa 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithTurret.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithTurret.cs
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => t.TurretFacing);
DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence));
rs.Add(new AnimationWithOffset(
- DefaultAnimation, () => TurretOffset(self), () => IsTraitDisabled, () => false, p => ZOffsetFromCenter(self, p, 1)));
+ DefaultAnimation, () => TurretOffset(self), () => IsTraitDisabled, () => false, p => RenderUtils.ZOffsetFromCenter(self, p, 1)));
// Restrict turret facings to match the sprite
t.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
@@ -116,11 +116,5 @@ namespace OpenRA.Mods.Common.Traits
var sequence = Attack.IsAttacking ? Info.AimSequence : Info.Sequence;
DefaultAnimation.ReplaceAnim(sequence);
}
-
- public static int ZOffsetFromCenter(Actor self, WPos pos, int offset)
- {
- var delta = self.CenterPosition - pos;
- return delta.Y + delta.Z + offset;
- }
}
}