mirror of
https://github.com/Reuh/ubiquitousse.git
synced 2025-10-27 09:09:30 +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
|
|
@ -113,7 +113,7 @@
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -1723,7 +1723,7 @@ player.fire.event:bind(<span class="string">"pressed"</span>, <span class="keywo
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -2066,7 +2066,7 @@ end
|
|||
Level background. </p>
|
||||
|
||||
<p> If there is a background image, <code>background.image</code> contains a table <code>{image=image, x=number, y=number, sx=number, sy=number}</code>
|
||||
where <a href="../modules/ldtk.html#Tileset.image">image</a> is the LÖVE image (or image filepath if LÖVE not available) <a href="../modules/ldtk.html#Entity.x">x</a> and <a href="../modules/ldtk.html#Tile.y">y</a> are the top-left position,
|
||||
where <a href="../modules/ldtk.html#Tileset.image">image</a> is the LÖVE image (or image filepath if LÖVE not available) <a href="../modules/ldtk.html#Tile.x">x</a> and <a href="../modules/ldtk.html#Tile.y">y</a> are the top-left position,
|
||||
and <a href="../modules/ldtk.html#Entity.sx">sx</a> and <a href="../modules/ldtk.html#Entity.sy">sy</a> the horizontal and vertical scale factors.
|
||||
|
||||
</ul>
|
||||
|
|
@ -2142,7 +2142,7 @@ end
|
|||
<li>Enum are converted into a Lua string giving the currently selected enum value.</li>
|
||||
<li>Filepath are converted into a Lua string giving the file path.</li>
|
||||
<li>Arrays are converted into a Lua table with the elements in it as a list.</li>
|
||||
<li>Points are converted into a Lua table with the fields <a href="../modules/ldtk.html#Entity.x">x</a> and <a href="../modules/ldtk.html#Tile.y">y</a>, in pixels: <code>{ x=number, y=number }</code>.</li>
|
||||
<li>Points are converted into a Lua table with the fields <a href="../modules/ldtk.html#Tile.x">x</a> and <a href="../modules/ldtk.html#Tile.y">y</a>, in pixels: <code>{ x=number, y=number }</code>.</li>
|
||||
<li>Colors are converted into a Lua table with the red, green and blue components in [0-1] as a list: <code>{r,g,b}</code>.</li>
|
||||
<li>Tiles are converted into a Lua table { tileset = associated tileset object, quad = associated quad } where <a href="../modules/ldtk.html#Tile.quad">quad</a> is a LÖVE Quad if LÖVE is available, otherwise a table <code>{ x, y, width, height }</code>.</li>
|
||||
<li>EntityRef are converted into a Lua table { level = level, layerIid = layer IID, entityIid = entity IID, entity = see explanation }. If the entity being refernced belongs to another level and this level is not loaded, <code>entity</code> will be nil; otherwise (same level or the other level is also loaded), it will contain the entity.</li>
|
||||
|
|
@ -2170,7 +2170,7 @@ end
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -788,7 +788,7 @@ signal.event:bind("keypressed", function(key, scancode) print("pr
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -1154,7 +1154,7 @@
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ the repository to save you a few seconds.</p>
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
</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>
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
</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