new Filters()
A class-factory for entity-collections using filters.
- Source:
- filters.js, line 9
| .byClass(cls) → {API3.Filter} | Creates a filtering by class tag. |
| .byType(type) → {API3.Filter} | Creates a filtering by entity type (template). |
Methods
-
<static> byClass(cls) → {API3.Filter}
Creates a filtering by class tag.
-
A class tag is an identifier which describes a category of entities. These tags are defined at the template level and cannot be changed by the AI.
Parameters:
cls: StringThe name of an entity class to match, e.g. "worker"- Source:
- filters.js, line 38
Returns:
A filter object which selects only those entities belonging to the specified class.- Type
- API3.Filter
-
<static> byType(type) → {API3.Filter}
Creates a filtering by entity type (template).
-
Parameters:
type: StringThe instantiated name of an entity template, e.g. "units/viking_longboat".- Source:
- filters.js, line 19
Returns:
A filter object which selects entities of the specified template type.- Type
- API3.Filter