mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2024-08-20 13:24:07 +02:00
Fix some bugs
This commit fixes some bugs which could create a crash. 😋
This commit is contained in:
parent
e636503cd4
commit
8e43351cc4
12
init.lua
12
init.lua
@ -187,11 +187,13 @@ function tpc_send(player,coordinates)
|
|||||||
if minetest.check_player_privs(pname, {tp_tpc=true}) then
|
if minetest.check_player_privs(pname, {tp_tpc=true}) then
|
||||||
local protected = minetest.is_protected(target_coords,pname)
|
local protected = minetest.is_protected(target_coords,pname)
|
||||||
if protected then
|
if protected then
|
||||||
if not areas:canInteract(target_coords, player) or not minetest.check_player_privs(pname, {areas = true}) then
|
if minetest.get_modpath("areas") then
|
||||||
|
if not areas:canInteract(target_coords, player) then
|
||||||
local owners = areas:getNodeOwners(target_coords)
|
local owners = areas:getNodeOwners(target_coords)
|
||||||
minetest.chat_send_player(player,("Error: %s is protected by %s."):format(minetest.pos_to_string(target_coords),table.concat(owners, ", ")))
|
minetest.chat_send_player(player,("Error: %s is protected by %s."):format(minetest.pos_to_string(target_coords),table.concat(owners, ", ")))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
else end
|
||||||
end
|
end
|
||||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
||||||
pname:set_pos(find_free_position_near(target_coords))
|
pname:set_pos(find_free_position_near(target_coords))
|
||||||
@ -204,7 +206,7 @@ function tpc_send(player,coordinates)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tpr_deny(name)
|
function tpr_deny(name)
|
||||||
if tpr_list[name] then
|
if tpr_list[name] then
|
||||||
minetest.chat_send_player(tpr_list[name], 'Teleport request denied.')
|
minetest.chat_send_player(tpr_list[name], 'Teleport request denied.')
|
||||||
tpr_list[name] = nil
|
tpr_list[name] = nil
|
||||||
@ -216,7 +218,7 @@ local function tpr_deny(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Teleport Accept Systems
|
-- Teleport Accept Systems
|
||||||
local function tpr_accept(name, param)
|
function tpr_accept(name, param)
|
||||||
|
|
||||||
-- Check to prevent constant teleporting.
|
-- Check to prevent constant teleporting.
|
||||||
if not tpr_list[name]
|
if not tpr_list[name]
|
||||||
@ -259,7 +261,7 @@ local function tpr_accept(name, param)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Teleport Jump - Relative Position Teleportation by number of nodes
|
-- Teleport Jump - Relative Position Teleportation by number of nodes
|
||||||
local function tpj(player,param)
|
function tpj(player,param)
|
||||||
local pname = minetest.get_player_by_name(player)
|
local pname = minetest.get_player_by_name(player)
|
||||||
|
|
||||||
if param == "" then
|
if param == "" then
|
||||||
@ -299,7 +301,7 @@ local function tpj(player,param)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Evade
|
-- Evade
|
||||||
local function tpe(player)
|
function tpe(player)
|
||||||
minetest.chat_send_player(player, "EVADE!")
|
minetest.chat_send_player(player, "EVADE!")
|
||||||
local mindistance = 15
|
local mindistance = 15
|
||||||
local maxdistance = 50
|
local maxdistance = 50
|
||||||
|
Loading…
Reference in New Issue
Block a user