diff --git a/deps/utils b/deps/utils
index 2ae4c72..0fdeb22 160000
--- a/deps/utils
+++ b/deps/utils
@@ -1 +1 @@
-Subproject commit 2ae4c72b3d14d74c7b6ac9e919c02164f521b745
+Subproject commit 0fdeb22618cd7c2545581c28e32bace4d51a9609
diff --git a/doc/index.html b/doc/index.html
index f477f7e..8aa5b94 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -84,6 +84,10 @@
on_spawn_player (player) |
Callback for if a player spawns. |
+
+ register_after_spawn_callback (callback) |
+ Allows to register callbacks after a player has been spawned by spawn usher. |
+
@@ -250,6 +254,27 @@
+
+
+
+ register_after_spawn_callback (callback)
+
+
+ Allows to register callbacks after a player has been spawned by spawn usher.
+
+
+ Parameters:
+
+ - callback
+ The callback to invoke, a function that accepts the player
+ object as single parameter.
+
+
+
+
+
+
+
diff --git a/mods/spawn_usher/spawnusher.lua b/mods/spawn_usher/spawnusher.lua
index 472a9c0..200a3d1 100644
--- a/mods/spawn_usher/spawnusher.lua
+++ b/mods/spawn_usher/spawnusher.lua
@@ -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.
spawnusher = {
+ after_spawn_callbacks = List:new(),
physics_override = {
speed = 0,
jump = 0,
@@ -174,6 +175,9 @@ function spawnusher.move_player(player)
-- Remove the saved one.
spawnusher.player_physics[player:get_player_name()] = nil
+ -- Invoke the callbacks.
+ spawnusher.after_spawn_callbacks:invoke(player)
+
return
else
-- The node beneath is neither air nor ignore and there is no
@@ -251,3 +255,11 @@ function spawnusher.on_spawn_player(player)
return true
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
+