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

@@ -24,7 +24,7 @@ Actor.Move = function(actor, location)
end
Actor.MoveNear = function(actor, location, nearEnough)
actor:QueueActivity(OpenRA.New("Move", { location, Map.GetWRangeFromCells(nearEnough) }))
actor:QueueActivity(OpenRA.New("Move", { location, WRange.FromCells(nearEnough) }))
end
Actor.ScriptedMove = function(actor, location)
@@ -35,6 +35,10 @@ Actor.Teleport = function(actor, location)
actor:QueueActivity(OpenRA.New("SimpleTeleport", { location }))
end
Actor.AttackMove = function(actor, location)
Internal.AttackMove(actor, location)
end
Actor.HeliFly = function(actor, position)
actor:QueueActivity(OpenRA.New("HeliFly", { position }))
end
@@ -119,6 +123,10 @@ Actor.Facing = function(actor)
return Actor.Trait(actor, "IFacing"):get_Facing()
end
Actor.IsIdle = function(actor)
return actor.IsIdle
end
Actor.SetStance = function(actor, stance)
Internal.SetUnitStance(actor, stance)
end
@@ -135,6 +143,14 @@ Actor.OnRemovedFromWorld = function(actor, eh)
Actor.Trait(actor, "LuaScriptEvents").OnRemovedFromWorld:Add(eh)
end
Actor.ActorsWithTrait = function(className)
local ret = { }
for item in Utils.Enumerate(Internal.ActorsWithTrait(className)) do
table.insert(ret, item.Actor)
end
return ret
end
Actor.HasTrait = function(actor, className)
return Internal.HasTrait(actor, className)
end