Add ScriptTags trait
This allows actors to be tagged with arbitrary strings. Also includes ScriptTagsInit and MapGlobal.ActorsWithTag which expose this functionality to map scripters.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -113,5 +114,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user