Updated utils and added callbacks to spawn usher.
parent
cbb05d8da2
commit
218a65a92c
|
@ -1 +1 @@
|
||||||
Subproject commit 2ae4c72b3d14d74c7b6ac9e919c02164f521b745
|
Subproject commit 0fdeb22618cd7c2545581c28e32bace4d51a9609
|
|
@ -84,6 +84,10 @@
|
||||||
<td class="name" nowrap><a href="#on_spawn_player">on_spawn_player (player)</a></td>
|
<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>
|
<td class="summary">Callback for if a player spawns.</td>
|
||||||
</tr>
|
</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>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -250,6 +254,27 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</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>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
--
|
--
|
||||||
-- The only function that should be called from clients is activate.
|
-- The only function that should be called from clients is activate.
|
||||||
spawnusher = {
|
spawnusher = {
|
||||||
|
after_spawn_callbacks = List:new(),
|
||||||
physics_override = {
|
physics_override = {
|
||||||
speed = 0,
|
speed = 0,
|
||||||
jump = 0,
|
jump = 0,
|
||||||
|
@ -174,6 +175,9 @@ function spawnusher.move_player(player)
|
||||||
-- Remove the saved one.
|
-- Remove the saved one.
|
||||||
spawnusher.player_physics[player:get_player_name()] = nil
|
spawnusher.player_physics[player:get_player_name()] = nil
|
||||||
|
|
||||||
|
-- Invoke the callbacks.
|
||||||
|
spawnusher.after_spawn_callbacks:invoke(player)
|
||||||
|
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
-- The node beneath is neither air nor ignore and there is no
|
-- The node beneath is neither air nor ignore and there is no
|
||||||
|
@ -251,3 +255,11 @@ function spawnusher.on_spawn_player(player)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Allows to register callbacks after a player has been spawned by spawn usher.
|
||||||
|
--
|
||||||
|
-- @param callback The callback to invoke, a function that accepts the player
|
||||||
|
-- object as single parameter.
|
||||||
|
function spawnusher.register_after_spawn_callback(callback)
|
||||||
|
spawnusher.after_spawn_callbacks:add(callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue