static_spawnpoint from minetest.conf
parent
16729ec67b
commit
a96e5923d7
13
init.lua
13
init.lua
|
@ -1,8 +1,15 @@
|
|||
|
||||
spawn_command = {}
|
||||
spawn_command.pos = {x=0, y=3, z=0}
|
||||
|
||||
if minetest.setting_get_pos("static_spawnpoint") then
|
||||
spawn_command.pos = minetest.setting_get_pos("static_spawnpoint")
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("spawn", {
|
||||
description = "Teleport you to spawn point at (0,3,0)",
|
||||
description = "Teleport you to spawn point.",
|
||||
func = function(name)
|
||||
local player = minetest.env:get_player_by_name(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player == nil then
|
||||
-- just a check to prevent the server crashing
|
||||
return false
|
||||
|
@ -11,7 +18,7 @@ minetest.register_chatcommand("spawn", {
|
|||
if pos.x>-20 and pos.x<20 and pos.y>-20 and pos.z>-20 and pos.z<20 then
|
||||
|
||||
else
|
||||
player:setpos({x=0, y=3, z=0})
|
||||
player:setpos(spawn_command.pos)
|
||||
minetest.chat_send_player(name, "Teleported to spawn!")
|
||||
end
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue