mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2024-08-20 05:14:05 +02:00
/tpc now requires tp_tpc priv
As requested by ChaosWormz
This commit is contained in:
parent
f64bb6ea16
commit
5f12f7b6d6
34
init.lua
34
init.lua
@ -10,7 +10,14 @@ local version = "1.3"
|
|||||||
local tpr_list = {}
|
local tpr_list = {}
|
||||||
local tphr_list = {}
|
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
|
||||||
|
})
|
||||||
|
minetest.register_privilege("tp_tpc", {
|
||||||
|
description = "Allow player to teleport to coordinates (if permitted by area protection).",
|
||||||
|
give_to_singleplayer=true
|
||||||
|
})
|
||||||
|
|
||||||
local function find_free_position_near(pos)
|
local function find_free_position_near(pos)
|
||||||
local tries = {
|
local tries = {
|
||||||
@ -131,18 +138,23 @@ local function tpc_send(player,coordinates)
|
|||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
||||||
parti2(target_coords)
|
parti2(target_coords)
|
||||||
else
|
else
|
||||||
local protected = minetest.is_protected(target_coords,pname)
|
if minetest.check_player_privs(pname, {tp_tpc=true}) then
|
||||||
if protected then
|
local protected = minetest.is_protected(target_coords,pname)
|
||||||
if not areas:canInteract(target_coords, player) then
|
if protected then
|
||||||
local owners = areas:getNodeOwners(target_coords)
|
if not areas:canInteract(target_coords, player) then
|
||||||
minetest.chat_send_player(player,("Error: %s is protected by %s."):format(minetest.pos_to_string(target_coords),table.concat(owners, ", ")))
|
local owners = areas:getNodeOwners(target_coords)
|
||||||
return
|
minetest.chat_send_player(player,("Error: %s is protected by %s."):format(minetest.pos_to_string(target_coords),table.concat(owners, ", ")))
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
||||||
|
pname:setpos(find_free_position_near(target_coords))
|
||||||
|
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
||||||
|
parti2(target_coords)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player, "Error: You do not have permission to teleport to coordinates.")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
|
||||||
pname:setpos(find_free_position_near(target_coords))
|
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
|
||||||
parti2(target_coords)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user