467 lines
15 KiB
HTML
467 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<title>Gun-methods - Guns4d</title>
|
|
<link href="../prism.css?7653a2d" rel="stylesheet" />
|
|
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
|
|
|
|
</head>
|
|
<body class="module-gunmethods">
|
|
<div class="topbar">
|
|
<div class="group one">
|
|
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
|
|
</div>
|
|
<div class="group two">
|
|
</div>
|
|
<div class="group three">
|
|
<div class="button iconleft"><a href="../module/Control_handler.html" title="Control_handler"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
|
|
<div class="button iconright"><a href="../module/Gun.html" title="Gun"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
|
|
</div>
|
|
</div>
|
|
<div class="sidebar">
|
|
<form action="../search.html">
|
|
<input class="search" name="q" type="search" placeholder="Search" />
|
|
</form>
|
|
<div class="sections">
|
|
<div class="heading">Contents</div>
|
|
<ul>
|
|
<li><a href="#Gun-methods">Module <code>Gun-methods</code></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="manual">
|
|
<div class="heading">Manual</div>
|
|
<ul>
|
|
<li><a href="../manual/changelog.html">changelog 1.3.0</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="classes">
|
|
<div class="heading">Classes</div>
|
|
<ul>
|
|
<li><a href="../class/gun.html">Gun</a></li>
|
|
<li><a href="../class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="modules">
|
|
<div class="heading">Modules</div>
|
|
<ul>
|
|
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
|
|
<li><a href="../module/play_sound.html">play_sound</a></li>
|
|
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
|
|
<li><a href="../module/Control_handler.html">Control_handler</a></li>
|
|
<li class="selected"><a href="../module/Gun-methods.html">Gun-methods</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="body">
|
|
<div class="section">
|
|
<h2 class="module" id="Gun-methods">Module <code>Gun-methods</code>
|
|
<a class="permalink" href="#Gun-methods" title="Permalink to this definition">¶</a>
|
|
</h2>
|
|
<div class="inner">
|
|
<div class="synopsis">
|
|
<h3>Synopsis</h3>
|
|
<div class="heading">Functions</div>
|
|
<table class="functions ">
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update"><var>gun_default:update</var></a>()</td>
|
|
<td class="doc"><p>The entry method for the update of the gun</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_visuals"><var>gun_default:update_visuals</var></a>()</td>
|
|
<td class="doc"><p>not typically called every step, updates the gun object's visuals</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_transforms"><var>gun_default:update_transforms</var></a>()</td>
|
|
<td class="doc"><p>updates self.total_offsets which stores offsets for bones</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_burstfire"><var>gun_default:update_burstfire</var></a>()</td>
|
|
<td class="doc"><p>Update and fire the queued weapon burst</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.cycle_firemodes"><var>gun_default:cycle_firemodes</var></a>()</td>
|
|
<td class="doc"><p>cycles to the next firemode of the weapon</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_image_and_text_meta"><var>gun_default:update_image_and_text_meta</var></a>()</td>
|
|
<td class="doc"><p>update the inventory information of the gun</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.draw"><var>gun_default:draw</var></a>()</td>
|
|
<td class="doc"><p>plays the draw animation and sound for the gun, delays usage</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.attempt_fire"><var>gun_default:attempt_fire</var></a>()</td>
|
|
<td class="doc"><p>attempt to fire the gun</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.recoil"><var>gun_default:recoil</var></a>()</td>
|
|
<td class="doc"><p>simulate recoil by adding to the recoil velocity (called by attempt_fire)</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_look_offsets"><var>gun_default:update_look_offsets</var></a>()</td>
|
|
<td class="doc"><p>update the offsets of the player's look created by the gun</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.get_pos"><var>gun_default:get_pos</var></a>()</td>
|
|
<td class="doc"><p>get the global position of the gun</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.add_entity"><var>gun_default:add_entity</var></a>()</td>
|
|
<td class="doc"><p>adds the gun entity</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_entity"><var>gun_default:update_entity</var></a>()</td>
|
|
<td class="doc"><p>updates the gun's entity</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.has_entity"><var>gun_default:has_entity</var></a>()</td>
|
|
<td class="doc"><p>checks if the gun entity exists</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_wag"><var>gun_default:update_wag</var></a>()</td>
|
|
<td class="doc"><p>updates the gun's wag offset for walking</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_recoil"><var>gun_default:update_recoil</var></a>()</td>
|
|
<td class="doc"><p>updates the gun's recoil simulation</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.update_animation"><var>gun_default:update_animation</var></a>()</td>
|
|
<td class="doc"><p>updates the gun's animation data</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.set_animation"><var>gun_default:set_animation</var></a>()</td>
|
|
<td class="doc"><p>sets the gun's animation in the same format as ObjRef:set_animation() (future deprecation?)</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.clear_animation"><var>gun_default:clear_animation</var></a>()</td>
|
|
<td class="doc"><p>clears the animation to the rest state</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.play_sounds"><var>gun_default:play_sounds</var></a>()</td>
|
|
<td class="doc"><p>plays a list of sounds for the gun's user and thirdpersons</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><a href="#gun_default.prepare_deletion"><var>gun_default:prepare_deletion</var></a>()</td>
|
|
<td class="doc"><p>ready the gun to be deleted</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<dl class="functions">
|
|
<dt id="gun_default.update">
|
|
<span class="icon"></span><var>gun_default:update</var>(<em>dt</em>)
|
|
<a class="permalink" href="#gun_default.update" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>The entry method for the update of the gun</p>
|
|
<p>calls virtually all functions that begin with <code>update</code> once. Also updates subclass</p>
|
|
|
|
<div class="heading">Parameters</div>
|
|
<table class="parameters">
|
|
<tr>
|
|
<td class="name"><var>dt</var></td>
|
|
<td class="types">(<em>float</em>)</td>
|
|
<td class="doc"></td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.update_visuals">
|
|
<span class="icon"></span><var>gun_default:update_visuals</var>()
|
|
<a class="permalink" href="#gun_default.update_visuals" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>not typically called every step, updates the gun object's visuals</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.update_transforms">
|
|
<span class="icon"></span><var>gun_default:update_transforms</var>()
|
|
<a class="permalink" href="#gun_default.update_transforms" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>updates self.total_offsets which stores offsets for bones</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.update_burstfire">
|
|
<span class="icon"></span><var>gun_default:update_burstfire</var>()
|
|
<a class="permalink" href="#gun_default.update_burstfire" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>Update and fire the queued weapon burst</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.cycle_firemodes">
|
|
<span class="icon"></span><var>gun_default:cycle_firemodes</var>()
|
|
<a class="permalink" href="#gun_default.cycle_firemodes" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>cycles to the next firemode of the weapon</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.update_image_and_text_meta">
|
|
<span class="icon"></span><var>gun_default:update_image_and_text_meta</var>(<em>meta</em>)
|
|
<a class="permalink" href="#gun_default.update_image_and_text_meta" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>update the inventory information of the gun</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.draw">
|
|
<span class="icon"></span><var>gun_default:draw</var>()
|
|
<a class="permalink" href="#gun_default.draw" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>plays the draw animation and sound for the gun, delays usage.</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.attempt_fire">
|
|
<span class="icon"></span><var>gun_default:attempt_fire</var>()
|
|
<a class="permalink" href="#gun_default.attempt_fire" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>attempt to fire the gun</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.recoil">
|
|
<span class="icon"></span><var>gun_default:recoil</var>()
|
|
<a class="permalink" href="#gun_default.recoil" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>simulate recoil by adding to the recoil velocity (called by attempt_fire)</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.update_look_offsets">
|
|
<span class="icon"></span><var>gun_default:update_look_offsets</var>(<em>dt</em>)
|
|
<a class="permalink" href="#gun_default.update_look_offsets" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>update the offsets of the player's look created by the gun</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.get_pos">
|
|
<span class="icon"></span><var>gun_default:get_pos</var>(<em>offset</em>, <em>relative_y</em>, <em>relative_x</em>, <em>with_animation</em>)
|
|
<a class="permalink" href="#gun_default.get_pos" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>get the global position of the gun. This is customized to rely on the assumption that there are 3-4 main rotations and 2-3 translations. If the behavior of the bones are changed this method may not work.
|
|
the point of this is to allow the user to find the gun's object origin as well as calculate where a given point should be offset given the parameters.</p>
|
|
|
|
<div class="heading">Parameters</div>
|
|
<table class="parameters">
|
|
<tr>
|
|
<td class="name"><var>offset</var></td>
|
|
<td class="types">()</td>
|
|
<td class="doc"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><var>relative_y</var></td>
|
|
<td class="types">(<em>bool</em>)</td>
|
|
<td class="doc"><p>wether the y axis is relative to the player's look</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><var>relative_x</var></td>
|
|
<td class="types">(<em>bool</em>)</td>
|
|
<td class="doc"><p>wether the x axis is relative to the player's look</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><var>with_animation</var></td>
|
|
<td class="types">(<em>bool</em>)</td>
|
|
<td class="doc"><p>wether rotational and translational offsets from the animation are applied</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<div class="heading">Return Values</div>
|
|
<table class="returns">
|
|
<tr>
|
|
<td class="types">(<em>vec3</em>)</td>
|
|
<td class="doc"><p>position of gun (in global or local orientation) relative to the player's position</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.add_entity">
|
|
<span class="icon"></span><var>gun_default:add_entity</var>()
|
|
<a class="permalink" href="#gun_default.add_entity" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>adds the gun entity</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.update_entity">
|
|
<span class="icon"></span><var>gun_default:update_entity</var>()
|
|
<a class="permalink" href="#gun_default.update_entity" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>updates the gun's entity</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.has_entity">
|
|
<span class="icon"></span><var>gun_default:has_entity</var>()
|
|
<a class="permalink" href="#gun_default.has_entity" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>checks if the gun entity exists...</p>
|
|
|
|
<div class="heading">Return Values</div>
|
|
<table class="returns">
|
|
<tr>
|
|
<td class="types">(<em>bool</em>)</td>
|
|
<td class="doc"></td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.update_wag">
|
|
<span class="icon"></span><var>gun_default:update_wag</var>(<em>dt</em>)
|
|
<a class="permalink" href="#gun_default.update_wag" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>updates the gun's wag offset for walking</p>
|
|
|
|
<div class="heading">Parameters</div>
|
|
<table class="parameters">
|
|
<tr>
|
|
<td class="name"><var>dt</var></td>
|
|
<td class="types">(<em>float</em>)</td>
|
|
<td class="doc"></td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.update_recoil">
|
|
<span class="icon"></span><var>gun_default:update_recoil</var>(<em>dt</em>)
|
|
<a class="permalink" href="#gun_default.update_recoil" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>updates the gun's recoil simulation</p>
|
|
|
|
<div class="heading">Parameters</div>
|
|
<table class="parameters">
|
|
<tr>
|
|
<td class="name"><var>dt</var></td>
|
|
<td class="types">(<em>float</em>)</td>
|
|
<td class="doc"></td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.update_animation">
|
|
<span class="icon"></span><var>gun_default:update_animation</var>(<em>dt</em>)
|
|
<a class="permalink" href="#gun_default.update_animation" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>updates the gun's animation data</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.set_animation">
|
|
<span class="icon"></span><var>gun_default:set_animation</var>(<em>frames</em>, <em>length</em>, <em>fps</em>, <em>loop</em>)
|
|
<a class="permalink" href="#gun_default.set_animation" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>sets the gun's animation in the same format as ObjRef:set_animation() (future deprecation?)</p>
|
|
|
|
<div class="heading">Parameters</div>
|
|
<table class="parameters">
|
|
<tr>
|
|
<td class="name"><var>frames</var></td>
|
|
<td class="types">(<em><a href="../module/misc_helpers.html#table">table</a></em>)</td>
|
|
<td class="doc"><p><code>{x=int, y=int}</code></p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><var>length</var></td>
|
|
<td class="types">(<em>float</em> or <em>nil</em>)</td>
|
|
<td class="doc"><p>length of the animation in seconds</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><var>fps</var></td>
|
|
<td class="types">(<em>int</em>)</td>
|
|
<td class="doc"><p>frames per second of the animation</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><var>loop</var></td>
|
|
<td class="types">(<em>bool</em>)</td>
|
|
<td class="doc"><p>wether to loop</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.clear_animation">
|
|
<span class="icon"></span><var>gun_default:clear_animation</var>()
|
|
<a class="permalink" href="#gun_default.clear_animation" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>clears the animation to the rest state</p>
|
|
|
|
</dd>
|
|
<dt id="gun_default.play_sounds">
|
|
<span class="icon"></span><var>gun_default:play_sounds</var>(<em>sound</em>)
|
|
<a class="permalink" href="#gun_default.play_sounds" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>plays a list of sounds for the gun's user and thirdpersons</p>
|
|
|
|
<div class="heading">Parameters</div>
|
|
<table class="parameters">
|
|
<tr>
|
|
<td class="name"><var>sound</var></td>
|
|
<td class="types">(<em>soundspec_list</em>)</td>
|
|
<td class="doc"><p>parameters following the format of <a href="../module/play_sound.html#Guns4d.play_sounds">Guns4d.play_sounds()</a></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<div class="heading">Return Values</div>
|
|
<table class="returns">
|
|
<tr>
|
|
<td class="name">1.</td>
|
|
<td class="types">(<em>integer</em>)</td>
|
|
<td class="doc"><p>thirdperson sound's guns4d sound handle</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">2.</td>
|
|
<td class="types">(<em>integer</em>)</td>
|
|
<td class="doc"><p>firstperson sound's guns4d sound handle</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</dd>
|
|
<dt id="gun_default.prepare_deletion">
|
|
<span class="icon"></span><var>gun_default:prepare_deletion</var>()
|
|
<a class="permalink" href="#gun_default.prepare_deletion" title="Permalink to this definition">¶</a>
|
|
</dt>
|
|
<dd>
|
|
<p>ready the gun to be deleted</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="../prism.js?7653a2d"></script>
|
|
</body>
|
|
</html> |