From cd6a2c3fa54719c3590259b6616355bcc1152450 Mon Sep 17 00:00:00 2001 From: Robbie Ferguson Date: Fri, 13 May 2016 13:41:44 -0400 Subject: [PATCH] Reorder functions --- init.lua | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/init.lua b/init.lua index 1a3db07..ba299a1 100644 --- a/init.lua +++ b/init.lua @@ -12,6 +12,22 @@ local tphr_list = {} minetest.register_privilege("tp_admin", {description = "Admin overrides for tps_teleport.", give_to_singleplayer=false,}) +local function find_free_position_near(pos) + local tries = { + {x=1,y=0,z=0}, + {x=-1,y=0,z=0}, + {x=0,y=0,z=1}, + {x=0,y=0,z=-1}, + } + for _,d in pairs(tries) do + local p = vector.add(pos, d) + if not minetest.registered_nodes[minetest.get_node(p).name].walkable then + return p, true + end + end + return pos, false +end + --Teleport Request System local function tpr_send(sender, receiver) if receiver == "" then @@ -117,24 +133,6 @@ local function tpr_deny(name) end end --- Copied from Celeron-55's /teleport command. Thanks Celeron! -local function find_free_position_near(pos) - local tries = { - {x=1,y=0,z=0}, - {x=-1,y=0,z=0}, - {x=0,y=0,z=1}, - {x=0,y=0,z=-1}, - } - for _,d in pairs(tries) do - local p = vector.add(pos, d) - if not minetest.registered_nodes[minetest.get_node(p).name].walkable then - return p, true - end - end - return pos, false -end - - --Teleport Accept Systems local function tpr_accept(name, param)