TombEngine/doc/entity classes/ItemInfo.html

687 lines
16 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>TombEngine Lua API</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>TombEngine</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Members">Members</a></li>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Entity classes</h2>
<ul class="nowrap">
<li><a href="../entity classes/AIObject.html">AIObject</a></li>
<li><a href="../entity classes/CameraInfo.html">CameraInfo</a></li>
<li><strong>ItemInfo</strong></li>
<li><a href="../entity classes/MeshInfo.html">MeshInfo</a></li>
<li><a href="../entity classes/SinkInfo.html">SinkInfo</a></li>
<li><a href="../entity classes/SoundSourceInfo.html">SoundSourceInfo</a></li>
</ul>
<h2>Script Files</h2>
<ul class="nowrap">
<li><a href="../script files/Pre-game.html">Pre-game scripts</a></li>
<li><a href="../script files/Level-specific.html">Level-specific scripts</a></li>
</ul>
<h2>Enums</h2>
<ul class="nowrap">
<li><a href="../enums/InvItem.html">InvItem</a></li>
<li><a href="../enums/ObjID.html">ObjID</a></li>
</ul>
<h2>Pre-game script classes</h2>
<ul class="nowrap">
<li><a href="../pre-game script classes/AudioTrack.html">AudioTrack</a></li>
<li><a href="../pre-game script classes/InventoryObject.html">InventoryObject</a></li>
<li><a href="../pre-game script classes/Level.html">Level</a></li>
<li><a href="../pre-game script classes/Mirror.html">Mirror</a></li>
<li><a href="../pre-game script classes/Settings.html">Settings</a></li>
<li><a href="../pre-game script classes/SkyLayer.html">SkyLayer</a></li>
</ul>
<h2>Misc classes</h2>
<ul class="nowrap">
<li><a href="../misc classes/Color.html">Color</a></li>
<li><a href="../misc classes/Position.html">Position</a></li>
<li><a href="../misc classes/Rotation.html">Rotation</a></li>
</ul>
</div>
<div id="content">
<h1>Class <code>ItemInfo</code></h1>
<p>Represents any object inside the game world.</p>
<p>Examples include statics, enemies, doors,
pickups, and Lara herself.</p>
<h2><a href="#Members">Members</a></h2>
<table class="function_list">
<tr>
<td class="name" ><a href="#objectID">objectID</a></td>
<td class="summary">(<a href="../enums/ObjID.html#">ObjID</a>) object ID</td>
</tr>
<tr>
<td class="name" ><a href="#currentAnimState">currentAnimState</a></td>
<td class="summary">(int) current animation state</p>
<p>The state number of the animation the object is currently doing.</td>
</tr>
<tr>
<td class="name" ><a href="#requiredAnimState">requiredAnimState</a></td>
<td class="summary">(int) State of required animation</td>
</tr>
<tr>
<td class="name" ><a href="#goalAnimState">goalAnimState</a></td>
<td class="summary">(int) State of goal animation</td>
</tr>
<tr>
<td class="name" ><a href="#animNumber">animNumber</a></td>
<td class="summary">(int) animation number</p>
<p>The index of the animation the object is currently doing.</td>
</tr>
<tr>
<td class="name" ><a href="#frameNumber">frameNumber</a></td>
<td class="summary">(int) frame number</p>
<p>Current fame of the animation the object is currently doing.</td>
</tr>
<tr>
<td class="name" ><a href="#HP">HP</a></td>
<td class="summary">(int) HP (hit points/health points) of object</td>
</tr>
<tr>
<td class="name" ><a href="#OCB">OCB</a></td>
<td class="summary">(int) OCB (object code bit) of object</td>
</tr>
<tr>
<td class="name" ><a href="#itemFlags">itemFlags</a></td>
<td class="summary">(table) item flags of object (table of 8 ints)</td>
</tr>
<tr>
<td class="name" ><a href="#AIBits">AIBits</a></td>
<td class="summary">(int) AIBits of object.</td>
</tr>
<tr>
<td class="name" ><a href="#status">status</a></td>
<td class="summary">(int) status of object.</td>
</tr>
<tr>
<td class="name" ><a href="#hitStatus">hitStatus</a></td>
<td class="summary">(bool) hit status of object</td>
</tr>
<tr>
<td class="name" ><a href="#active">active</a></td>
<td class="summary">(bool) whether or not the object is active</td>
</tr>
<tr>
<td class="name" ><a href="#room">room</a></td>
<td class="summary">(int) room the item is in</td>
</tr>
<tr>
<td class="name" ><a href="#pos">pos</a></td>
<td class="summary">(<a href="../misc classes/Position.html#">Position</a>) position in level</td>
</tr>
<tr>
<td class="name" ><a href="#rot">rot</a></td>
<td class="summary">(<a href="../misc classes/Rotation.html#">Rotation</a>) rotation represented as degree angles about X, Y, and Z axes</td>
</tr>
<tr>
<td class="name" ><a href="#name">name</a></td>
<td class="summary">(string) unique string identifier.</td>
</tr>
</table>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" ><a href="#ItemInfo.new">ItemInfo.new()</a></td>
<td class="summary">If you create items with this you NEED to give a position, room,
and object number, and then call InitialiseItem before it will work.</td>
</tr>
<tr>
<td class="name" ><a href="#ItemInfo.newTemporary">ItemInfo.newTemporary()</a></td>
<td class="summary">Like above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes
out of scope).</td>
</tr>
<tr>
<td class="name" ><a href="#ItemInfo.new">ItemInfo.new(object, name, position, rotation, room, currentAnimState, requiredAnimState, goalAnimState, animNumber, frameNumber, hp, OCB, itemFlags, AIBits, status, active, hitStatus)</a></td>
<td class="summary">For more information on each parameter, see the
associated getters and setters.</td>
</tr>
<tr>
<td class="name" ><a href="#ItemInfo.newTemporary">ItemInfo.newTemporary(see_above)</a></td>
<td class="summary">Like the above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes
out of scope).</td>
</tr>
<tr>
<td class="name" ><a href="#ItemInfo.Init">ItemInfo.Init()</a></td>
<td class="summary">Initialise an item.</td>
</tr>
<tr>
<td class="name" ><a href="#ItemInfo:EnableItem">ItemInfo:EnableItem()</a></td>
<td class="summary">Enable the item</td>
</tr>
<tr>
<td class="name" ><a href="#ItemInfo:DisableItem">ItemInfo:DisableItem()</a></td>
<td class="summary">Disable the item</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Members"></a>Members</h2>
<dl class="function">
<dt>
<a name = "objectID"></a>
<strong>objectID</strong>
</dt>
<dd>
(<a href="../enums/ObjID.html#">ObjID</a>) object ID
</dd>
<dt>
<a name = "currentAnimState"></a>
<strong>currentAnimState</strong>
</dt>
<dd>
(int) current animation state</p>
<p>The state number of the animation the object is currently doing.
This corresponds to "state" number shown in the animation editor of WadTool.
</dd>
<dt>
<a name = "requiredAnimState"></a>
<strong>requiredAnimState</strong>
</dt>
<dd>
(int) State of required animation
</dd>
<dt>
<a name = "goalAnimState"></a>
<strong>goalAnimState</strong>
</dt>
<dd>
(int) State of goal animation
</dd>
<dt>
<a name = "animNumber"></a>
<strong>animNumber</strong>
</dt>
<dd>
(int) animation number</p>
<p>The index of the animation the object is currently doing.
This corresponds to the number shown in the item's animation list in WadTool.
</dd>
<dt>
<a name = "frameNumber"></a>
<strong>frameNumber</strong>
</dt>
<dd>
(int) frame number</p>
<p>Current fame of the animation the object is currently doing.
The number of frames in an animation can be seen under the heading "End frame" in
the WadTool animation editor.
</dd>
<dt>
<a name = "HP"></a>
<strong>HP</strong>
</dt>
<dd>
(int) HP (hit points/health points) of object
</dd>
<dt>
<a name = "OCB"></a>
<strong>OCB</strong>
</dt>
<dd>
(int) OCB (object code bit) of object
</dd>
<dt>
<a name = "itemFlags"></a>
<strong>itemFlags</strong>
</dt>
<dd>
(table) item flags of object (table of 8 ints)
</dd>
<dt>
<a name = "AIBits"></a>
<strong>AIBits</strong>
</dt>
<dd>
(int) AIBits of object. Will be clamped to [0, 255]
</dd>
<dt>
<a name = "status"></a>
<strong>status</strong>
</dt>
<dd>
(int) status of object.
possible values:
0 - not active
1 - active
2 - deactivated
3 - invisible
</dd>
<dt>
<a name = "hitStatus"></a>
<strong>hitStatus</strong>
</dt>
<dd>
(bool) hit status of object
</dd>
<dt>
<a name = "active"></a>
<strong>active</strong>
</dt>
<dd>
(bool) whether or not the object is active
</dd>
<dt>
<a name = "room"></a>
<strong>room</strong>
</dt>
<dd>
(int) room the item is in
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
(<a href="../misc classes/Position.html#">Position</a>) position in level
</dd>
<dt>
<a name = "rot"></a>
<strong>rot</strong>
</dt>
<dd>
(<a href="../misc classes/Rotation.html#">Rotation</a>) rotation represented as degree angles about X, Y, and Z axes
</dd>
<dt>
<a name = "name"></a>
<strong>name</strong>
</dt>
<dd>
(string) unique string identifier.
e.g. "door_back_room" or "cracked_greek_statue"
</dd>
</dl>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "ItemInfo.new"></a>
<strong>ItemInfo.new()</strong>
</dt>
<dd>
If you create items with this you NEED to give a position, room,
and object number, and then call InitialiseItem before it will work.
</dd>
<dt>
<a name = "ItemInfo.newTemporary"></a>
<strong>ItemInfo.newTemporary()</strong>
</dt>
<dd>
Like above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes
out of scope).
</dd>
<dt>
<a name = "ItemInfo.new"></a>
<strong>ItemInfo.new(object, name, position, rotation, room, currentAnimState, requiredAnimState, goalAnimState, animNumber, frameNumber, hp, OCB, itemFlags, AIBits, status, active, hitStatus)</strong>
</dt>
<dd>
For more information on each parameter, see the
associated getters and setters. If you do not know what to set for these,
most can just be set to zero (see usage). See also the overload which
takes no arguments.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">object</span>
<span class="types"><span class="type">ObjID</span></span>
ID
</li>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Lua name of the item
</li>
<li><span class="parameter">position</span>
<span class="types"><span class="type">Position</span></span>
position in level
</li>
<li><span class="parameter">rotation</span>
<span class="types"><span class="type">Rotation</span></span>
rotation about x, y, and z axes
</li>
<li><span class="parameter">room</span>
<span class="types"><span class="type">int</span></span>
room ID item is in
</li>
<li><span class="parameter">currentAnimState</span>
<span class="types"><span class="type">int</span></span>
current animation state
</li>
<li><span class="parameter">requiredAnimState</span>
<span class="types"><span class="type">int</span></span>
required animation state
</li>
<li><span class="parameter">goalAnimState</span>
<span class="types"><span class="type">int</span></span>
goal animation state
</li>
<li><span class="parameter">animNumber</span>
<span class="types"><span class="type">int</span></span>
anim number
</li>
<li><span class="parameter">frameNumber</span>
<span class="types"><span class="type">int</span></span>
frame number
</li>
<li><span class="parameter">hp</span>
<span class="types"><span class="type">int</span></span>
HP of item
</li>
<li><span class="parameter">OCB</span>
<span class="types"><span class="type">int</span></span>
ocb of item
</li>
<li><span class="parameter">itemFlags</span>
<span class="types"><span class="type">int</span></span>
item flags
</li>
<li><span class="parameter">AIBits</span>
<span class="types"><span class="type">int</span></span>
byte with AI bits
</li>
<li><span class="parameter">status</span>
<span class="types"><span class="type">int</span></span>
status of object
</li>
<li><span class="parameter">active</span>
<span class="types"><span class="type">bool</span></span>
is item active or not?
</li>
<li><span class="parameter">hitStatus</span>
<span class="types"><span class="type">bool</span></span>
hit status of object
</li>
</ul>
<h3>Returns:</h3>
<ol>
reference to new ItemInfo object
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> item = ItemInfo.new(
ObjID.PISTOLS_ITEM, <span class="comment">-- object id
</span> <span class="string">"test"</span>, <span class="comment">-- name
</span> Position.new(<span class="number">18907</span>, <span class="number">0</span>, <span class="number">21201</span>),
Rotation.new(<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>),
<span class="number">0</span>, <span class="comment">-- room
</span> <span class="number">0</span>, <span class="comment">-- currentAnimState
</span> <span class="number">0</span>, <span class="comment">-- requiredAnimState
</span> <span class="number">0</span>, <span class="comment">-- goalAnimState
</span> <span class="number">0</span>, <span class="comment">-- animNumber
</span> <span class="number">0</span>, <span class="comment">-- frameNumber
</span> <span class="number">0</span>, <span class="comment">-- HP
</span> <span class="number">0</span>, <span class="comment">-- OCB
</span> {<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>}, <span class="comment">-- itemFlags
</span> <span class="number">0</span>, <span class="comment">-- AIBits
</span> <span class="number">0</span>, <span class="comment">-- status
</span> <span class="keyword">false</span>, <span class="comment">-- active
</span> <span class="keyword">false</span>, <span class="comment">-- hitStatus
</span> )</pre>
</ul>
</dd>
<dt>
<a name = "ItemInfo.newTemporary"></a>
<strong>ItemInfo.newTemporary(see_above)</strong>
</dt>
<dd>
Like the above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes
out of scope).
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">see_above</span>
same as above function
</li>
</ul>
</dd>
<dt>
<a name = "ItemInfo.Init"></a>
<strong>ItemInfo.Init()</strong>
</dt>
<dd>
Initialise an item.
Use this if you called new with no arguments
</dd>
<dt>
<a name = "ItemInfo:EnableItem"></a>
<strong>ItemInfo:EnableItem()</strong>
</dt>
<dd>
Enable the item
</dd>
<dt>
<a name = "ItemInfo:DisableItem"></a>
<strong>ItemInfo:DisableItem()</strong>
</dt>
<dd>
Disable the item
</dd>
</dl>
</div> <!-- id="content" -->
</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 2021-08-23 20:14:37 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>