diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index d41cd7a7c4..5c6de4ce1a 100644
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -159,7 +159,6 @@
-
diff --git a/OpenRA.Game/Traits/World/ResourceType.cs b/OpenRA.Game/Traits/World/ResourceType.cs
index 6bdbb4f582..c6927a97a4 100644
--- a/OpenRA.Game/Traits/World/ResourceType.cs
+++ b/OpenRA.Game/Traits/World/ResourceType.cs
@@ -28,6 +28,7 @@ namespace OpenRA.Traits
public readonly string[] AllowedTerrainTypes = { };
public readonly bool AllowUnderActors = false;
+ public readonly bool AllowUnderBuildings = false;
public PipType PipColor = PipType.Yellow;
diff --git a/OpenRA.Mods.Cnc/PoisonedByTiberium.cs b/OpenRA.Mods.Cnc/PoisonedByTiberium.cs
index d2287918be..8c8c13aa1c 100644
--- a/OpenRA.Mods.Cnc/PoisonedByTiberium.cs
+++ b/OpenRA.Mods.Cnc/PoisonedByTiberium.cs
@@ -10,6 +10,7 @@
using System.Linq;
using OpenRA.Traits;
+using OpenRA.Mods.RA;
namespace OpenRA.Mods.Cnc
{
diff --git a/OpenRA.Mods.D2k/D2kResourceLayer.cs b/OpenRA.Mods.D2k/D2kResourceLayer.cs
index 7438e1948a..5484ef9008 100644
--- a/OpenRA.Mods.D2k/D2kResourceLayer.cs
+++ b/OpenRA.Mods.D2k/D2kResourceLayer.cs
@@ -11,8 +11,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using OpenRA.Mods.RA;
+using OpenRA.Traits;
-namespace OpenRA.Traits
+namespace OpenRA.Mods.D2k
{
public class D2kResourceLayerInfo : TraitInfo { }
diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs
index e95b277c30..df94f6de89 100644
--- a/OpenRA.Mods.RA/Crate.cs
+++ b/OpenRA.Mods.RA/Crate.cs
@@ -96,7 +96,8 @@ namespace OpenRA.Mods.RA
if (!info.TerrainTypes.Contains(type))
return false;
- if (self.World.WorldActor.Trait().GetBuildingAt(cell) != null) return false;
+ if (self.World.WorldActor.Trait().GetBuildingAt(cell) != null)
+ return false;
if (!checkTransientActors)
return true;
diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
index d60a95b5ce..19a2a6bd9d 100644
--- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
+++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
@@ -520,6 +520,7 @@
+
diff --git a/OpenRA.Game/Traits/World/ResourceLayer.cs b/OpenRA.Mods.RA/World/ResourceLayer.cs
similarity index 93%
rename from OpenRA.Game/Traits/World/ResourceLayer.cs
rename to OpenRA.Mods.RA/World/ResourceLayer.cs
index 357c11339a..02eac34b10 100644
--- a/OpenRA.Game/Traits/World/ResourceLayer.cs
+++ b/OpenRA.Mods.RA/World/ResourceLayer.cs
@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
- * Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
+ * Copyright 2007-2014 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,
@@ -12,9 +12,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
+using OpenRA.Mods.RA.Buildings;
+using OpenRA.Traits;
-namespace OpenRA.Traits
+namespace OpenRA.Mods.RA
{
+ [Desc("Attach this to the world actor.")]
public class ResourceLayerInfo : TraitInfo, Requires { }
public class ResourceLayer : IRenderOverlay, IWorldLoaded, ITickRender
@@ -22,6 +25,9 @@ namespace OpenRA.Traits
static readonly CellContents EmptyCell = new CellContents();
World world;
+
+ BuildingInfluence buildingInfluence;
+
protected CellLayer content;
protected CellLayer render;
List dirty;
@@ -54,6 +60,9 @@ namespace OpenRA.Traits
public void WorldLoaded(World w, WorldRenderer wr)
{
this.world = w;
+
+ buildingInfluence = world.WorldActor.Trait();
+
content = new CellLayer(w.Map);
render = new CellLayer(w.Map);
dirty = new List();
@@ -139,6 +148,9 @@ namespace OpenRA.Traits
if (!rt.Info.AllowUnderActors && world.ActorMap.AnyUnitsAt(cell))
return false;
+ if (!rt.Info.AllowUnderBuildings && buildingInfluence.GetBuildingAt(cell) != null)
+ return false;
+
return true;
}