diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index 0d68b0d84e..f8c5e82aa7 100644
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -181,7 +181,6 @@
-
diff --git a/OpenRA.Mods.Common/Effects/AreaBeam.cs b/OpenRA.Mods.Common/Effects/AreaBeam.cs
index fdfab6b91e..5e56cd5fd0 100644
--- a/OpenRA.Mods.Common/Effects/AreaBeam.cs
+++ b/OpenRA.Mods.Common/Effects/AreaBeam.cs
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Effects
target = args.PassiveTarget;
if (info.Inaccuracy.Length > 0)
{
- var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
+ var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
var maxOffset = inaccuracy * (target - headPos).Length / args.Weapon.Range.Length;
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
}
diff --git a/OpenRA.Mods.Common/Effects/Bullet.cs b/OpenRA.Mods.Common/Effects/Bullet.cs
index 16f7a2fb0e..f9681648de 100644
--- a/OpenRA.Mods.Common/Effects/Bullet.cs
+++ b/OpenRA.Mods.Common/Effects/Bullet.cs
@@ -116,8 +116,8 @@ namespace OpenRA.Mods.Common.Effects
target = args.PassiveTarget;
if (info.Inaccuracy.Length > 0)
{
- var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
- var range = OpenRA.Traits.Util.ApplyPercentageModifiers(args.Weapon.Range.Length, args.RangeModifiers);
+ var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
+ var range = Util.ApplyPercentageModifiers(args.Weapon.Range.Length, args.RangeModifiers);
var maxOffset = inaccuracy * (target - pos).Length / range;
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
}
diff --git a/OpenRA.Mods.Common/Effects/Missile.cs b/OpenRA.Mods.Common/Effects/Missile.cs
index 0822fe791f..729b9a2923 100644
--- a/OpenRA.Mods.Common/Effects/Missile.cs
+++ b/OpenRA.Mods.Common/Effects/Missile.cs
@@ -14,6 +14,7 @@ using System.Linq;
using OpenRA.Effects;
using OpenRA.GameRules;
using OpenRA.Graphics;
+using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
@@ -200,7 +201,7 @@ namespace OpenRA.Mods.Common.Effects
if (info.Inaccuracy.Length > 0)
{
- var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
+ var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
offset = WVec.FromPDF(world.SharedRandom, 2) * inaccuracy / 1024;
}
@@ -723,8 +724,8 @@ namespace OpenRA.Mods.Common.Effects
desiredHFacing = hFacing;
// Compute new direction the projectile will be facing
- hFacing = OpenRA.Traits.Util.TickFacing(hFacing, desiredHFacing, info.HorizontalRateOfTurn);
- vFacing = OpenRA.Traits.Util.TickFacing(vFacing, desiredVFacing, info.VerticalRateOfTurn);
+ hFacing = Util.TickFacing(hFacing, desiredHFacing, info.HorizontalRateOfTurn);
+ vFacing = Util.TickFacing(vFacing, desiredVFacing, info.VerticalRateOfTurn);
// Compute the projectile's guided displacement
return new WVec(0, -1024 * speed, 0)
diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
index b008fa7fce..024d25ae86 100644
--- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
+++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
@@ -237,7 +237,7 @@ namespace OpenRA.Mods.Common.Graphics
protected virtual Sprite GetSprite(int start, int frame, int facing)
{
- var f = OpenRA.Traits.Util.QuantizeFacing(facing, Facings);
+ var f = Util.QuantizeFacing(facing, Facings);
if (reverseFacings)
f = (Facings - f) % Facings;
diff --git a/OpenRA.Mods.Common/Graphics/VoxelRenderable.cs b/OpenRA.Mods.Common/Graphics/VoxelRenderable.cs
index 5268e46edc..d6ea10794d 100644
--- a/OpenRA.Mods.Common/Graphics/VoxelRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/VoxelRenderable.cs
@@ -144,19 +144,19 @@ namespace OpenRA.Mods.Common.Graphics
// Draw voxel bounding box
var draw = voxel.voxels.Where(v => v.DisableFunc == null || !v.DisableFunc());
- var scaleTransform = Util.ScaleMatrix(voxel.scale, voxel.scale, voxel.scale);
- var cameraTransform = Util.MakeFloatMatrix(voxel.camera.AsMatrix());
+ var scaleTransform = OpenRA.Graphics.Util.ScaleMatrix(voxel.scale, voxel.scale, voxel.scale);
+ var cameraTransform = OpenRA.Graphics.Util.MakeFloatMatrix(voxel.camera.AsMatrix());
foreach (var v in draw)
{
var bounds = v.Voxel.Bounds(v.FrameFunc());
var worldTransform = v.RotationFunc().Reverse().Aggregate(scaleTransform,
- (x, y) => Util.MatrixMultiply(x, Util.MakeFloatMatrix(y.AsMatrix())));
+ (x, y) => OpenRA.Graphics.Util.MatrixMultiply(x, OpenRA.Graphics.Util.MakeFloatMatrix(y.AsMatrix())));
float sx, sy, sz;
wr.ScreenVectorComponents(v.OffsetFunc(), out sx, out sy, out sz);
var pxPos = pxOrigin + new float2(sx, sy);
- var screenTransform = Util.MatrixMultiply(cameraTransform, worldTransform);
+ var screenTransform = OpenRA.Graphics.Util.MatrixMultiply(cameraTransform, worldTransform);
DrawBoundsBox(pxPos, screenTransform, bounds, iz, Color.Yellow);
}
}
@@ -171,7 +171,7 @@ namespace OpenRA.Mods.Common.Graphics
for (var i = 0; i < 8; i++)
{
var vec = new float[] { bounds[CornerXIndex[i]], bounds[CornerYIndex[i]], bounds[CornerZIndex[i]], 1 };
- var screen = Util.MatrixVectorMultiply(transform, vec);
+ var screen = OpenRA.Graphics.Util.MatrixVectorMultiply(transform, vec);
corners[i] = pxPos + new float2(screen[0], screen[1]);
}
@@ -192,8 +192,8 @@ namespace OpenRA.Mods.Common.Graphics
{
var pxOrigin = wr.ScreenPosition(voxel.pos);
var draw = voxel.voxels.Where(v => v.DisableFunc == null || !v.DisableFunc());
- var scaleTransform = Util.ScaleMatrix(voxel.scale, voxel.scale, voxel.scale);
- var cameraTransform = Util.MakeFloatMatrix(voxel.camera.AsMatrix());
+ var scaleTransform = OpenRA.Graphics.Util.ScaleMatrix(voxel.scale, voxel.scale, voxel.scale);
+ var cameraTransform = OpenRA.Graphics.Util.MakeFloatMatrix(voxel.camera.AsMatrix());
var minX = float.MaxValue;
var minY = float.MaxValue;
@@ -203,17 +203,17 @@ namespace OpenRA.Mods.Common.Graphics
{
var bounds = v.Voxel.Bounds(v.FrameFunc());
var worldTransform = v.RotationFunc().Reverse().Aggregate(scaleTransform,
- (x, y) => Util.MatrixMultiply(x, Util.MakeFloatMatrix(y.AsMatrix())));
+ (x, y) => OpenRA.Graphics.Util.MatrixMultiply(x, OpenRA.Graphics.Util.MakeFloatMatrix(y.AsMatrix())));
float sx, sy, sz;
wr.ScreenVectorComponents(v.OffsetFunc(), out sx, out sy, out sz);
var pxPos = pxOrigin + new float2(sx, sy);
- var screenTransform = Util.MatrixMultiply(cameraTransform, worldTransform);
+ var screenTransform = OpenRA.Graphics.Util.MatrixMultiply(cameraTransform, worldTransform);
for (var i = 0; i < 8; i++)
{
var vec = new float[] { bounds[CornerXIndex[i]], bounds[CornerYIndex[i]], bounds[CornerZIndex[i]], 1 };
- var screen = Util.MatrixVectorMultiply(screenTransform, vec);
+ var screen = OpenRA.Graphics.Util.MatrixVectorMultiply(screenTransform, vec);
minX = Math.Min(minX, pxPos.X + screen[0]);
minY = Math.Min(minY, pxPos.Y + screen[1]);
maxX = Math.Max(maxX, pxPos.X + screen[0]);
diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 3ba155026b..50bd7c0bb0 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -730,6 +730,7 @@
+
diff --git a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs
index dff98deb88..d762c73dbe 100644
--- a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs
+++ b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs
@@ -15,7 +15,7 @@ using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
-using Util = OpenRA.Traits.Util;
+using OpenRA.Traits;
namespace OpenRA.Mods.Common.Orders
{
diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs
index ca088c5ba0..fe9d8ae00e 100644
--- a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs
+++ b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.Traits
var sequence = a.Info.MuzzleSequence;
if (a.Info.MuzzleSplitFacings > 0)
- sequence += OpenRA.Traits.Util.QuantizeFacing(muzzleFacing, a.Info.MuzzleSplitFacings).ToString();
+ sequence += Util.QuantizeFacing(muzzleFacing, a.Info.MuzzleSplitFacings).ToString();
var muzzleFlash = new AnimationWithOffset(muzzleAnim,
() => PortOffset(self, port),
diff --git a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs
index 5fb5e2d606..117f3911df 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithMuzzleOverlay.cs
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
return;
if (a.Info.MuzzleSplitFacings > 0)
- sequence += OpenRA.Traits.Util.QuantizeFacing(getFacing(), a.Info.MuzzleSplitFacings).ToString();
+ sequence += Util.QuantizeFacing(getFacing(), a.Info.MuzzleSplitFacings).ToString();
if (barrel == null)
return;
diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs
index 56df270a66..41f2f696ad 100644
--- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs
+++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs
@@ -190,14 +190,14 @@ namespace OpenRA.Mods.Common.Traits
void UpdateNeighbours(IReadOnlyDictionary footprint)
{
// Include actors inside the footprint too
- var cells = OpenRA.Traits.Util.ExpandFootprint(footprint.Keys, true);
+ var cells = Util.ExpandFootprint(footprint.Keys, true);
foreach (var p in cells.SelectMany(c => PreviewsAt(c)))
p.ReplaceInit(new RuntimeNeighbourInit(NeighbouringPreviews(p.Footprint)));
}
Dictionary NeighbouringPreviews(IReadOnlyDictionary footprint)
{
- var cells = OpenRA.Traits.Util.ExpandFootprint(footprint.Keys, true).Except(footprint.Keys);
+ var cells = Util.ExpandFootprint(footprint.Keys, true).Except(footprint.Keys);
return cells.ToDictionary(c => c, c => PreviewsAt(c).Select(p => p.Info.Name).ToArray());
}
diff --git a/OpenRA.Game/Traits/Util.cs b/OpenRA.Mods.Common/Util.cs
similarity index 97%
rename from OpenRA.Game/Traits/Util.cs
rename to OpenRA.Mods.Common/Util.cs
index 5d6b899cb3..032772049d 100644
--- a/OpenRA.Game/Traits/Util.cs
+++ b/OpenRA.Mods.Common/Util.cs
@@ -10,12 +10,11 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
-using OpenRA.Activities;
using OpenRA.Support;
+using OpenRA.Traits;
-namespace OpenRA.Traits
+namespace OpenRA.Mods.Common
{
public static class Util
{
diff --git a/OpenRA.Mods.D2k/Activities/DeliverUnit.cs b/OpenRA.Mods.D2k/Activities/DeliverUnit.cs
index 1e59cc1839..c213220765 100644
--- a/OpenRA.Mods.D2k/Activities/DeliverUnit.cs
+++ b/OpenRA.Mods.D2k/Activities/DeliverUnit.cs
@@ -9,6 +9,7 @@
#endregion
using OpenRA.Activities;
+using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.D2k.Traits;