Filter
List of component names for one filter (`!name` to reject, or `Components.reject`).
Require
Section titled “Require”If the concord folder is in the root directory of your game, you can import this module like so:
Filter = require('concord.filter')Filter
Section titled “Filter”Used to filter Entities with specific Components.
A Filter has an associated Pool that can contain any amount of Entities.
Filter(...) is equivalent to Filter.new(...).
Methods
Section titled “Methods”| Method | Description |
|---|---|
| Filter.validate | Validates a Filter Definition to make sure every component is valid. |
| Filter.parse | Parses a Filter Definition into a single interleaved table. |
| Filter.match | Returns true if the Entity matches a parsed Filter. |
| Filter.isValidPool | Checks that a custom Pool implements add, remove, has, and clear as callables. |
| Filter.new | Creates a new Filter |
| Filter:eligible | Checks if an Entity fulfills the Filter requirements. |
| Filter:evaluate | Evaluates an Entity against this Filter and updates the Pool. |
| Filter:add | Adds an Entity to the Pool, if it passes the Filter. |
| Filter:remove | Removes an Entity from the Pool associated to this Filter. |
| Filter:clear | Clears the Pool associated to this Filter. |
| Filter:has | Checks if the Pool associated to this Filter contains the passed Entity. |
| Filter:getName | Gets the name of the Filter |
| Type | Description |
|---|---|
| FilterDefinition | List of component names for one filter (!name to reject, or Components.reject). |
| Pool | Entity collection backing a Filter. Default instances are List; custom constructors must implement add, remove, has, and clear. |
| ParsedFilter | Interleaved component names and required flags from Filter.parse (name, required, …). |