From 098d69f120d76fd966bde3c8e736c18b7001b07c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 21 Apr 2015 01:09:32 +1200 Subject: [PATCH] Prevent resources from spawning on ramps. --- OpenRA.Game/Traits/World/ResourceType.cs | 1 + OpenRA.Mods.Common/Traits/World/ResourceLayer.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/OpenRA.Game/Traits/World/ResourceType.cs b/OpenRA.Game/Traits/World/ResourceType.cs index 0e5df25e93..19295ae009 100644 --- a/OpenRA.Game/Traits/World/ResourceType.cs +++ b/OpenRA.Game/Traits/World/ResourceType.cs @@ -31,6 +31,7 @@ namespace OpenRA.Traits public readonly string[] AllowedTerrainTypes = { }; public readonly bool AllowUnderActors = false; public readonly bool AllowUnderBuildings = false; + public readonly bool AllowOnRamps = false; public PipType PipColor = PipType.Yellow; diff --git a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs index 5f80af57b4..da226d769b 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs @@ -151,6 +151,14 @@ namespace OpenRA.Mods.Common.Traits if (!rt.Info.AllowUnderBuildings && buildingInfluence.GetBuildingAt(cell) != null) return false; + if (!rt.Info.AllowOnRamps) + { + var tile = world.Map.MapTiles.Value[cell]; + var tileInfo = world.TileSet.GetTileInfo(tile); + if (tileInfo != null && tileInfo.RampType > 0) + return false; + } + return true; }