TombEngine/Documentation/doc/2 classes/Objects.Moveable.html

1740 lines
43 KiB
HTML
Raw Normal View History

2022-04-10 00:38:39 +01:00
<!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>
2022-12-09 22:08:16 +00:00
<title>TombEngine 1.0.4 Lua API</title>
2022-04-10 00:38:39 +01:00
<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>
2022-12-09 22:08:16 +00:00
<h2>1 Modules</h2>
2022-04-10 00:38:39 +01:00
<ul class="nowrap">
2022-12-09 22:08:16 +00:00
<li> <a href="../1 modules/Effects.html">Effects</a></li>
<li> <a href="../1 modules/Flow.html">Flow</a></li>
<li> <a href="../1 modules/Inventory.html">Inventory</a></li>
<li> <a href="../1 modules/Logic.html">Logic</a></li>
<li> <a href="../1 modules/Misc.html">Misc</a></li>
<li> <a href="../1 modules/Objects.html">Objects</a></li>
<li> <a href="../1 modules/Strings.html">Strings</a></li>
2022-04-10 00:38:39 +01:00
</ul>
2022-12-09 22:08:16 +00:00
<h2>2 Classes</h2>
2022-04-10 00:38:39 +01:00
<ul class="nowrap">
2022-12-09 22:08:16 +00:00
<li> <a href="../2 classes/Flow.Animations.html">Flow.Animations</a></li>
<li> <a href="../2 classes/Flow.Fog.html">Flow.Fog</a></li>
<li> <a href="../2 classes/Flow.InventoryItem.html">Flow.InventoryItem</a></li>
<li> <a href="../2 classes/Flow.Level.html">Flow.Level</a></li>
<li> <a href="../2 classes/Flow.Mirror.html">Flow.Mirror</a></li>
<li> <a href="../2 classes/Flow.Settings.html">Flow.Settings</a></li>
<li> <a href="../2 classes/Flow.SkyLayer.html">Flow.SkyLayer</a></li>
<li> <a href="../2 classes/Objects.AIObject.html">Objects.AIObject</a></li>
<li> <a href="../2 classes/Objects.Camera.html">Objects.Camera</a></li>
<li> <a href="../2 classes/Objects.LaraObject.html">Objects.LaraObject</a></li>
<li> <here>Objects.Moveable</here></li>
<li> <a href="../2 classes/Objects.Sink.html">Objects.Sink</a></li>
<li> <a href="../2 classes/Objects.SoundSource.html">Objects.SoundSource</a></li>
<li> <a href="../2 classes/Objects.Static.html">Objects.Static</a></li>
<li> <a href="../2 classes/Strings.DisplayString.html">Strings.DisplayString</a></li>
2022-04-10 00:38:39 +01:00
</ul>
<h2>3 Primitive Classes</h2>
<ul class="nowrap">
2022-12-09 22:08:16 +00:00
<li> <a href="../3 primitive classes/Color.html">Color</a></li>
<li> <a href="../3 primitive classes/Rotation.html">Rotation</a></li>
<li> <a href="../3 primitive classes/Vec3.html">Vec3</a></li>
2022-04-10 00:38:39 +01:00
</ul>
<h2>4 Enums</h2>
<ul class="nowrap">
2022-12-09 22:08:16 +00:00
<li> <a href="../4 enums/Effects.BlendID.html">Effects.BlendID</a></li>
<li> <a href="../4 enums/Effects.EffectID.html">Effects.EffectID</a></li>
<li> <a href="../4 enums/Misc.ActionID.html">Misc.ActionID</a></li>
<li> <a href="../4 enums/Objects.ObjID.html">Objects.ObjID</a></li>
2022-04-10 00:38:39 +01:00
</ul>
<h2>5 Lua utility modules</h2>
<ul class="nowrap">
2022-12-09 22:08:16 +00:00
<li> <a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
<li> <a href="../5 lua utility modules/Timer.html">Timer</a></li>
</ul>
2022-04-10 00:38:39 +01:00
</div>
<div id="content">
<h1>Class <code>Objects.Moveable</code></h1>
<p>Represents any object inside the game world.</p>
<p>Examples include traps, enemies, doors,
2022-11-11 19:43:28 +00:00
pickups, and Lara herself (see also <a href="../2 classes/Objects.LaraObject.html#">Objects.LaraObject</a> for Lara-specific features).</p>
2022-04-10 00:38:39 +01:00
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
2022-12-09 22:08:16 +00:00
<td class="name" ><a href="#Moveable">Moveable(object, name, position[, rotation][, room][, animNumber=0][, frameNumber=0][, hp=10][, OCB=0][, AIBits])</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">For more information on each parameter, see the
associated getters and setters.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:Enable">Moveable:Enable()</a></td>
2022-05-13 14:31:04 +01:00
<td class="summary">Enable the item, as if a trigger for it had been stepped on.</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:Disable">Moveable:Disable()</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">Disable the item</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:MakeInvisible">Moveable:MakeInvisible()</a></td>
<td class="summary">Make the item invisible.</td>
</tr>
<tr>
2022-07-10 12:13:58 +01:00
<td class="name" ><a href="#Moveable:Explode">Moveable:Explode()</a></td>
<td class="summary">Explode item.</td>
</tr>
<tr>
2022-07-16 13:02:52 +01:00
<td class="name" ><a href="#Moveable:Shatter">Moveable:Shatter()</a></td>
<td class="summary">Shatter item.</td>
</tr>
<tr>
2022-12-01 21:17:41 +00:00
<td class="name" ><a href="#Moveable:SetEffect">Moveable:SetEffect(effect, timeout)</a></td>
<td class="summary">Set effect to moveable</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetCustomEffect">Moveable:SetCustomEffect(Color1, Color2, timeout)</a></td>
<td class="summary">Set custom colored burn effect to moveable</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetEffect">Moveable:GetEffect()</a></td>
<td class="summary">Get current moveable effect</td>
</tr>
<tr>
2022-04-10 00:38:39 +01:00
<td class="name" ><a href="#Moveable:GetStatus">Moveable:GetStatus()</a></td>
<td class="summary">Get the status of object.</td>
2022-09-20 19:44:40 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetOnHit">Moveable:SetOnHit(callback)</a></td>
<td class="summary">Set the name of the function to be called when the moveable is shot by Lara
Note that this will be triggered twice when shot with both pistols at once.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetOnCollidedWithObject">Moveable:SetOnCollidedWithObject(func)</a></td>
<td class="summary">Set the function to be called called when this moveable collides with another moveable</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetOnCollidedWithRoom">Moveable:SetOnCollidedWithRoom(func)</a></td>
<td class="summary">Set the function called when this moveable collides with room geometry (e.g.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetOnKilled">Moveable:SetOnKilled(callback)</a></td>
<td class="summary">Set the name of the function to be called when the moveable is destroyed/killed
Note that enemy death often occurs at the end of an animation, and not at the exact moment
the enemy's HP becomes zero.</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetObjectID">Moveable:GetObjectID()</a></td>
<td class="summary">Retrieve the object ID</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetObjectID">Moveable:SetObjectID(ID)</a></td>
<td class="summary">Change the object's ID.</td>
</tr>
<tr>
2022-07-10 12:13:58 +01:00
<td class="name" ><a href="#Moveable:GetState">Moveable:GetState()</a></td>
2022-07-11 22:35:30 +01:00
<td class="summary">Retrieve the index of the current state.</td>
2022-07-10 12:13:58 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetState">Moveable:SetState(index)</a></td>
<td class="summary">Set the object's state to the one specified by the given index.</td>
</tr>
<tr>
2022-04-10 00:38:39 +01:00
<td class="name" ><a href="#Moveable:GetAnim">Moveable:GetAnim()</a></td>
<td class="summary">Retrieve the index of the current animation.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetAnim">Moveable:SetAnim(index)</a></td>
2022-07-10 12:13:58 +01:00
<td class="summary">Set the object's animation to the one specified by the given index.</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetFrame">Moveable:GetFrame()</a></td>
<td class="summary">Retrieve frame number.</td>
</tr>
<tr>
2022-09-20 19:44:40 +01:00
<td class="name" ><a href="#Moveable:SetVelocity">Moveable:SetVelocity(velocity)</a></td>
<td class="summary">Set the object's velocity to specified value.</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
2022-09-20 19:44:40 +01:00
<td class="name" ><a href="#Moveable:GetVelocity">Moveable:GetVelocity()</a></td>
<td class="summary">Get the object's velocity.</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
2022-09-20 19:44:40 +01:00
<td class="name" ><a href="#Moveable:SetFrame">Moveable:SetFrame(frame)</a></td>
<td class="summary">Set frame number.</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
2022-09-07 20:57:50 +01:00
<td class="name" ><a href="#Moveable:GetSlotHP">Moveable:GetSlotHP(ID)</a></td>
<td class="summary">Get HP definded for that object type (hit points/health points) (Read Only).</td>
</tr>
<tr>
2022-04-10 00:38:39 +01:00
<td class="name" ><a href="#Moveable:GetOCB">Moveable:GetOCB()</a></td>
<td class="summary">Get OCB (object code bit) of the moveable</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetOCB">Moveable:SetOCB(OCB)</a></td>
<td class="summary">Set OCB (object code bit) of the moveable</td>
</tr>
<tr>
2022-09-07 20:57:50 +01:00
<td class="name" ><a href="#Moveable:GetItemFlags">Moveable:GetItemFlags()</a></td>
<td class="summary">Get the value stored in ItemFlags[x] (x is the value of the parameter)</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetItemFlags">Moveable:SetItemFlags(value)</a></td>
<td class="summary">Stores the value of the first parameter in the ItemFlags[x] (x is the value of the second parameter)</td>
</tr>
<tr>
2022-07-16 13:02:52 +01:00
<td class="name" ><a href="#Moveable:GetColor">Moveable:GetColor()</a></td>
<td class="summary">Get the moveable's color</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetColor">Moveable:SetColor(color)</a></td>
<td class="summary">Set the moveable's color</td>
</tr>
<tr>
2022-04-10 00:38:39 +01:00
<td class="name" ><a href="#Moveable:GetAIBits">Moveable:GetAIBits()</a></td>
<td class="summary">Get AIBits of object
This will return a table with six values, each corresponding to
an active behaviour.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetAIBits">Moveable:SetAIBits(bits)</a></td>
<td class="summary">Set AIBits of object
Use this to force a moveable into a certain AI mode or modes, as if a certain nullmesh
(or more than one) had suddenly spawned beneath their feet.</td>
2022-07-10 12:13:58 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:MeshIsVisible">Moveable:MeshIsVisible(index)</a></td>
<td class="summary">Get state of specified mesh visibility of object
Returns true if specified mesh is visible on an object, and false
if it is not visible.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:ShowMesh">Moveable:ShowMesh(index)</a></td>
<td class="summary">Makes specified mesh visible
Use this to show specified mesh of an object.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:HideMesh">Moveable:HideMesh(index)</a></td>
<td class="summary">Makes specified mesh invisible
Use this to hide specified mesh of an object.</td>
2022-07-16 13:02:52 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:ShatterMesh">Moveable:ShatterMesh(index)</a></td>
<td class="summary">Shatters specified mesh and makes it invisible
Note that you can re-enable mesh later by using ShowMesh().</td>
2022-07-10 12:13:58 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:MeshIsSwapped">Moveable:MeshIsSwapped(index)</a></td>
<td class="summary">Get state of specified mesh swap of object
Returns true if specified mesh is swapped on an object, and false
if it is not swapped.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SwapMesh">Moveable:SwapMesh(index, index, optional)</a></td>
<td class="summary">Set state of specified mesh swap of object
Use this to swap specified mesh of an object.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:UnswapMesh">Moveable:UnswapMesh(index)</a></td>
<td class="summary">Set state of specified mesh swap of object
Use this to bring back original unswapped mesh</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetHitStatus">Moveable:GetHitStatus()</a></td>
<td class="summary">Get the hit status of the object</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetActive">Moveable:GetActive()</a></td>
<td class="summary">Determine whether the moveable is active or not</td>
</tr>
<tr>
2022-07-11 22:35:30 +01:00
<td class="name" ><a href="#Moveable:GetJointPosition">Moveable:GetJointPosition()</a></td>
2022-07-10 12:13:58 +01:00
<td class="summary">Get the object's joint position</td>
2022-04-10 00:38:39 +01:00
</tr>
<tr>
2022-05-23 21:27:05 +01:00
<td class="name" ><a href="#Moveable:GetRotation">Moveable:GetRotation()</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">Get the moveable's rotation</td>
</tr>
<tr>
2022-05-23 21:27:05 +01:00
<td class="name" ><a href="#Moveable:SetRotation">Moveable:SetRotation(rotation)</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">Set the moveable's rotation</td>
</tr>
<tr>
2022-05-23 21:27:05 +01:00
<td class="name" ><a href="#Moveable:GetName">Moveable:GetName()</a></td>
2022-07-11 22:35:30 +01:00
<td class="summary">Get the moveable's name (its unique string identifier)
2022-04-10 00:38:39 +01:00
e.g.</td>
</tr>
<tr>
2022-05-23 21:27:05 +01:00
<td class="name" ><a href="#Moveable:SetName">Moveable:SetName(string)</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">Set the moveable's name (its unique string identifier)
e.g.</td>
</tr>
<tr>
2022-05-23 21:27:05 +01:00
<td class="name" ><a href="#Moveable:GetValid">Moveable:GetValid()</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">Test if the object is in a valid state (i.e.</td>
</tr>
<tr>
2022-05-23 21:27:05 +01:00
<td class="name" ><a href="#Moveable:Destroy">Moveable:Destroy()</a></td>
2022-04-10 00:38:39 +01:00
<td class="summary">Destroy the moveable.</td>
</tr>
2022-08-26 00:13:02 +01:00
<tr>
2022-11-18 15:34:45 +00:00
<td class="name" ><a href="#Moveable:AttachObjCamera">Moveable:AttachObjCamera(mesh)</a></td>
<td class="summary">Attach camera to an object.</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:AnimFromObject">Moveable:AnimFromObject(ObjectID, animNumber, stateID)</a></td>
<td class="summary">Borrow animation from an object</td>
</tr>
<tr>
2022-08-26 00:13:02 +01:00
<td class="name" ><a href="#Moveable:GetPosition">Moveable:GetPosition()</a></td>
<td class="summary">Get the object's position</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetPosition">Moveable:SetPosition(position[, updateRoom])</a></td>
<td class="summary">Set the moveable's position
If you are moving a moveable whose behaviour involves knowledge of room geometry,
(e.g.</td>
2022-09-20 19:44:40 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetHP">Moveable:GetHP()</a></td>
<td class="summary">Get current HP (hit points/health points)</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetHP">Moveable:SetHP(HP)</a></td>
<td class="summary">Set current HP (hit points/health points)
Clamped to [0, 32767] for "intelligent" entities (i.e.</td>
2022-08-26 00:13:02 +01:00
</tr>
<tr>
<td class="name" ><a href="#Moveable:GetRoom">Moveable:GetRoom()</a></td>
<td class="summary">Get the current room of the object</td>
</tr>
<tr>
<td class="name" ><a href="#Moveable:SetRoom">Moveable:SetRoom(ID)</a></td>
<td class="summary">Set room of object
Use this if you are not using SetPosition's automatic room update - for example, when dealing with overlapping rooms.</td>
</tr>
2022-04-10 00:38:39 +01:00
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
2022-05-13 14:31:04 +01:00
<a name = "Moveable"></a>
2022-12-09 22:08:16 +00:00
<strong>Moveable(object, name, position[, rotation][, room][, animNumber=0][, frameNumber=0][, hp=10][, OCB=0][, AIBits])</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
For more information on each parameter, see the
associated getters and setters. If you do not know what to set for these,
2022-05-13 14:31:04 +01:00
most can just be ignored (see usage).
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">object</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../4 enums/Objects.ObjID.html#">ObjID</a></span>
2022-04-10 00:38:39 +01:00
ID
</li>
<li><span class="parameter">name</span>
2022-11-18 15:34:45 +00:00
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
2022-04-10 00:38:39 +01:00
Lua name of the item
</li>
<li><span class="parameter">position</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
2022-04-10 00:38:39 +01:00
position in level
</li>
<li><span class="parameter">rotation</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
2022-05-13 14:31:04 +01:00
rotation about x, y, and z axes (default Rotation(0, 0, 0))
2022-08-26 00:13:02 +01:00
(<em>optional</em>)
2022-04-10 00:38:39 +01:00
</li>
<li><span class="parameter">room</span>
<span class="types"><span class="type">int</span></span>
2022-08-26 00:13:02 +01:00
room ID item is in (default: calculated automatically)
(<em>optional</em>)
2022-04-10 00:38:39 +01:00
</li>
<li><span class="parameter">animNumber</span>
<span class="types"><span class="type">int</span></span>
2022-08-26 00:13:02 +01:00
anim number
(<em>default</em> 0)
2022-04-10 00:38:39 +01:00
</li>
<li><span class="parameter">frameNumber</span>
<span class="types"><span class="type">int</span></span>
2022-08-26 00:13:02 +01:00
frame number
(<em>default</em> 0)
2022-04-10 00:38:39 +01:00
</li>
<li><span class="parameter">hp</span>
<span class="types"><span class="type">int</span></span>
2022-08-26 00:13:02 +01:00
HP of item
(<em>default</em> 10)
2022-04-10 00:38:39 +01:00
</li>
<li><span class="parameter">OCB</span>
<span class="types"><span class="type">int</span></span>
ocb of item (default 0)
2022-08-26 00:13:02 +01:00
(<em>default</em> 0)
2022-04-10 00:38:39 +01:00
</li>
<li><span class="parameter">AIBits</span>
2022-11-18 15:34:45 +00:00
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
2022-04-10 00:38:39 +01:00
table with AI bits (default {0,0,0,0,0,0})
2022-08-26 00:13:02 +01:00
(<em>optional</em>)
2022-04-10 00:38:39 +01:00
</li>
</ul>
<h3>Returns:</h3>
<ol>
2022-12-01 21:17:41 +00:00
<span class="types"><a class="type" href="../2 classes/Objects.Moveable.html#Moveable">Moveable</a></span>
A new Moveable object (a wrapper around the new object)
2022-04-10 00:38:39 +01:00
</ol>
<h3>Usage:</h3>
<ul>
2022-05-13 14:31:04 +01:00
<pre class="example"><span class="keyword">local</span> item = Moveable(
TEN.Objects.ObjID.PISTOLS_ITEM, <span class="comment">-- object id
2022-04-10 00:38:39 +01:00
</span> <span class="string">"test"</span>, <span class="comment">-- name
2022-08-26 00:13:02 +01:00
</span> Vec3(<span class="number">18907</span>, <span class="number">0</span>, <span class="number">21201</span>)
)</pre>
2022-04-10 00:38:39 +01:00
</ul>
</dd>
<dt>
<a name = "Moveable:Enable"></a>
<strong>Moveable:Enable()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-05-13 14:31:04 +01:00
Enable the item, as if a trigger for it had been stepped on.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:Disable"></a>
<strong>Moveable:Disable()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
Disable the item
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:MakeInvisible"></a>
<strong>Moveable:MakeInvisible()</strong>
</dt>
<dd>
Make the item invisible. Use EnableItem to make it visible again.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
</dd>
<dt>
<a name = "Moveable:Explode"></a>
<strong>Moveable:Explode()</strong>
</dt>
<dd>
Explode item. This also kills and disables item.
2022-12-09 22:08:16 +00:00
2022-07-16 13:02:52 +01:00
</dd>
<dt>
<a name = "Moveable:Shatter"></a>
<strong>Moveable:Shatter()</strong>
</dt>
<dd>
Shatter item. This also kills and disables item.
2022-12-09 22:08:16 +00:00
2022-12-01 21:17:41 +00:00
</dd>
<dt>
<a name = "Moveable:SetEffect"></a>
<strong>Moveable:SetEffect(effect, timeout)</strong>
</dt>
<dd>
Set effect to moveable
2022-12-09 22:08:16 +00:00
2022-12-01 21:17:41 +00:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">effect</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../4 enums/Effects.EffectID.html#">EffectID</a></span>
2022-12-01 21:17:41 +00:00
Type of effect to assign.
</li>
<li><span class="parameter">timeout</span>
<span class="types"><span class="type">float</span></span>
time (in seconds) after which effect turns off (optional).
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:SetCustomEffect"></a>
<strong>Moveable:SetCustomEffect(Color1, Color2, timeout)</strong>
</dt>
<dd>
Set custom colored burn effect to moveable
2022-12-09 22:08:16 +00:00
2022-12-01 21:17:41 +00:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">Color1</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
2022-12-01 21:17:41 +00:00
color the primary color of the effect (also used for lighting).
</li>
<li><span class="parameter">Color2</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
2022-12-01 21:17:41 +00:00
color the secondary color of the effect.
</li>
<li><span class="parameter">timeout</span>
<span class="types"><span class="type">float</span></span>
time (in seconds) after which effect turns off (optional).
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:GetEffect"></a>
<strong>Moveable:GetEffect()</strong>
</dt>
<dd>
Get current moveable effect
2022-12-09 22:08:16 +00:00
2022-12-01 21:17:41 +00:00
<h3>Returns:</h3>
<ol>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../4 enums/Effects.EffectID.html#">EffectID</a></span>
2022-12-01 21:17:41 +00:00
effect type currently assigned to moveable.
</ol>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:GetStatus"></a>
<strong>Moveable:GetStatus()</strong>
</dt>
<dd>
Get the status of object.
possible values:
2022-07-16 13:02:52 +01:00
<br />0 - not active
<br />1 - active
<br />2 - deactivated
<br />3 - invisible
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">int</span></span>
a number representing the status of the object
</ol>
2022-09-20 19:44:40 +01:00
</dd>
<dt>
<a name = "Moveable:SetOnHit"></a>
<strong>Moveable:SetOnHit(callback)</strong>
</dt>
<dd>
Set the name of the function to be called when the moveable is shot by Lara
Note that this will be triggered twice when shot with both pistols at once.
2022-12-09 22:08:16 +00:00
2022-09-20 19:44:40 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
function in LevelFuncs hierarchy to call when moveable is shot
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:SetOnCollidedWithObject"></a>
<strong>Moveable:SetOnCollidedWithObject(func)</strong>
</dt>
<dd>
Set the function to be called called when this moveable collides with another moveable
2022-12-09 22:08:16 +00:00
2022-09-20 19:44:40 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">func</span>
<span class="types"><span class="type">function</span></span>
callback function to be called (must be in LevelFuncs hierarchy)
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:SetOnCollidedWithRoom"></a>
<strong>Moveable:SetOnCollidedWithRoom(func)</strong>
</dt>
<dd>
Set the function called when this moveable collides with room geometry (e.g. a wall or floor)
2022-12-09 22:08:16 +00:00
2022-09-20 19:44:40 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">func</span>
<span class="types"><span class="type">function</span></span>
callback function to be called (must be in LevelFuncs hierarchy)
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:SetOnKilled"></a>
<strong>Moveable:SetOnKilled(callback)</strong>
</dt>
<dd>
Set the name of the function to be called when the moveable is destroyed/killed
Note that enemy death often occurs at the end of an animation, and not at the exact moment
the enemy's HP becomes zero.
2022-12-09 22:08:16 +00:00
2022-09-20 19:44:40 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
function in LevelFuncs hierarchy to call when enemy is killed
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">LevelFuncs.baddyKilled = <span class="keyword">function</span>(theBaddy) <span class="global">print</span>(<span class="string">"You killed a baddy!"</span>) <span class="keyword">end</span>
baddy:SetOnKilled(LevelFuncs.baddyKilled)</pre>
</ul>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:GetObjectID"></a>
<strong>Moveable:GetObjectID()</strong>
</dt>
<dd>
Retrieve the object ID
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">int</span></span>
a number representing the ID of the object
</ol>
</dd>
<dt>
<a name = "Moveable:SetObjectID"></a>
<strong>Moveable:SetObjectID(ID)</strong>
</dt>
<dd>
Change the object's ID. This will literally change the object.
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ID</span>
<span class="types"><span class="type">ObjectID</span></span>
the new ID
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">shiva = TEN.Objects.GetMoveableByName(<span class="string">"shiva_60"</span>)
shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
</ul>
2022-07-10 12:13:58 +01:00
</dd>
<dt>
<a name = "Moveable:GetState"></a>
<strong>Moveable:GetState()</strong>
</dt>
<dd>
2022-07-11 22:35:30 +01:00
Retrieve the index of the current state.
2022-07-10 12:13:58 +01:00
This corresponds to the number shown in the item's state ID field in WadTool.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">int</span></span>
the index of the active state
</ol>
</dd>
<dt>
<a name = "Moveable:SetState"></a>
<strong>Moveable:SetState(index)</strong>
</dt>
<dd>
Set the object's state to the one specified by the given index.
Performs no bounds checking. <em>Ensure the number given is correct, else
object may end up in corrupted animation state.</em>
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
the index of the desired state
</li>
</ul>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:GetAnim"></a>
<strong>Moveable:GetAnim()</strong>
</dt>
<dd>
Retrieve the index of the current animation.
This corresponds to the number shown in the item's animation list in WadTool.
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">int</span></span>
the index of the active animation
</ol>
</dd>
<dt>
<a name = "Moveable:SetAnim"></a>
<strong>Moveable:SetAnim(index)</strong>
</dt>
<dd>
2022-07-10 12:13:58 +01:00
Set the object's animation to the one specified by the given index.
2022-04-10 00:38:39 +01:00
Performs no bounds checking. <em>Ensure the number given is correct, else
2022-07-10 12:13:58 +01:00
object may end up in corrupted animation state.</em>
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
the index of the desired anim
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:GetFrame"></a>
<strong>Moveable:GetFrame()</strong>
</dt>
<dd>
Retrieve frame number.
This is the current frame of the object's active animation.
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">int</span></span>
the current frame of the active animation
</ol>
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:SetVelocity"></a>
<strong>Moveable:SetVelocity(velocity)</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Set the object's velocity to specified value.
In most cases, only Z and Y components are used as forward and vertical velocity.
In some cases, primarily NPCs, X component is used as side velocity.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
2022-09-20 19:44:40 +01:00
<li><span class="parameter">velocity</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
2022-09-20 19:44:40 +01:00
velocity represented as vector
2022-04-10 00:38:39 +01:00
</li>
</ul>
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:GetVelocity"></a>
<strong>Moveable:GetVelocity()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Get the object's velocity.
In most cases, only Z and Y components are used as forward and vertical velocity.
In some cases, primarily NPCs, X component is used as side velocity.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
2022-09-20 19:44:40 +01:00
current object velocity
2022-04-10 00:38:39 +01:00
</ol>
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:SetFrame"></a>
<strong>Moveable:SetFrame(frame)</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Set frame number.
This will move the animation to the given frame.
The number of frames in an animation can be seen under the heading "End frame" in
the WadTool animation editor. If the animation has no frames, the only valid argument
is -1.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
2022-09-20 19:44:40 +01:00
<li><span class="parameter">frame</span>
2022-04-10 00:38:39 +01:00
<span class="types"><span class="type">int</span></span>
2022-09-20 19:44:40 +01:00
the new frame number
2022-04-10 00:38:39 +01:00
</li>
</ul>
2022-09-07 20:57:50 +01:00
</dd>
<dt>
<a name = "Moveable:GetSlotHP"></a>
<strong>Moveable:GetSlotHP(ID)</strong>
</dt>
<dd>
Get HP definded for that object type (hit points/health points) (Read Only).
2022-12-09 22:08:16 +00:00
2022-09-07 20:57:50 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ID</span>
<span class="types"><span class="type">int</span></span>
of the moveable slot type.
</li>
</ul>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:GetOCB"></a>
<strong>Moveable:GetOCB()</strong>
</dt>
<dd>
Get OCB (object code bit) of the moveable
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">int</span></span>
the moveable's current OCB value
</ol>
</dd>
<dt>
<a name = "Moveable:SetOCB"></a>
<strong>Moveable:SetOCB(OCB)</strong>
</dt>
<dd>
Set OCB (object code bit) of the moveable
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">OCB</span>
<span class="types"><span class="type">int</span></span>
the new value for the moveable's OCB
</li>
</ul>
2022-09-07 20:57:50 +01:00
</dd>
<dt>
<a name = "Moveable:GetItemFlags"></a>
<strong>Moveable:GetItemFlags()</strong>
</dt>
<dd>
Get the value stored in ItemFlags[x] (x is the value of the parameter)
2022-12-09 22:08:16 +00:00
2022-09-07 20:57:50 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">short</span></span>
id of the ItemFlags array
</ol>
</dd>
<dt>
<a name = "Moveable:SetItemFlags"></a>
<strong>Moveable:SetItemFlags(value)</strong>
</dt>
<dd>
Stores the value of the first parameter in the ItemFlags[x] (x is the value of the second parameter)
2022-12-09 22:08:16 +00:00
2022-09-07 20:57:50 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
<span class="types"><span class="type">short</span></span>
to store in the moveable's ItemFlags[x], short id of ItemFlags array to store the value.
</li>
</ul>
2022-07-16 13:02:52 +01:00
</dd>
<dt>
<a name = "Moveable:GetColor"></a>
<strong>Moveable:GetColor()</strong>
</dt>
<dd>
Get the moveable's color
2022-12-09 22:08:16 +00:00
2022-07-16 13:02:52 +01:00
<h3>Returns:</h3>
<ol>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
2022-07-16 13:02:52 +01:00
a copy of the moveable's color
</ol>
</dd>
<dt>
<a name = "Moveable:SetColor"></a>
<strong>Moveable:SetColor(color)</strong>
</dt>
<dd>
Set the moveable's color
2022-12-09 22:08:16 +00:00
2022-07-16 13:02:52 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">color</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
2022-07-16 13:02:52 +01:00
the new color of the moveable
</li>
</ul>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:GetAIBits"></a>
<strong>Moveable:GetAIBits()</strong>
</dt>
<dd>
Get AIBits of object
This will return a table with six values, each corresponding to
an active behaviour. If the object is in a certain AI mode, the table will
have a <em>1</em> in the corresponding cell. Otherwise, the cell will hold
a <em>0</em>.
1 - guard
2 - ambush
3 - patrol 1
4 - modify
5 - follow
6 - patrol 2
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
2022-11-18 15:34:45 +00:00
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
2022-04-10 00:38:39 +01:00
a table of AI bits
</ol>
</dd>
<dt>
<a name = "Moveable:SetAIBits"></a>
<strong>Moveable:SetAIBits(bits)</strong>
</dt>
<dd>
Set AIBits of object
Use this to force a moveable into a certain AI mode or modes, as if a certain nullmesh
(or more than one) had suddenly spawned beneath their feet.
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">bits</span>
2022-11-18 15:34:45 +00:00
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.6">table</a></span>
2022-04-10 00:38:39 +01:00
the table of AI bits
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> sas = TEN.Objects.GetMoveableByName(<span class="string">"sas_enemy"</span>)
sas:SetAIBits({<span class="number">1</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>})</pre>
</ul>
2022-07-10 12:13:58 +01:00
</dd>
<dt>
<a name = "Moveable:MeshIsVisible"></a>
<strong>Moveable:MeshIsVisible(index)</strong>
</dt>
<dd>
Get state of specified mesh visibility of object
Returns true if specified mesh is visible on an object, and false
if it is not visible.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a mesh
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
visibility status
</ol>
</dd>
<dt>
<a name = "Moveable:ShowMesh"></a>
<strong>Moveable:ShowMesh(index)</strong>
</dt>
<dd>
Makes specified mesh visible
Use this to show specified mesh of an object.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a mesh
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:HideMesh"></a>
<strong>Moveable:HideMesh(index)</strong>
</dt>
<dd>
Makes specified mesh invisible
Use this to hide specified mesh of an object.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a mesh
</li>
</ul>
2022-07-16 13:02:52 +01:00
</dd>
<dt>
<a name = "Moveable:ShatterMesh"></a>
<strong>Moveable:ShatterMesh(index)</strong>
</dt>
<dd>
Shatters specified mesh and makes it invisible
Note that you can re-enable mesh later by using ShowMesh().
2022-12-09 22:08:16 +00:00
2022-07-16 13:02:52 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a mesh
</li>
</ul>
2022-07-10 12:13:58 +01:00
</dd>
<dt>
<a name = "Moveable:MeshIsSwapped"></a>
<strong>Moveable:MeshIsSwapped(index)</strong>
</dt>
<dd>
Get state of specified mesh swap of object
Returns true if specified mesh is swapped on an object, and false
if it is not swapped.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a mesh
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
mesh swap status
</ol>
</dd>
<dt>
<a name = "Moveable:SwapMesh"></a>
<strong>Moveable:SwapMesh(index, index, optional)</strong>
</dt>
<dd>
Set state of specified mesh swap of object
Use this to swap specified mesh of an object.
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a slot to get meshswap from
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a slot to get meshswap from
</li>
<li><span class="parameter">optional</span>
<span class="types"><span class="type">int</span></span>
) index of a mesh from meshswap slot to use
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:UnswapMesh"></a>
<strong>Moveable:UnswapMesh(index)</strong>
</dt>
<dd>
Set state of specified mesh swap of object
Use this to bring back original unswapped mesh
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
<span class="types"><span class="type">int</span></span>
of a mesh to unswap
</li>
</ul>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
<a name = "Moveable:GetHitStatus"></a>
<strong>Moveable:GetHitStatus()</strong>
</dt>
<dd>
Get the hit status of the object
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
true if the moveable was hit by something in the last gameplay frame, false otherwise
</ol>
</dd>
<dt>
<a name = "Moveable:GetActive"></a>
<strong>Moveable:GetActive()</strong>
</dt>
<dd>
Determine whether the moveable is active or not
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
true if the moveable is active
</ol>
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:GetJointPosition"></a>
<strong>Moveable:GetJointPosition()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Get the object's joint position
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
2022-08-26 00:13:02 +01:00
a copy of the moveable's position
2022-04-10 00:38:39 +01:00
</ol>
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:GetRotation"></a>
<strong>Moveable:GetRotation()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Get the moveable's rotation
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-08-26 00:13:02 +01:00
<h3>Returns:</h3>
<ol>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
2022-08-26 00:13:02 +01:00
a copy of the moveable's rotation
</ol>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:SetRotation"></a>
<strong>Moveable:SetRotation(rotation)</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Set the moveable's rotation
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-08-26 00:13:02 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">rotation</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
2022-08-26 00:13:02 +01:00
The moveable's new rotation
</li>
</ul>
2022-04-10 00:38:39 +01:00
2022-07-10 12:13:58 +01:00
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:GetName"></a>
<strong>Moveable:GetName()</strong>
2022-07-10 12:13:58 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Get the moveable's name (its unique string identifier)
e.g. "door_back_room" or "cracked_greek_statue"
This corresponds with the "Lua Name" field in an object's properties in Tomb Editor.
2022-07-10 12:13:58 +01:00
2022-12-09 22:08:16 +00:00
2022-07-10 12:13:58 +01:00
<h3>Returns:</h3>
<ol>
2022-11-18 15:34:45 +00:00
<span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span>
2022-08-26 00:13:02 +01:00
the moveable's name
2022-07-10 12:13:58 +01:00
</ol>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:SetName"></a>
<strong>Moveable:SetName(string)</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Set the moveable's name (its unique string identifier)
e.g. "door_back_room" or "cracked_greek_statue"
It cannot be blank and cannot share a name with any existing object.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
2022-08-26 00:13:02 +01:00
<li><span class="parameter">string</span>
<span class="types"><span class="type">name</span></span>
the new moveable's name
2022-04-10 00:38:39 +01:00
</li>
</ul>
2022-08-26 00:13:02 +01:00
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
true if we successfully set the name, false otherwise (e.g. if another object has the name already)
</ol>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:GetValid"></a>
<strong>Moveable:GetValid()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Test if the object is in a valid state (i.e. has not been destroyed through Lua or killed by Lara).
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
2022-08-26 00:13:02 +01:00
<span class="types"><span class="type">valid</span></span>
bool true if the object is still not destroyed
2022-04-10 00:38:39 +01:00
</ol>
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:Destroy"></a>
<strong>Moveable:Destroy()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Destroy the moveable. This will mean it can no longer be used, except to re-initialise it with another object.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-11-18 15:34:45 +00:00
</dd>
<dt>
<a name = "Moveable:AttachObjCamera"></a>
<strong>Moveable:AttachObjCamera(mesh)</strong>
</dt>
<dd>
Attach camera to an object.
2022-12-09 22:08:16 +00:00
2022-11-18 15:34:45 +00:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">mesh</span>
<span class="types"><span class="type">int</span></span>
1 for camera, mesh 2 for target
</li>
</ul>
</dd>
<dt>
<a name = "Moveable:AnimFromObject"></a>
<strong>Moveable:AnimFromObject(ObjectID, animNumber, stateID)</strong>
</dt>
<dd>
Borrow animation from an object
2022-12-09 22:08:16 +00:00
2022-11-18 15:34:45 +00:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ObjectID</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../4 enums/Objects.ObjID.html#">ObjID</a></span>
2022-11-18 15:34:45 +00:00
to take animation and stateID from,
</li>
<li><span class="parameter">animNumber</span>
<span class="types"><span class="type">int</span></span>
animation from object
</li>
<li><span class="parameter">stateID</span>
<span class="types"><span class="type">int</span></span>
state from object
</li>
</ul>
2022-09-07 20:57:50 +01:00
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:GetPosition"></a>
<strong>Moveable:GetPosition()</strong>
2022-09-07 20:57:50 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Get the object's position
2022-09-07 20:57:50 +01:00
2022-12-09 22:08:16 +00:00
2022-09-20 19:44:40 +01:00
<h3>Returns:</h3>
<ol>
2022-09-07 20:57:50 +01:00
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
2022-09-20 19:44:40 +01:00
a copy of the moveable's position
</ol>
2022-09-07 20:57:50 +01:00
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:SetPosition"></a>
<strong>Moveable:SetPosition(position[, updateRoom])</strong>
2022-09-07 20:57:50 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Set the moveable's position
If you are moving a moveable whose behaviour involves knowledge of room geometry,
(e.g. a BADDY1, which uses it for pathfinding), then the second argument should
be true (or omitted, as true is the default). Otherwise, said moveable will not behave correctly.
2022-09-07 20:57:50 +01:00
2022-12-09 22:08:16 +00:00
2022-09-07 20:57:50 +01:00
<h3>Parameters:</h3>
<ul>
2022-09-20 19:44:40 +01:00
<li><span class="parameter">position</span>
2022-12-11 18:40:31 +00:00
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
2022-09-20 19:44:40 +01:00
the new position of the moveable
2022-09-07 20:57:50 +01:00
</li>
2022-09-20 19:44:40 +01:00
<li><span class="parameter">updateRoom</span>
<span class="types"><span class="type">bool</span></span>
Will room changes be automatically detected? Set to false if you are using overlapping rooms (default: true)
(<em>optional</em>)
2022-09-07 20:57:50 +01:00
</li>
</ul>
2022-04-10 00:38:39 +01:00
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:GetHP"></a>
<strong>Moveable:GetHP()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Get current HP (hit points/health points)
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
2022-09-20 19:44:40 +01:00
<span class="types"><span class="type">int</span></span>
the amount of HP the moveable currently has
2022-04-10 00:38:39 +01:00
</ol>
</dd>
<dt>
2022-09-20 19:44:40 +01:00
<a name = "Moveable:SetHP"></a>
<strong>Moveable:SetHP(HP)</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-09-20 19:44:40 +01:00
Set current HP (hit points/health points)
Clamped to [0, 32767] for "intelligent" entities (i.e. anything with AI); clamped to [-32767, 32767] otherwise.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Parameters:</h3>
<ul>
2022-09-20 19:44:40 +01:00
<li><span class="parameter">HP</span>
<span class="types"><span class="type">int</span></span>
the amount of HP to give the moveable
2022-04-10 00:38:39 +01:00
</li>
</ul>
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:GetRoom"></a>
<strong>Moveable:GetRoom()</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Get the current room of the object
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-04-10 00:38:39 +01:00
<h3>Returns:</h3>
<ol>
2022-08-26 00:13:02 +01:00
<span class="types"><span class="type">int</span></span>
number representing the current room of the object
2022-04-10 00:38:39 +01:00
</ol>
</dd>
<dt>
2022-08-26 00:13:02 +01:00
<a name = "Moveable:SetRoom"></a>
<strong>Moveable:SetRoom(ID)</strong>
2022-04-10 00:38:39 +01:00
</dt>
<dd>
2022-08-26 00:13:02 +01:00
Set room of object
Use this if you are not using SetPosition's automatic room update - for example, when dealing with overlapping rooms.
2022-04-10 00:38:39 +01:00
2022-12-09 22:08:16 +00:00
2022-08-26 00:13:02 +01:00
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ID</span>
<span class="types"><span class="type">int</span></span>
the ID of the new room
</li>
</ul>
2022-04-10 00:38:39 +01:00
2022-08-26 00:13:02 +01:00
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> sas = TEN.Objects.GetMoveableByName(<span class="string">"sas_enemy"</span>)
sas:SetRoom(destinationRoom)
sas:SetPosition(destinationPosition, <span class="keyword">false</span>)</pre>
</ul>
2022-04-10 00:38:39 +01:00
</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>
2022-12-11 18:40:31 +00:00
<i style="float:right;">Last updated 2022-12-11 18:38:45 </i>
2022-04-10 00:38:39 +01:00
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>