Fixed that players would not be correctly moved.

master
Robert Zenz 2015-09-12 16:30:07 +02:00
parent 66eafdfa8c
commit 9dac4face1
2 changed files with 27 additions and 10 deletions

View File

@ -139,6 +139,10 @@
<td class="summary">If the system is currently scheduled for execution.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#spawnpoint">spawnpoint</a></td>
<td class="summary">The spawnpoint that is configured.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#spawnpoint_providers">spawnpoint_providers</a></td>
<td class="summary">The registered spawnpoint providers.</td>
</tr>
@ -493,6 +497,20 @@
</dd>
<dt>
<a name = "spawnpoint"></a>
<strong>spawnpoint</strong>
</dt>
<dd>
The spawnpoint that is configured.
</dd>
<dt>
<a name = "spawnpoint_providers"></a>

View File

@ -69,6 +69,13 @@ spawnusher = {
--- If the system is currently scheduled for execution.
scheduled = false,
--- The spawnpoint that is configured.
spawnpoint = settings.get_pos("static_spawnpoint", {
x = 0,
y = 0,
z = 0
}),
--- The registered spawnpoint providers.
spawnpoint_providers = List:new()
}
@ -246,21 +253,13 @@ function spawnusher.on_spawn_player(player)
player:set_physics_override(spawnusher.physics_override)
-- Move the player to the set/default spawn point.
local spawn_pos = minetest.setting_get_pos("static_spawnpoint")
if spawn_pos == nil then
spawn_pos = {
x = 0,
y = 0,
z = 0
}
end
player:setpos(spawnusher.spawnpoint)
-- Move the player randomly afterwards.
spawnusher.move_random(player)
player:setpos(spawn_pos)
local exact_pos = false
local spawn_pos = player:getpos()
-- Run the position through the providers.
spawnusher.spawnpoint_providers:foreach(function(provider, index)