Add OnCapture, OnAddedToWorld and OnRemovedFromWorld triggers to Lua API

This brings the new Lua API up to feature-parity with the old API in the
trigger department.
This commit is contained in:
Oliver Brakmann
2014-07-01 22:33:46 +02:00
parent 1c8a56d197
commit d23707b5f7
2 changed files with 60 additions and 2 deletions

View File

@@ -144,6 +144,27 @@ namespace OpenRA.Mods.RA.Scripting
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveFailed, func, context);
}
[Desc("Call a function when this actor is added to the world. " +
"The callback function will be called as func(Actor self).")]
public void OnAddedToWorld(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnAddedToWorld, func, context);
}
[Desc("Call a function when this actor is removed from the world. " +
"The callback function will be called as func(Actor self).")]
public void OnRemovedFromWorld(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnRemovedFromWorld, func, context);
}
[Desc("Call a function when this actor is captured. The callback function " +
"will be called as func(Actor self, Actor captor, Player oldOwner, Player newOwner).")]
public void OnCapture(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnCapture, func, context);
}
[Desc("Removes all triggers from this actor")]
public void ClearAll(Actor a)
{