mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-06 13:07:33 +01:00
Update init.lua
This commit is contained in:
parent
cd6a2c3fa5
commit
1a4e71c0bb
16
init.lua
16
init.lua
@ -77,6 +77,12 @@ local function tphr_send(sender, receiver)
|
||||
end, sender)
|
||||
end
|
||||
|
||||
local function tpc_go(player,coordinates)
|
||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
||||
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
||||
pname:setpos(find_free_position_near(target_coords))
|
||||
end
|
||||
|
||||
local function tpc_send(player,coordinates)
|
||||
|
||||
local posx,posy,posz = string.match(coordinates, "^(-?%d+),(-?%d+),(-?%d+)$")
|
||||
@ -104,21 +110,17 @@ local function tpc_send(player,coordinates)
|
||||
-- In future release we'll actually query the player who owns the area, if they're online, and ask for their permission.
|
||||
-- Admin user (priv "tp_admin") overrides all protection
|
||||
if minetest.check_player_privs(pname, {tp_admin=true}) then
|
||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
||||
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
||||
pname:setpos(find_free_position_near(target_coords))
|
||||
tpc_go(player,target_coords)
|
||||
else
|
||||
local protected = minetest.is_protected(target_coords,pname)
|
||||
if protected then
|
||||
if not areas:canInteract(target_coords, pname) then
|
||||
if not areas:canInteract(target_coords, player) then
|
||||
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, ", ")))
|
||||
return
|
||||
end
|
||||
end
|
||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
||||
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
||||
pname:setpos(find_free_position_near(target_coords))
|
||||
tpc_go(player,target_coords)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user