mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2026-10-10 08:02:54 -04:00
528 lines
13 KiB
HTML
528 lines
13 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<head>
|
|
<title>Reference</title>
|
|
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="product">
|
|
<div id="product_logo"></div>
|
|
<div id="product_name"><big><b></b></big></div>
|
|
<div id="product_description"></div>
|
|
</div> <!-- id="product" -->
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
<!-- Menu -->
|
|
|
|
<div id="navigation">
|
|
<br/>
|
|
<h1>Concord</h1>
|
|
|
|
|
|
<ul>
|
|
<li><a href="../index.html">Getting Started</a></li>
|
|
</ul>
|
|
|
|
<h2>Contents</h2>
|
|
<ul>
|
|
<li><a href="#Fields">Fields</a></li>
|
|
<li><a href="#Methods">Methods</a></li>
|
|
</ul>
|
|
|
|
|
|
<h2>Classes</h2>
|
|
<ul class="nowrap">
|
|
<li><a href="../classes/Component.html">Component</a></li>
|
|
<li><strong>Entity</strong></li>
|
|
<li><a href="../classes/Filter.html">Filter</a></li>
|
|
<li><a href="../classes/List.html">List</a></li>
|
|
<li><a href="../classes/System.html">System</a></li>
|
|
<li><a href="../classes/World.html">World</a></li>
|
|
</ul>
|
|
<h2>Builtin Components</h2>
|
|
<ul class="nowrap">
|
|
<li><a href="../builtins/key.html">key</a></li>
|
|
<li><a href="../builtins/serializable.html">serializable</a></li>
|
|
</ul>
|
|
<h2>Modules</h2>
|
|
<ul class="nowrap">
|
|
<li><a href="../modules/Components.html">Components</a></li>
|
|
<li><a href="../modules/Type.html">Type</a></li>
|
|
<li><a href="../modules/Utils.html">Utils</a></li>
|
|
</ul>
|
|
<h2>Guides</h2>
|
|
<ul class="nowrap">
|
|
<li><a href="../index.html">Getting Started</a></li>
|
|
<li><a href="../guides/Why-ECS.md.html">Why ECS? Why Concord?</a></li>
|
|
<li><a href="../guides/Custom-Pools.md.html">Custom Pools</a></li>
|
|
<li><a href="../guides/Pool-Flushing-and-Timing.md.html">Pool Flushing and Timing</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Class <code>Entity</code></h1>
|
|
<p>An object that exists in a world.</p>
|
|
<p> An entity
|
|
contains components which are processed by systems.</p>
|
|
|
|
|
|
<h2><a href="#Fields">Fields</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity.SERIALIZE_BY_DEFAULT">entity.SERIALIZE_BY_DEFAULT</a></td>
|
|
<td class="summary">If true, new Entities are given a "serializable" Component.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Methods">Methods</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:new">entity:new ([world])</a></td>
|
|
<td class="summary">Creates a new Entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:give">entity:give (name, ...)</a></td>
|
|
<td class="summary">Gives an Entity a Component.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:ensure">entity:ensure (name, ...)</a></td>
|
|
<td class="summary">Ensures an Entity has a Component.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:remove">entity:remove (name)</a></td>
|
|
<td class="summary">Removes a Component from an Entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:assemble">entity:assemble (assemblage, ...)</a></td>
|
|
<td class="summary">Assembles an Entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:destroy">entity:destroy ()</a></td>
|
|
<td class="summary">Destroys the Entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:has">entity:has (name)</a></td>
|
|
<td class="summary">Returns true if the Entity has a Component.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:get">entity:get (name)</a></td>
|
|
<td class="summary">Gets a Component from the Entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:getComponents">entity:getComponents ([output])</a></td>
|
|
<td class="summary">Returns a shallow copy of the Entity's fields, excluding __world and __isEntity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:inWorld">entity:inWorld ()</a></td>
|
|
<td class="summary">Returns true if the Entity has been assigned a World.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:getWorld">entity:getWorld ()</a></td>
|
|
<td class="summary">Returns the World the Entity is in.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:serialize">entity:serialize ([ignoreKey])</a></td>
|
|
<td class="summary">Serializes the Entity's Components.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#entity:deserialize">entity:deserialize (data)</a></td>
|
|
<td class="summary">Deserializes Components onto the Entity.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "entity.SERIALIZE_BY_DEFAULT"></a>
|
|
<strong>entity.SERIALIZE_BY_DEFAULT</strong>
|
|
</dt>
|
|
<dd>
|
|
If true, new Entities are given a "serializable" Component.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header "><a name="Methods"></a>Methods</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "entity:new"></a>
|
|
<strong>entity:new ([world])</strong>
|
|
</dt>
|
|
<dd>
|
|
Creates a new Entity. Optionally queues it to be added to a World.
|
|
If Entity.SERIALIZE<em>BY</em>DEFAULT is true, the Entity is given a "serializable" Component.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">world</span>
|
|
<span class="types"><a class="type" href="../classes/World.html#">World</a></span>
|
|
World to add the entity to
|
|
(<em>optional</em>)
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Entity.html#">Entity</a></span>
|
|
A new Entity
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:give"></a>
|
|
<strong>entity:give (name, ...)</strong>
|
|
</dt>
|
|
<dd>
|
|
Gives an Entity a Component.
|
|
If the Component already exists, it's overridden by this new Component.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">name</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <a class="type" href="../classes/Component.html#">Component</a></span>
|
|
Name of the ComponentClass, or a Component instance to copy onto the Entity
|
|
</li>
|
|
<li><span class="parameter">...</span>
|
|
additional arguments to pass to the Component's populate function (ignored when copying a Component)
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Entity.html#">Entity</a></span>
|
|
self
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:ensure"></a>
|
|
<strong>entity:ensure (name, ...)</strong>
|
|
</dt>
|
|
<dd>
|
|
Ensures an Entity has a Component.
|
|
If the Component already exists, no action is taken.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">name</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <a class="type" href="../classes/Component.html#">Component</a></span>
|
|
Name of the ComponentClass, or a Component instance to copy onto the Entity
|
|
</li>
|
|
<li><span class="parameter">...</span>
|
|
additional arguments to pass to the Component's populate function (ignored when copying a Component)
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Entity.html#">Entity</a></span>
|
|
self
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:remove"></a>
|
|
<strong>entity:remove (name)</strong>
|
|
</dt>
|
|
<dd>
|
|
Removes a Component from an Entity.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">name</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
|
|
Name of the ComponentClass to remove
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Entity.html#">Entity</a></span>
|
|
self
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:assemble"></a>
|
|
<strong>entity:assemble (assemblage, ...)</strong>
|
|
</dt>
|
|
<dd>
|
|
Assembles an Entity.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">assemblage</span>
|
|
<span class="types"><span class="type">function</span></span>
|
|
Function that will assemble an entity
|
|
</li>
|
|
<li><span class="parameter">...</span>
|
|
additional arguments to pass to the assemblage function.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Entity.html#">Entity</a></span>
|
|
self
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:destroy"></a>
|
|
<strong>entity:destroy ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Destroys the Entity.
|
|
Queues removal from its World if it's in one. The Entity stays in the World until the next flush.
|
|
|
|
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Entity.html#">Entity</a></span>
|
|
self
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:has"></a>
|
|
<strong>entity:has (name)</strong>
|
|
</dt>
|
|
<dd>
|
|
Returns true if the Entity has a Component.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">name</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
|
|
Name of the ComponentClass to check
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">boolean</span></span>
|
|
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:get"></a>
|
|
<strong>entity:get (name)</strong>
|
|
</dt>
|
|
<dd>
|
|
Gets a Component from the Entity.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">name</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
|
|
Name of the ComponentClass to get
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/Component.html#">Component</a> or <span class="type">nil</span></span>
|
|
The Component, or nil if the Entity does not have it
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:getComponents"></a>
|
|
<strong>entity:getComponents ([output])</strong>
|
|
</dt>
|
|
<dd>
|
|
Returns a shallow copy of the Entity's fields, excluding __world and __isEntity.
|
|
This is primarily the Entity's Components. Extra non-component fields are also copied.
|
|
Mutating a copied Component still mutates the Entity's Component.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">output</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
|
|
Table to copy into. A new table is created if omitted.
|
|
(<em>optional</em>)
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
|
|
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:inWorld"></a>
|
|
<strong>entity:inWorld ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Returns true if the Entity has been assigned a World.
|
|
True as soon as addition is queued, and remains true until removal is flushed.
|
|
|
|
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">boolean</span></span>
|
|
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:getWorld"></a>
|
|
<strong>entity:getWorld ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Returns the World the Entity is in.
|
|
|
|
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../classes/World.html#">World</a></span>
|
|
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:serialize"></a>
|
|
<strong>entity:serialize ([ignoreKey])</strong>
|
|
</dt>
|
|
<dd>
|
|
Serializes the Entity's Components.
|
|
Components that return nil from serialize are omitted.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">ignoreKey</span>
|
|
<span class="types"><span class="type">boolean</span></span>
|
|
If true, the key Component is omitted
|
|
(<em>optional</em>)
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
|
|
Serialized Entity data
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "entity:deserialize"></a>
|
|
<strong>entity:deserialize (data)</strong>
|
|
</dt>
|
|
<dd>
|
|
Deserializes Components onto the Entity.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">data</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
|
|
Serialized Entity data
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
</div> <!-- id="content" -->
|
|
</div> <!-- id="main" -->
|
|
<div id="about">
|
|
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
|
|
<i style="float:right;">Last updated 2026-09-06 21:32:30 </i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|