mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-07 21:47:30 +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, sender)
|
||||||
end
|
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 function tpc_send(player,coordinates)
|
||||||
|
|
||||||
local posx,posy,posz = string.match(coordinates, "^(-?%d+),(-?%d+),(-?%d+)$")
|
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.
|
-- 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
|
-- Admin user (priv "tp_admin") overrides all protection
|
||||||
if minetest.check_player_privs(pname, {tp_admin=true}) then
|
if minetest.check_player_privs(pname, {tp_admin=true}) then
|
||||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
tpc_go(player,target_coords)
|
||||||
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
|
||||||
pname:setpos(find_free_position_near(target_coords))
|
|
||||||
else
|
else
|
||||||
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, pname) 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
|
||||||
end
|
end
|
||||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
tpc_go(player,target_coords)
|
||||||
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
|
||||||
pname:setpos(find_free_position_near(target_coords))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user