2024-01-26 19:16:18 -08:00

163 lines
4.3 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.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>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><strong>play_sound</strong></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Script <code>play_sound</code></h1>
<p>implements tools for quickly playing audio.</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Guns4d.play_sound">Guns4d.play_sound (sound_specs)</a></td>
<td class="summary">allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#guns4d_soundspec">guns4d_soundspec</a></td>
<td class="summary">defines a sound.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Guns4d.play_sound"></a>
<strong>Guns4d.play_sound (sound_specs)</strong>
</dt>
<dd>
allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.
WARNING: this function modifies the tables passed to it, use <code>Guns4d.table.shallow_copy()</code> for guns4d_soundspecs
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">sound_specs</span>
<p> a <a href="../scripts/play_sound.html#guns4d_soundspec">guns4d_soundspec</a> or a list of <a href="../scripts/play_sound.html#guns4d_soundspec">guns4d_soundspec</a>s indexed my number. Also allows for shared fields. Example:</p>
<pre><code> {
to_player = "singeplayer",
min_distance = 100, --soundspec_to_play1 &amp; soundspec_to_play2 share this parameter (as well as the to_player)
soundspec_to_play1,
soundspec_to_play2
}
</code></pre>
</li>
</ul>
<h3>Returns:</h3>
<ol>
out a list of Minetest sound handles [insert link] (in the order they came)
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "guns4d_soundspec"></a>
<strong>guns4d_soundspec</strong>
</dt>
<dd>
defines a sound.
This is passed to <code>minetest.sound_play</code> as a <a href="https://github.com/minetest/minetest/blob/master/doc/lua_api.md#sound-parameter-table"> sound parameter table</a>
however has the following changed or guns4d specific parameters.
<h3>Fields:</h3>
<ul>
<li><span class="parameter">min_hear_distance</span>
this is useful if you wish to play a sound which has a "far" sound, such as distant gunshots. incompatible <code>with to_player</code>
</li>
<li><span class="parameter">sounds</span>
a <a href="../scripts/misc_helpers.html#weighted_randoms"> weighted_randoms table</a> the output will overwrite the <code>sound</code> field.
</li>
<li><span class="parameter">to_player</span>
4dguns changes <code>to_player</code> so it only plays positionless audio (as it is only intended for first person audio)
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-01-19 14:08:01 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>