Add CPos.New etc functions to Lua standard library and helpers to LuaScriptInterface.cs. Rename Team.Create to Team.New.

This commit is contained in:
ScottNZ
2013-12-16 19:01:54 +13:00
parent 8e9835f2fa
commit b2e9de810e
9 changed files with 117 additions and 22 deletions

View File

@@ -4,6 +4,44 @@ Map.GetFacing = function(vec, currentFacing)
return Internal.GetFacing(vec, currentFacing)
end
Map.GetWRangeFromCells = function(cells)
return Internal.GetWRangeFromCells(cells)
end
Map.GetRandomCell = function()
return Internal.GetRandomCell()
end
Map.GetRandomEdgeCell = function()
return Internal.GetRandomEdgeCell()
end
CPos.New = function(x, y)
return OpenRA.New("CPos", { { x, "Int32" }, { y, "Int32" } })
end
WPos.New = function(x, y, z)
if z == nil then
z = 0
end
return OpenRA.New("WPos", { { x, "Int32" }, { y, "Int32" }, { z, "Int32" } })
end
WPos.FromCPos = function(location)
return WPos.New(location.X * 1024, location.Y * 1024, 0)
end
CVec.New = function(x, y)
return OpenRA.New("CVec", { { x, "Int32" }, { y, "Int32" } })
end
WVec.New = function(x, y, z)
if z == nil then
z = 0
end
return OpenRA.New("WVec", { { x, "Int32" }, { y, "Int32" }, { z, "Int32" } })
end
WRange.New = function(r)
return OpenRA.New("WRange", { { r, "Int32" } })
end
WRange.FromCells = function(cells)
return WRange.New(cells * 1024)
end