mirror of
https://github.com/Reuh/ubiquitousse.git
synced 2025-10-27 17:19:31 +00:00
ecs: add callbackFiltered and emitFiltered
This commit is contained in:
parent
bd28610ff4
commit
aa332a0adf
20 changed files with 697 additions and 568 deletions
|
|
@ -323,10 +323,18 @@ end
|
|||
<td class="summary">Trigger a custom callback on a single entity.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#System:callbackFiltered">System:callbackFiltered (filter, name, e, ...)</a></td>
|
||||
<td class="summary">Same as <a href="../modules/ecs.html#System:callback">callback</a>, but will check every system against a filter before calling the callback.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#System:emit">System:emit (name, ...)</a></td>
|
||||
<td class="summary">Emit an event on the system.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#System:emitFiltered">System:emitFiltered (filter, name, ...)</a></td>
|
||||
<td class="summary">Same as <a href="../modules/ecs.html#System:emit">emit</a>, but will check every system against a filter before calling the event.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#System:destroy">System:destroy ()</a></td>
|
||||
<td class="summary">Remove all the entities and subsystems in this system.</td>
|
||||
</tr>
|
||||
|
|
@ -1799,6 +1807,48 @@ avoid repeating your filters or allow controlling several system from a single p
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "System:callbackFiltered"></a>
|
||||
<strong>System:callbackFiltered (filter, name, e, ...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Same as <a href="../modules/ecs.html#System:callback">callback</a>, but will check every system against a filter before calling the callback. </p>
|
||||
|
||||
<p> <a href="../modules/ecs.html#System:filter">filter</a> is a function that receive the arguments <code>filter(system, name, e, …)</code>, and returns a boolean.
|
||||
It will be called on each system before emitting the callback on it; if the filter returns false, the callback will not
|
||||
be called on this system and its subsystems.</p>
|
||||
|
||||
<p> Complexity: O(1) per system
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">filter</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
filter function
|
||||
</li>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
name of the callback
|
||||
</li>
|
||||
<li><span class="parameter">e</span>
|
||||
<span class="types"><a class="type" href="../modules/ecs.html#Entity_objects">Entity</a></span>
|
||||
the entity to perform the callback on
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
other arguments to pass to the callback
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "System:emit"></a>
|
||||
|
|
@ -1849,6 +1899,44 @@ its sibling systems (i.e. completely stop the propagation of the event).</li>
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "System:emitFiltered"></a>
|
||||
<strong>System:emitFiltered (filter, name, ...)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Same as <a href="../modules/ecs.html#System:emit">emit</a>, but will check every system against a filter before calling the event. </p>
|
||||
|
||||
<p> <a href="../modules/ecs.html#System:filter">filter</a> is a function that receive the arguments <code>filter(system, name, …)</code>, and returns a boolean.
|
||||
It will be called on each system before emitting the event on it; if the filter returns false, the event will not
|
||||
be emitted to this system and its subsystems.</p>
|
||||
|
||||
<p> Complexity: O(1) per system
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">filter</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
filter function
|
||||
</li>
|
||||
<li><span class="parameter">name</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
||||
name of the callback
|
||||
</li>
|
||||
<li><span class="parameter">...</span>
|
||||
other arguments to pass to the callback
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "System:destroy"></a>
|
||||
|
|
@ -1876,7 +1964,7 @@ its sibling systems (i.e. completely stop the propagation of the event).</li>
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2022-10-11 19:12:05 </i>
|
||||
<i style="float:right;">Last updated 2022-10-13 00:23:58 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue