Point out pitfalls in the Lua API documentation

This commit is contained in:
Oliver Brakmann
2014-10-20 09:22:06 +02:00
parent 35ccc79902
commit d1af36c189
2 changed files with 10 additions and 4 deletions

View File

@@ -285,13 +285,17 @@ namespace OpenRA.Mods.RA.Scripting
GetScriptTriggers(a).RegisterCallback(Trigger.OnInfiltrated, func, context); GetScriptTriggers(a).RegisterCallback(Trigger.OnInfiltrated, func, context);
} }
[Desc("Removes all triggers from this actor.")] [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.")]
public void ClearAll(Actor a) public void ClearAll(Actor a)
{ {
GetScriptTriggers(a).ClearAll(); GetScriptTriggers(a).ClearAll();
} }
[Desc("Removes the specified trigger from this actor.")] [Desc("Removes the specified trigger 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.")]
public void Clear(Actor a, string triggerName) public void Clear(Actor a, string triggerName)
{ {
var trigger = (Trigger)Enum.Parse(typeof(Trigger), triggerName); var trigger = (Trigger)Enum.Parse(typeof(Trigger), triggerName);

View File

@@ -145,7 +145,8 @@ namespace OpenRA.Mods.RA.Scripting
return true; return true;
} }
[Desc("Checks whether the factory is currently producing anything on the queue that produces this type of actor.")] [Desc("Check whether the factory's production queue that builds this type of actor is currently busy." +
"Note: it does not check whether this particular type of actor is being produced.")]
public bool IsProducing(string actorType) public bool IsProducing(string actorType)
{ {
if (triggers.Triggers[Trigger.OnProduction].Any()) if (triggers.Triggers[Trigger.OnProduction].Any())
@@ -249,7 +250,8 @@ namespace OpenRA.Mods.RA.Scripting
return true; return true;
} }
[Desc("Checks whether the player is currently producing anything on the queue that produces this type of actor.")] [Desc("Check whether the production queue that builds this type of actor is currently busy." +
"Note: it does not check whether this particular type of actor is being produced.")]
public bool IsProducing(string actorType) public bool IsProducing(string actorType)
{ {
var queue = GetBuildableInfo(actorType).Queue.First(); var queue = GetBuildableInfo(actorType).Queue.First();