321 lines
7.4 KiB
HTML
321 lines
7.4 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>Reference</title>
|
|
<link rel="stylesheet" href="ldoc.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="product">
|
|
<div id="product_logo"></div>
|
|
<div id="product_name"><big><b></b></big></div>
|
|
<div id="product_description"></div>
|
|
</div> <!-- id="product" -->
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
<!-- Menu -->
|
|
|
|
<div id="navigation">
|
|
<br/>
|
|
<h1>ldoc</h1>
|
|
|
|
|
|
<h2>Contents</h2>
|
|
<ul>
|
|
<li><a href="#Functions">Functions</a></li>
|
|
</ul>
|
|
|
|
|
|
<h2>Modules</h2>
|
|
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
|
<li><strong>spawnusher</strong></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Module <code>spawnusher</code></h1>
|
|
<p>Spawn usher is a system that allows to correct the spawn position of players
|
|
without knowing anything about the mapgen.</p>
|
|
<p>
|
|
<p> The system will register callbacks for newplayer and respawnplayer and will
|
|
try to find an air bubble, either upwards or downwards, which the player can
|
|
fit into. If an air bubble is found, the player will be moved there. If
|
|
the block is not loaded, it will be tried again after a certain amount of
|
|
time.
|
|
<p> The only function that should be called from clients is activate.</p>
|
|
|
|
|
|
<h2><a href="#Functions">Functions</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#activate">activate (random_placement_radius, required_bubble_size, retry_time)</a></td>
|
|
<td class="summary">Activates the spawn usher system.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#is_air_bubble">is_air_bubble (start_pos)</a></td>
|
|
<td class="summary">Tests if the given position is an air bubble big enough.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#move_later">move_later (player, current_pos)</a></td>
|
|
<td class="summary">Schedules the player to be moved later.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#move_random">move_random (player)</a></td>
|
|
<td class="summary">Moves the player randomly on the x and z plane.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#move_player">move_player (player)</a></td>
|
|
<td class="summary">Moves the player to a safe location.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#move_players">move_players ()</a></td>
|
|
<td class="summary">Move all players that could not be placed so far.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#on_spawn_player">on_spawn_player (player)</a></td>
|
|
<td class="summary">Callback for if a player spawns.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#register_after_spawn_callback">register_after_spawn_callback (callback)</a></td>
|
|
<td class="summary">Allows to register callbacks after a player has been spawned by spawn usher.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#register_spawnpoint_provider">register_spawnpoint_provider (provider)</a></td>
|
|
<td class="summary">Allows to register providers that are called after the final position of
|
|
the player has been determined.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2><a name="Functions"></a>Functions</h2>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "activate"></a>
|
|
<strong>activate (random_placement_radius, required_bubble_size, retry_time)</strong>
|
|
</dt>
|
|
<dd>
|
|
Activates the spawn usher system.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">random_placement_radius</span>
|
|
Optional. The player will be respawned in
|
|
the given radius around the spawn point.
|
|
</li>
|
|
<li><span class="parameter">required_bubble_size</span>
|
|
Optional. The size/height of the bubble of
|
|
air that is required for the player to spawn.
|
|
Defaults to 2.
|
|
</li>
|
|
<li><span class="parameter">retry_time</span>
|
|
Optional. This is the time that passes between tries to
|
|
place to the player.
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "is_air_bubble"></a>
|
|
<strong>is_air_bubble (start_pos)</strong>
|
|
</dt>
|
|
<dd>
|
|
Tests if the given position is an air bubble big enough.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">start_pos</span>
|
|
The position at which to check.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
true if at the given position is an air bubble big enough.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "move_later"></a>
|
|
<strong>move_later (player, current_pos)</strong>
|
|
</dt>
|
|
<dd>
|
|
Schedules the player to be moved later. Also moves the player to the given
|
|
position.
|
|
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">player</span>
|
|
The player object.
|
|
</li>
|
|
<li><span class="parameter">current_pos</span>
|
|
The current position to which the player will be moved.
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "move_random"></a>
|
|
<strong>move_random (player)</strong>
|
|
</dt>
|
|
<dd>
|
|
Moves the player randomly on the x and z plane.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">player</span>
|
|
The Player object to move.
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "move_player"></a>
|
|
<strong>move_player (player)</strong>
|
|
</dt>
|
|
<dd>
|
|
Moves the player to a safe location.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">player</span>
|
|
The player object.
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "move_players"></a>
|
|
<strong>move_players ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Move all players that could not be placed so far.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "on_spawn_player"></a>
|
|
<strong>on_spawn_player (player)</strong>
|
|
</dt>
|
|
<dd>
|
|
Callback for if a player spawns.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">player</span>
|
|
The Player that spawned.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
true, to disable default placement.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "register_after_spawn_callback"></a>
|
|
<strong>register_after_spawn_callback (callback)</strong>
|
|
</dt>
|
|
<dd>
|
|
Allows to register callbacks after a player has been spawned by spawn usher.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">callback</span>
|
|
The callback to invoke, a function that accepts the player
|
|
object as single parameter.
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "register_spawnpoint_provider"></a>
|
|
<strong>register_spawnpoint_provider (provider)</strong>
|
|
</dt>
|
|
<dd>
|
|
Allows to register providers that are called after the final position of
|
|
the player has been determined. The provider can return a different position,
|
|
or nil if it is happy with the given position.
|
|
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">provider</span>
|
|
The provider. A function that accepts two parameters,
|
|
the Player object and the spawn position that the system
|
|
calculated. It can return a new position, a table with
|
|
x y z values, or nil if the position should not be changed.
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
</div> <!-- id="content" -->
|
|
</div> <!-- id="main" -->
|
|
<div id="about">
|
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|