2025-01-03 16:26:36 -08:00

805 lines
41 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 - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="module-gun">
<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="../manual/changelog.html" title="changelog"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
<div class="button iconright"><a href="../class/player_model_handler.html" title="player_model_handler"><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">Module <code>Gun</code></a></li>
<li><a href="#lvl1_fields.properties"><p>properties</p>
</a></li>
<li><a href="#gun.properties.inventory"><p>properties.inventory</p>
</a></li>
<li><a href="#gun.properties.subclsses"><p>properties.subclasses</p>
</a></li>
<li><a href="#gun.properties.ads"><p>properties.ads</p>
</a></li>
<li><a href="#gun.properties.hip"><p>properties.hip</p>
</a></li>
<li><a href="#gun.properties.firemodes"><p>properties.firemodes</p>
</a></li>
<li><a href="#gun.properties.recoil"><p>properties.recoil</p>
</a></li>
<li><a href="#gun.properties.sway"><p>properties.sway</p>
</a></li>
<li><a href="#gun.properties.wag"><p>properties.wag</p>
</a></li>
<li><a href="#gun.properties.charging"><p>properties.charging</p>
</a></li>
<li><a href="#gun.properties.ammo"><p>properties.ammo</p>
</a></li>
<li><a href="#gun.properties.visuals"><p>properties.visuals</p>
</a></li>
<li><a href="#gun.properties.sounds"><p>properties.sounds</p>
</a></li>
<li><a href="#lvl1_fields.offsets"><p>offsets</p>
</a></li>
<li><a href="#lvl1_fields.consts"><p>consts</p>
</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 class="selected"><a href="../module/Gun.html">Gun.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><a href="../module/Gun-methods.html">Gun-methods</a></li>
<li class="selected"><a href="../module/Gun.html">Gun</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="module" id="Gun">Module <code>Gun</code>
<a class="permalink" href="#Gun" title="Permalink to this definition"></a>
</h2>
<div class="inner">
</div>
</div>
<div class="section">
<h2 class="table" id="lvl1_fields.properties">properties
<a class="permalink" href="#lvl1_fields.properties" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>the table containing every attribute of the gun.</p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="lvl1_fields.properties.hip">hip</var><a class="permalink" href="#lvl1_fields.properties.hip" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.hip">hipfire properties</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.ads">ads</var><a class="permalink" href="#lvl1_fields.properties.ads" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.ads">aiming (&quot;aiming down sights&quot;) properties</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.firemodes">firemodes</var><a class="permalink" href="#lvl1_fields.properties.firemodes" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.firemodes">list of firemodes</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.recoil">recoil</var><a class="permalink" href="#lvl1_fields.properties.recoil" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.recoil">defines the guns recoil</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.sway">sway</var><a class="permalink" href="#lvl1_fields.properties.sway" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.sway">defines the guns idle sway</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.wag">wag</var><a class="permalink" href="#lvl1_fields.properties.wag" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.wag">defines the movement of the gun while walking</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.charging">charging</var><a class="permalink" href="#lvl1_fields.properties.charging" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.charging">defines how rounds are chambered into the gun</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.ammo">ammo</var><a class="permalink" href="#lvl1_fields.properties.ammo" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.ammo">defines what ammo the gun uses</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.visuals">visuals</var><a class="permalink" href="#lvl1_fields.properties.visuals" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.visuals">defines visual attributes of the gun</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.sounds">sounds</var><a class="permalink" href="#lvl1_fields.properties.sounds" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.sounds">defines sounds to be used by functions of the gun</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.inventory">inventory</var><a class="permalink" href="#lvl1_fields.properties.inventory" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../module/Gun.html#gun.properties.inventory">inventory related attributes</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.initial_vertical_rotation">initial_vertical_rotation</var><a class="permalink" href="#lvl1_fields.properties.initial_vertical_rotation" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> starting vertical rotation of the gun</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.breathing_scale">breathing_scale</var><a class="permalink" href="#lvl1_fields.properties.breathing_scale" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code>=.5 max angular deviation (vertical) from breathing</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.flash_offset">flash_offset</var><a class="permalink" href="#lvl1_fields.properties.flash_offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> the offset from the center of the muzzle flash. Used by fire()</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.firerateRPM">firerateRPM</var><a class="permalink" href="#lvl1_fields.properties.firerateRPM" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>int</code>=600 The number of rounds (cartidges) this gun can throw per minute. Used by update(), fire() and default controls</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.reload">reload</var><a class="permalink" href="#lvl1_fields.properties.reload" title="Permalink to this definition"></a></td>
<td class="doc"><p>an ordered list of reloading states used by default_controls.</p>
<p>the default reload states for a magazine operated weapon, copied from the m4.</p>
<h5>Example</h5>
<pre><code class="language-lua">{action=&quot;charge&quot;, time=.5, anim=&quot;charge&quot;, sounds={sound=&quot;ar_charge&quot;, delay = .2}},
{action=&quot;unload_mag&quot;, time=.25, anim=&quot;unload&quot;, sounds = {sound=&quot;ar_mag_unload&quot;}},
{action=&quot;store&quot;, time=.5, anim=&quot;store&quot;, sounds = {sound=&quot;ar_mag_store&quot;}},
{action=&quot;load&quot;, time=.5, anim=&quot;load&quot;, sounds = {sound=&quot;ar_mag_load&quot;, delay = .25}},
{action=&quot;charge&quot;, time=.5, anim=&quot;charge&quot;, sounds={sound=&quot;ar_charge&quot;, delay = .2}}
</code></pre>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.model_bounding_box">model_bounding_box</var><a class="permalink" href="#lvl1_fields.properties.model_bounding_box" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> (optional) a table <code>{x1,y1,z1, x2,y2,z2}</code> specifying the bounding box of the model. The first 3 (x1,y1,z1) are the lower of their counterparts. This is autogenerated from the model when not present, reccomended that you leave nil.</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.infinite_inventory_overlay">infinite_inventory_overlay</var><a class="permalink" href="#lvl1_fields.properties.infinite_inventory_overlay" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> overlay on the item to use when infinite ammo is on</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.burst">burst</var><a class="permalink" href="#lvl1_fields.properties.burst" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>int</code>=3 how many rounds in burst using when firemode is at &quot;burst&quot;</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.pc_control_actions">pc_control_actions</var><a class="permalink" href="#lvl1_fields.properties.pc_control_actions" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> containing a list of actions for PC users passed to <a href="../module/Control_handler.html">Control_handler</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.touch_control_actions">touch_control_actions</var><a class="permalink" href="#lvl1_fields.properties.touch_control_actions" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> containing a list of actions for touch screen users passed to <a href="../module/Control_handler.html">Control_handler</a></p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.inventory">properties.inventory
<a class="permalink" href="#gun.properties.inventory" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.inventory.render_size">render_size</var><a class="permalink" href="#gun.properties.inventory.render_size" title="Permalink to this definition"></a></td>
<td class="doc"><p>the size in meters to render the gun in it's inventory opened with /guns4d_inv</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.inventory.render_image">render_image</var><a class="permalink" href="#gun.properties.inventory.render_image" title="Permalink to this definition"></a></td>
<td class="doc"><p>the image of the gun in it's inventory opened with /guns4d_inv</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.inventory.firemode_inventory_overlays">firemode_inventory_overlays</var><a class="permalink" href="#gun.properties.inventory.firemode_inventory_overlays" title="Permalink to this definition"></a></td>
<td class="doc"><p>table of firemodes and their overlays in the player's inventory when the gun is on that firemode</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.inventory.inventory_image_magless">inventory_image_magless</var><a class="permalink" href="#gun.properties.inventory.inventory_image_magless" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> (optional) inventory image for when the gun has no magazine</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.inventory.inventory_image">inventory_image</var><a class="permalink" href="#gun.properties.inventory.inventory_image" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> inventory image for when the gun is loaded. This is added automatically during construction.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.subclsses">properties.subclasses
<a class="permalink" href="#gun.properties.subclsses" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.subclsses.ammo_handler">ammo_handler</var><a class="permalink" href="#gun.properties.subclsses.ammo_handler" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>Ammo_handler</code> the class (based on) ammo_handler to create an instance of and use. Default is <code>Guns4d.ammo_handler</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.subclsses.part_handler">part_handler</var><a class="permalink" href="#gun.properties.subclsses.part_handler" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/Gun.html#gun.properties.subclsses.part_handler"><code>part_handler</code></a> Part_handler class to use. Default is <code>Guns4d.part_handler</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.subclsses.sprite_scope">sprite_scope</var><a class="permalink" href="#gun.properties.subclsses.sprite_scope" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>Sprite_scope</code> sprite scope class to use. Nil by default, inherit Sprite_scope for class (<strong>documentation needed, reccomended contact for help if working with it</strong>)</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.subclsses.crosshair">crosshair</var><a class="permalink" href="#gun.properties.subclsses.crosshair" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>Dynamic_crosshair</code> crosshair class to use. Nil by default, set to <code>Guns4d.Dynamic_crosshair</code> for a generic circular expanding reticle.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.ads">properties.ads
<a class="permalink" href="#gun.properties.ads" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.ads.offset">offset</var><a class="permalink" href="#gun.properties.ads.offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> the offset of the gun relative to the eye's position at hip.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ads.horizontal_offset">horizontal_offset</var><a class="permalink" href="#gun.properties.ads.horizontal_offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> the horizontal offset of the eye when aiming</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ads.aim_time">aim_time</var><a class="permalink" href="#gun.properties.ads.aim_time" title="Permalink to this definition"></a></td>
<td class="doc"><p>the time it takes to go into full aim</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.hip">properties.hip
<a class="permalink" href="#gun.properties.hip" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.hip.offset">offset</var><a class="permalink" href="#gun.properties.hip.offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> the offset of the gun (relative to the right arm's default position) at hip.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.hip.axis_rotation_ratio">axis_rotation_ratio</var><a class="permalink" href="#gun.properties.hip.axis_rotation_ratio" title="Permalink to this definition"></a></td>
<td class="doc"><p>the ratio that the look rotation is expressed through player_axial (rotated around the viewport) rotation as opposed to gun_axial (rotating the entity).</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.hip.sway_vel_mul">sway_vel_mul</var><a class="permalink" href="#gun.properties.hip.sway_vel_mul" title="Permalink to this definition"></a></td>
<td class="doc"><p>sway speed multiplier while at hip</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.hip.sway_angle_mul">sway_angle_mul</var><a class="permalink" href="#gun.properties.hip.sway_angle_mul" title="Permalink to this definition"></a></td>
<td class="doc"><p>sway angle multiplier while at hip</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.firemodes">properties.firemodes
<a class="permalink" href="#gun.properties.firemodes" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>list containing the firemodes of the gun. Default only contains &quot;single&quot;. Strings allowed by default:
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.firemodes."single"">"single"</var><a class="permalink" href="#gun.properties.firemodes."single"" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemodes."burst"">"burst"</var><a class="permalink" href="#gun.properties.firemodes."burst"" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemodes."auto"">"auto"</var><a class="permalink" href="#gun.properties.firemodes."auto"" title="Permalink to this definition"></a></td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.recoil">properties.recoil
<a class="permalink" href="#gun.properties.recoil" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p><strong>IMPORTANT</strong>: expects fields to be tables containing a &quot;gun_axial&quot; and &quot;player_axial&quot; field.
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<h5>Example</h5>
<pre><code class="language-lua">property = {
gun_axial = type
player_axial = type
}
--using a vector...
property = {
gun_axial={x=float, y=float},
player_axial={x=float, y=float}
}`
</code></pre>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.recoil.velocity_correction_factor">velocity_correction_factor</var><a class="permalink" href="#gun.properties.recoil.velocity_correction_factor" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> TL:DR higher decreases recoil at expense of smoothness. 1/value is the deviation of a normalized bell curve, where x is the time since firing.
this means that increasing it decreases the time it takes for the angular velocity to fully &quot;decay&quot;.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.target_correction_factor">target_correction_factor</var><a class="permalink" href="#gun.properties.recoil.target_correction_factor" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> Correction of recoil offset per second is calculated as such: <code>target_correction_factor[axis]*time_since_fire*recoil[axis]</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.target_correction_max_rate">target_correction_max_rate</var><a class="permalink" href="#gun.properties.recoil.target_correction_max_rate" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> The maximum rate per second of recoil offset as determined with <a href="../module/Gun.html#gun.properties.recoil.target_correction_factor">gun.properties.recoil.target_correction_factor</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.angular_velocity_max">angular_velocity_max</var><a class="permalink" href="#gun.properties.recoil.angular_velocity_max" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> caps the recoil velocity that can stack up from shots.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.angular_velocity">angular_velocity</var><a class="permalink" href="#gun.properties.recoil.angular_velocity" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> {x=<code>float</code>, y=<code>float</code>}, defines the initial angular velocity produced by firing the gun</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.bias">bias</var><a class="permalink" href="#gun.properties.recoil.bias" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> {x=<code>float</code>, y=<code>float</code>}, ranges -1 to 1. Defines the probability of the recoil being positive or negative for any given axis.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.hipfire_multiplier">hipfire_multiplier</var><a class="permalink" href="#gun.properties.recoil.hipfire_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> angular velocity multiplier when firing from the hip</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.sway">properties.sway
<a class="permalink" href="#gun.properties.sway" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p><strong>IMPORTANT</strong>: expects fields to be tables containing a &quot;gun_axial&quot; and &quot;player_axial&quot; field. In the same format as <a href="../module/Gun.html#gun.properties.recoil">gun.properties.recoil</a>
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.sway.max_angle">max_angle</var><a class="permalink" href="#gun.properties.sway.max_angle" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> maximum angle of the sway</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.sway.angular_velocity">angular_velocity</var><a class="permalink" href="#gun.properties.sway.angular_velocity" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> angular velocity the sway</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.sway.hipfire_angle_multiplier">hipfire_angle_multiplier</var><a class="permalink" href="#gun.properties.sway.hipfire_angle_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> maximum angle multiplier while the gun is at the hip</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.sway.hipfire_velocity_multiplier">hipfire_velocity_multiplier</var><a class="permalink" href="#gun.properties.sway.hipfire_velocity_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> velocity multiplier while the gun is at the hip</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.wag">properties.wag
<a class="permalink" href="#gun.properties.wag" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.wag.cycle_speed">cycle_speed</var><a class="permalink" href="#gun.properties.wag.cycle_speed" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code>=1.6 the cycle speed multiplier</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.wag.decay_speed">decay_speed</var><a class="permalink" href="#gun.properties.wag.decay_speed" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code>=1 decay factor when walking has stopped and offset remains.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.wag.offset">offset</var><a class="permalink" href="#gun.properties.wag.offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> containing angular deviation while walking in the same format as <a href="../module/Gun.html#gun.properties.recoil">an offset vector</a>. Acts as a multiplier on the figure-8 generated while walking.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.charging">properties.charging
<a class="permalink" href="#gun.properties.charging" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.charging.require_draw_on_swap">require_draw_on_swap</var><a class="permalink" href="#gun.properties.charging.require_draw_on_swap" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> defines wether the draw animation is played on swap (when loaded). Default true.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.bolt_charge_mode">bolt_charge_mode</var><a class="permalink" href="#gun.properties.charging.bolt_charge_mode" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> &quot;none&quot; bolt will never need to be charged after reload, &quot;catch&quot; when fired to empty bolt will not need to be charged after reload, &quot;no_catch&quot; bolt will always need to be charged after reload.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.draw_time">draw_time</var><a class="permalink" href="#gun.properties.charging.draw_time" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> the time it takes to swap to the gun</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.draw_animation">draw_animation</var><a class="permalink" href="#gun.properties.charging.draw_animation" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> name of the animation to play from <a href="../module/Gun.html#gun.properties.visuals.animations">visuals.animations</a>. Default &quot;draw&quot;</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.draw_sound">draw_sound</var><a class="permalink" href="#gun.properties.charging.draw_sound" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> name of the sound to play from <a href="../module/Gun.html#gun.properties.sounds">sounds</a>. Default &quot;draw&quot;</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.ammo">properties.ammo
<a class="permalink" href="#gun.properties.ammo" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.ammo.magazine_only">magazine_only</var><a class="permalink" href="#gun.properties.ammo.magazine_only" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> wether the gun only uses a magazine or accepts raw ammunition too.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ammo.accepted_bullets">accepted_bullets</var><a class="permalink" href="#gun.properties.ammo.accepted_bullets" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> a list of accepted bullet itemstrings</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ammo.accepted_magazines">accepted_magazines</var><a class="permalink" href="#gun.properties.ammo.accepted_magazines" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> a list of accepted magazine itemstrings</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ammo.initial_mag">initial_mag</var><a class="permalink" href="#gun.properties.ammo.initial_mag" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> the mag the gun starts with. Set to &quot;empty&quot; for no mag, otherwise it defaults to accepted_magazines[1] (if present)</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.visuals">properties.visuals
<a class="permalink" href="#gun.properties.visuals" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.visuals.mesh">mesh</var><a class="permalink" href="#gun.properties.visuals.mesh" title="Permalink to this definition"></a></td>
<td class="doc"><p>name of mesh to display. Currently only supports b3d</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.visuals.textures">textures</var><a class="permalink" href="#gun.properties.visuals.textures" title="Permalink to this definition"></a></td>
<td class="doc"><p>list of textures to use.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.visuals.scale">scale</var><a class="permalink" href="#gun.properties.visuals.scale" title="Permalink to this definition"></a></td>
<td class="doc"><p>scale multiplier. Default 1</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.visuals.attached_objects">attached_objects</var><a class="permalink" href="#gun.properties.visuals.attached_objects" title="Permalink to this definition"></a></td>
<td class="doc"><p>objects that are attached to the gun. This is especially useful for attachments</p>
<h5>Example</h5>
<pre><code class="language-lua">my_object = {
textures = {&quot;blank.png&quot;},
visual_size = {x=1,y=1,z=1},
offset = {x=0,y=0,z=0},
bone = &quot;main&quot;,
backface_culling = false,
glow = 0
}
</code></pre>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.visuals.backface_culling">backface_culling</var><a class="permalink" href="#gun.properties.visuals.backface_culling" title="Permalink to this definition"></a></td>
<td class="doc"><p>toggles backface culling. Default true</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.visuals.animations">animations</var><a class="permalink" href="#gun.properties.visuals.animations" title="Permalink to this definition"></a></td>
<td class="doc"><p>a table of animations. Indexes define the name of the animation to be refrenced by other functions of the gun.
should be in the format <code>{x=integer,y=integer}</code></p>
<h5>Example</h5>
<pre><code class="language-lua">animations = {
empty = {x=0,y=0}
loaded = {x=1,y=1}
fire = {x=10,y=20}
draw = {x=24,y=30} --DEFAULT of charging.draw_animation.
}
</code></pre>
<p>There are other animations which are variable which are not listed here, these are usually defined by properties such as:
reload, <a href="../module/Gun.html#gun.properties.charging.draw_animation">draw_animation</a></p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.sounds">properties.sounds
<a class="permalink" href="#gun.properties.sounds" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>other fields are defined by other properties such as <a href="../module/Gun.html#gun.properties.charging.draw_sound">properties.charging.draw_sound</a> and <a href="../module/Gun.html#lvl1_fields.properties.reload">properties.reload</a>
<div class="see">See also <a href="../module/Gun.html#lvl1_fields.properties">properties</a></div>
<div class="see">See also <a href="../module/play_sound.html#guns4d_soundspec">soundspec</a></div>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.sounds.fire">fire</var><a class="permalink" href="#gun.properties.sounds.fire" title="Permalink to this definition"></a></td>
<td class="doc"><p>sound player when firing the weapon</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="lvl1_fields.offsets">offsets
<a class="permalink" href="#lvl1_fields.offsets" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>a list of tables each containing offset vectors These are required for automatic initialization of offsets.
note rotations are in degrees, and translations are in meters.</p>
<h5>Example</h5>
<pre><code class="language-lua">recoil = {
gun_axial = {x=0, y=0}, --rotation of the gun around it's origin.
player_axial = {x=0, y=0}, --rotation of the gun around the bone it's attached to
--translations of gun
player_trans = {x=0, y=0, z=0}, --translation of the bone the gun is attached to
eye_trans = {x=0, y=0, z=0}, --trnaslation of the player's look
gun_tran = {x=0, y=0, z=0}s --translation of the gun relative to the bone it's attachted to.
}
</code></pre>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="lvl1_fields.offsets.recoil">recoil</var><a class="permalink" href="#lvl1_fields.offsets.recoil" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.sway">sway</var><a class="permalink" href="#lvl1_fields.offsets.sway" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.walking">walking</var><a class="permalink" href="#lvl1_fields.offsets.walking" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.breathing">breathing</var><a class="permalink" href="#lvl1_fields.offsets.breathing" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.look">look</var><a class="permalink" href="#lvl1_fields.offsets.look" title="Permalink to this definition"></a></td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="lvl1_fields.consts">consts
<a class="permalink" href="#lvl1_fields.consts" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>These are variables that are constant across the class and should usually not ever be changed by instnaces</p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="lvl1_fields.consts.KEYFRAME_SAMPLE_PRECISION">KEYFRAME_SAMPLE_PRECISION</var><a class="permalink" href="#lvl1_fields.consts.KEYFRAME_SAMPLE_PRECISION" title="Permalink to this definition"></a></td>
<td class="doc"><p>frequency of keyframe samples for animation offsets and</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE">DEFAULT_MAX_HEAR_DISTANCE</var><a class="permalink" href="#lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE" title="Permalink to this definition"></a></td>
<td class="doc"><p>default max hear distance when not specified</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.DEFAULT_FPS">DEFAULT_FPS</var><a class="permalink" href="#lvl1_fields.consts.DEFAULT_FPS" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>fps</code>=60 animation fps i.e. during firing when no length is specified</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_RECOIL">HAS_RECOIL</var><a class="permalink" href="#lvl1_fields.consts.HAS_RECOIL" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_BREATHING">HAS_BREATHING</var><a class="permalink" href="#lvl1_fields.consts.HAS_BREATHING" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_SWAY">HAS_SWAY</var><a class="permalink" href="#lvl1_fields.consts.HAS_SWAY" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_WAG">HAS_WAG</var><a class="permalink" href="#lvl1_fields.consts.HAS_WAG" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_GUN_AXIAL_OFFSETS">HAS_GUN_AXIAL_OFFSETS</var><a class="permalink" href="#lvl1_fields.consts.HAS_GUN_AXIAL_OFFSETS" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> wether the gun rotates on it's own axis instead of the player's view (i.e. ironsight misalignments)</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ANIMATIONS_OFFSET_AIM">ANIMATIONS_OFFSET_AIM</var><a class="permalink" href="#lvl1_fields.consts.ANIMATIONS_OFFSET_AIM" title="Permalink to this definition"></a></td>
<td class="doc"><p>wether animations create an offset</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.LOOP_IDLE_ANIM">LOOP_IDLE_ANIM</var><a class="permalink" href="#lvl1_fields.consts.LOOP_IDLE_ANIM" title="Permalink to this definition"></a></td>
<td class="doc"><p>whether the idle animation changes or not</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.THIRD_PERSON_GAIN_MULTIPLIER">THIRD_PERSON_GAIN_MULTIPLIER</var><a class="permalink" href="#lvl1_fields.consts.THIRD_PERSON_GAIN_MULTIPLIER" title="Permalink to this definition"></a></td>
<td class="doc"><p>general gain multiplier for third persons when hearing sounds</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ROOT_BONE">ROOT_BONE</var><a class="permalink" href="#lvl1_fields.consts.ROOT_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p>the root bone of the gun (for animation offsets)</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.MAG_BONE">MAG_BONE</var><a class="permalink" href="#lvl1_fields.consts.MAG_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code>=&quot;magazine&quot;,the bone of the magazine in the gun (for dropping mags)</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ARM_RIGHT_BONE">ARM_RIGHT_BONE</var><a class="permalink" href="#lvl1_fields.consts.ARM_RIGHT_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code>=&quot;right_aimpoint&quot;, the bone which the right arm aims at to</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ARM_LEFT_BONE">ARM_LEFT_BONE</var><a class="permalink" href="#lvl1_fields.consts.ARM_LEFT_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code>=&quot;left_aimpoint&quot;, the bone which the left arm aims at to</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.VERSION">VERSION</var><a class="permalink" href="#lvl1_fields.consts.VERSION" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> version of 4dguns this gun is made for. If left empty it will be assumed it is before 1.3.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>