From 603e7ca408c9775c75c1313f20dc7357688f9030 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 12 Feb 2017 18:55:15 +0100 Subject: [PATCH] Add a lua function to query the terrain type of a cell --- OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs index 106e36add7..6ba54ea926 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs @@ -101,6 +101,12 @@ namespace OpenRA.Mods.Common.Scripting return Context.World.Map.CenterOfCell(cell); } + [Desc("Returns the type of the terrain at the target cell.")] + public string TerrainType(CPos cell) + { + return Context.World.Map.GetTerrainInfo(cell).Type; + } + [Desc("Returns true if there is only one human player.")] public bool IsSinglePlayer { get { return Context.World.LobbyInfo.IsSinglePlayer; } }