Introduce OnDiscovered and OnPlayerDiscovered Lua triggers
This commit is contained in:
@@ -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.")]
|
||||
|
||||
Reference in New Issue
Block a user