Introduce OnDiscovered and OnPlayerDiscovered Lua triggers

This commit is contained in:
penev92
2015-02-22 22:36:05 +02:00
parent 79c53e3981
commit 16dee554c4
2 changed files with 51 additions and 2 deletions

View File

@@ -406,6 +406,20 @@ namespace OpenRA.Mods.Common.Scripting
GetScriptTriggers(a).RegisterCallback(Trigger.OnInfiltrated, func, Context);
}
[Desc("Call a function when this actor is discovered by an enemy or a player with a Neutral stance. " +
"The callback function will be called as func(Actor discovered, Player discoverer)")]
public void OnDiscovered(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnDiscovered, func, Context);
}
[Desc("Call a function when this player is discovered by an enemy or neutral player. " +
"The callback function will be called as func(Player discovered, Player discoverer, Actor discoveredActor)")]
public void OnPlayerDiscovered(Player discovered, LuaFunction func)
{
GetScriptTriggers(discovered.PlayerActor).RegisterCallback(Trigger.OnPlayerDiscovered, func, Context);
}
[Desc("Removes all triggers from this actor." +
"Note that the removal will only take effect at the end of a tick, " +
"so you must not add new triggers at the same time that you are calling this function.")]