mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-08 14:07:28 +01:00
Reorder functions
This commit is contained in:
parent
07b44e6b29
commit
cd6a2c3fa5
34
init.lua
34
init.lua
@ -12,6 +12,22 @@ local tphr_list = {}
|
|||||||
|
|
||||||
minetest.register_privilege("tp_admin", {description = "Admin overrides for tps_teleport.", give_to_singleplayer=false,})
|
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
|
--Teleport Request System
|
||||||
local function tpr_send(sender, receiver)
|
local function tpr_send(sender, receiver)
|
||||||
if receiver == "" then
|
if receiver == "" then
|
||||||
@ -117,24 +133,6 @@ local function tpr_deny(name)
|
|||||||
end
|
end
|
||||||
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
|
--Teleport Accept Systems
|
||||||
local function tpr_accept(name, param)
|
local function tpr_accept(name, param)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user