Merge pull request #10975 from Phrohdoh/trait-taggable

Add ScriptTags trait
This commit is contained in:
abcdefg30
2016-03-31 01:09:29 +02:00
4 changed files with 89 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using Eluant;
using OpenRA.Mods.Common.Traits;
@@ -126,5 +127,11 @@ namespace OpenRA.Mods.Common.Scripting
{
return actor.ActorID <= sma.LastMapActorID && actor.ActorID > sma.LastMapActorID - sma.Actors.Count;
}
[Desc("Returns a table of all actors tagged with the given string.")]
public Actor[] ActorsWithTag(string tag)
{
return Context.World.ActorsHavingTrait<ScriptTags>(t => t.HasTag(tag)).ToArray();
}
}
}