2017-08-12 12:11:28 +02:00
|
|
|
local static_spawnpoint_string = core.settings:get("static_spawnpoint")
|
|
|
|
if static_spawnpoint_string and
|
|
|
|
static_spawnpoint_string ~= "" and
|
|
|
|
not core.setting_get_pos("static_spawnpoint") then
|
|
|
|
error('The static_spawnpoint setting is invalid: "' ..
|
|
|
|
static_spawnpoint_string .. '"')
|
2012-04-09 22:29:55 +02:00
|
|
|
end
|
|
|
|
|
2015-10-11 14:25:58 +02:00
|
|
|
local function put_player_in_spawn(player_obj)
|
2014-04-28 03:02:48 +02:00
|
|
|
local static_spawnpoint = core.setting_get_pos("static_spawnpoint")
|
2012-04-09 22:29:55 +02:00
|
|
|
if not static_spawnpoint then
|
|
|
|
return false
|
|
|
|
end
|
2015-10-11 14:25:58 +02:00
|
|
|
core.log("action", "Moving " .. player_obj:get_player_name() ..
|
|
|
|
" to static spawnpoint at " .. core.pos_to_string(static_spawnpoint))
|
2018-07-17 20:17:54 +02:00
|
|
|
player_obj:set_pos(static_spawnpoint)
|
2012-04-09 22:29:55 +02:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2015-10-11 14:25:58 +02:00
|
|
|
core.register_on_newplayer(put_player_in_spawn)
|
|
|
|
core.register_on_respawnplayer(put_player_in_spawn)
|