Part teleport function as substantive func - as suggested by github user Reedych.
This commit is contained in:
parent
580a796a87
commit
1e07844d3f
10
init.lua
Normal file → Executable file
10
init.lua
Normal file → Executable file
@ -6,9 +6,7 @@ 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.",
|
||||
func = function(name)
|
||||
function teleport_to_spawn(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player == nil then
|
||||
-- just a check to prevent the server crashing
|
||||
@ -31,5 +29,9 @@ minetest.register_chatcommand("spawn", {
|
||||
player:setpos(spawn_command.pos)
|
||||
minetest.chat_send_player(name, "Teleported to spawn!")
|
||||
end
|
||||
end,
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("spawn", {
|
||||
description = "Teleport you to spawn point.",
|
||||
func = teleport_to_spawn,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user