Added provider and callback examples.
parent
ee0c1dd958
commit
7d9f934175
47
README
47
README
|
@ -33,6 +33,53 @@ parameters:
|
||||||
Defaults to 0.5 seconds.
|
Defaults to 0.5 seconds.
|
||||||
|
|
||||||
|
|
||||||
|
Providers
|
||||||
|
=========
|
||||||
|
|
||||||
|
You can register providers which allow to customize the spawn point of
|
||||||
|
the players. The provider is a callback that is able to provide a different
|
||||||
|
spawn point. The signature is:
|
||||||
|
|
||||||
|
function(
|
||||||
|
player, -- The Player object of the player that is going to respawn.
|
||||||
|
spawn_pos) -- The current spawn position of the player.
|
||||||
|
|
||||||
|
returns
|
||||||
|
spawn_pos -- The position at which the player should ge respawned.
|
||||||
|
-- nil to use the current one.
|
||||||
|
|
||||||
|
And a usage example:
|
||||||
|
|
||||||
|
-- Fixes the spawn point of the player named "hero" at some position.
|
||||||
|
spawnusher.register_spawnpoint_provider(function(player, spawn_pos)
|
||||||
|
if player:get_player_name() == "hero" then
|
||||||
|
return {
|
||||||
|
x = 0,
|
||||||
|
y = 125,
|
||||||
|
z = 50
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
After Spawn Callbacks
|
||||||
|
=====================
|
||||||
|
|
||||||
|
You can register a callback that will be invoked after the player has been
|
||||||
|
respawned. This callback can't modify the spawn point anymore and is only
|
||||||
|
to get informed about the actual spawn point of the player. The signature is:
|
||||||
|
|
||||||
|
function(
|
||||||
|
player, -- The Player object of the player that has respawned.
|
||||||
|
spawn_point) -- The spawn point of the player.
|
||||||
|
|
||||||
|
Usage example:
|
||||||
|
|
||||||
|
spawnusher.register_after_spawn_callback(function(player, spawn_point)
|
||||||
|
-- Do something with this information.
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
Caveats
|
Caveats
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue