mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2024-08-20 05:14:05 +02:00
Complete 1 task from TODO list (#30)
- Area owners can now accept area requests from other users. - Various message improvements. - Translation updates. Only compatible with `areas` mod (https://github.com/minetest-mods/areas).
This commit is contained in:
parent
d0e5a1a8b8
commit
a11e162bf7
@ -134,7 +134,6 @@ For further information or help, see:
|
|||||||
https://wiki.minetest.net/Installing_Mods
|
https://wiki.minetest.net/Installing_Mods
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- Make it so if a player attempts to teleport to coordinates within a protected area owned by another player, and that player is online, the owner receives a request to allow or deny the user from teleporting to their area.
|
|
||||||
- Add limitations to /tpc which only allow a user to teleport X number of blocks. Prevents users from teleporting to the edge of the world.
|
- Add limitations to /tpc which only allow a user to teleport X number of blocks. Prevents users from teleporting to the edge of the world.
|
||||||
- Assess value in changing all tpr-based chat commands to one global command such as /tp to reduce the chance of confusion between tps_admin and the original mod (and also make it so people don't have to remember so many commands).
|
- Assess value in changing all tpr-based chat commands to one global command such as /tp to reduce the chance of confusion between tps_admin and the original mod (and also make it so people don't have to remember so many commands).
|
||||||
- Create a better sound effect for teleport and apply it to all teleport methods (not just /tpc)
|
- Create a better sound effect for teleport and apply it to all teleport methods (not just /tpc)
|
||||||
|
231
functions.lua
231
functions.lua
@ -22,7 +22,8 @@ USA
|
|||||||
local S = tp.intllib
|
local S = tp.intllib
|
||||||
|
|
||||||
-- Placeholders
|
-- Placeholders
|
||||||
local chatmsg, source, target, name2, target_coords
|
local chatmsg, source, target, name2,
|
||||||
|
target_coords, tpc_target_coords, old_tpc_target_coords
|
||||||
|
|
||||||
local map_size = 30912
|
local map_size = 30912
|
||||||
function tp.can_teleport(to)
|
function tp.can_teleport(to)
|
||||||
@ -179,12 +180,12 @@ function tp.tpr_send(sender, receiver)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(receiver), S("@1 is requesting to teleport to you. /tpy to accept", sender), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(receiver), S("@1 is requesting to teleport to you. /tpy to accept.", sender), 0xFFFFFF)
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds.", tp.timeout_delay), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(receiver, S("@1 is requesting to teleport to you. /tpy to accept", sender))
|
minetest.chat_send_player(receiver, S("@1 is requesting to teleport to you. /tpy to accept.", sender))
|
||||||
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay))
|
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds.", tp.timeout_delay))
|
||||||
|
|
||||||
-- Write name values to list and clear old values.
|
-- Write name values to list and clear old values.
|
||||||
tp.tpr_list[receiver] = sender
|
tp.tpr_list[receiver] = sender
|
||||||
@ -212,9 +213,9 @@ function tp.tphr_send(sender, receiver)
|
|||||||
-- Compatibility with beerchat
|
-- Compatibility with beerchat
|
||||||
if minetest.get_modpath("beerchat") and not minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.get_modpath("beerchat") and not minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
minetest.chat_send_player(sender, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"))
|
minetest.chat_send_player(sender, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -239,9 +240,9 @@ function tp.tphr_send(sender, receiver)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
minetest.chat_send_player(sender, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"))
|
minetest.chat_send_player(sender, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -264,9 +265,9 @@ function tp.tphr_send(sender, receiver)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
minetest.chat_send_player(sender, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"))
|
minetest.chat_send_player(sender, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -282,12 +283,12 @@ function tp.tphr_send(sender, receiver)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(receiver), S("@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny", sender), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(receiver), S("@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny.", sender), 0xFFFFFF)
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds.", tp.timeout_delay), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(receiver, S("@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny", sender))
|
minetest.chat_send_player(receiver, S("@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny.", sender))
|
||||||
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay))
|
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds.", tp.timeout_delay))
|
||||||
|
|
||||||
-- Write name values to list and clear old values.
|
-- Write name values to list and clear old values.
|
||||||
tp.tphr_list[receiver] = sender
|
tp.tphr_list[receiver] = sender
|
||||||
@ -311,10 +312,10 @@ function tp.tphr_send(sender, receiver)
|
|||||||
end, receiver)
|
end, receiver)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tp.tpc_send(player, coordinates)
|
function tp.tpc_send(sender, coordinates)
|
||||||
|
|
||||||
local posx,posy,posz = string.match(coordinates, "^(-?%d+), (-?%d+), (-?%d+)$")
|
local posx,posy,posz = string.match(coordinates, "^(-?%d+), (-?%d+), (-?%d+)$")
|
||||||
local pname = minetest.get_player_by_name(player)
|
local pname = minetest.get_player_by_name(sender)
|
||||||
|
|
||||||
if posx ~= nil or posy ~= nil or posz ~= nil then
|
if posx ~= nil or posy ~= nil or posz ~= nil then
|
||||||
posx = tonumber(posx) + 0.0
|
posx = tonumber(posx) + 0.0
|
||||||
@ -323,9 +324,9 @@ function tp.tpc_send(player, coordinates)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if posx==nil or posy==nil or posz==nil or string.len(posx) > 6 or string.len(posy) > 6 or string.len(posz) > 6 then
|
if posx==nil or posy==nil or posz==nil or string.len(posx) > 6 or string.len(posy) > 6 or string.len(posz) > 6 then
|
||||||
minetest.chat_send_player(player, S("Usage: /tpc <x, y, z>"))
|
minetest.chat_send_player(sender, S("Usage: /tpc <x, y, z>"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Usage: /tpc <x, y, z>"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Usage: /tpc <x, y, z>"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@ -333,50 +334,89 @@ function tp.tpc_send(player, coordinates)
|
|||||||
target_coords = {x=posx, y=posy, z=posz}
|
target_coords = {x=posx, y=posy, z=posz}
|
||||||
|
|
||||||
if tp.can_teleport(target_coords) == false then
|
if tp.can_teleport(target_coords) == false then
|
||||||
minetest.chat_send_player(player, S("You cannot teleport to a location outside the map!"))
|
minetest.chat_send_player(sender, S("You cannot teleport to a location outside the map!"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("You cannot teleport to a location outside the map!"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("You cannot teleport to a location outside the map!"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If the area is protected, reject the user's request to teleport to these coordinates
|
-- If the area is protected, reject the user's request to teleport to these 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
|
-- 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
|
||||||
tp.tpc_teleport_player(player)
|
tp.tpc_teleport_player(sender)
|
||||||
minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
target_coords = nil
|
||||||
|
minetest.chat_send_player(sender, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Teleporting to: @1, @2, @3", posx, posy, posz), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Teleporting to: @1, @2, @3", posx, posy, posz), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
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, player)
|
local protected = minetest.is_protected(target_coords, sender)
|
||||||
if protected then
|
if protected then
|
||||||
minetest.record_protection_violation(target_coords, player)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("areas") then
|
if minetest.get_modpath("areas") then
|
||||||
if not areas:canInteract(target_coords, player) then
|
for _, area in pairs(areas:getAreasAtPos(target_coords)) do
|
||||||
local owners = areas:getNodeOwners(target_coords)
|
if minetest.get_player_by_name(area.owner) then -- Check if area owners are online
|
||||||
minetest.chat_send_player(player, S("Error: @1 is protected by @2.", minetest.pos_to_string(target_coords), table.concat(owners, ", ")))
|
|
||||||
|
if tpc_target_coords then
|
||||||
|
old_tpc_target_coords = tpc_target_coords
|
||||||
|
old_tpc_target_coords[area.owner] = tpc_target_coords[area.owner]
|
||||||
|
|
||||||
|
tpc_target_coords[area.owner] = {x=posx, y=posy, z=posz}
|
||||||
|
else
|
||||||
|
tpc_target_coords = {x=posx, y=posy, z=posz}
|
||||||
|
tpc_target_coords[area.owner] = {x=posx, y=posy, z=posz}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.chat_send_player(sender, S("Area request sent! Waiting for @1 to accept your request." ..
|
||||||
|
" It will timeout in @2 seconds.", table.concat(areas:getNodeOwners(tpc_target_coords[area.owner]), S(", or ")), tp.timeout_delay))
|
||||||
|
minetest.chat_send_player(area.owner, S("@1 is requesting to teleport to a protected area" ..
|
||||||
|
" of yours @2.", sender, minetest.pos_to_string(tpc_target_coords[area.owner])))
|
||||||
|
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Error: @1 is protected by @2.", minetest.pos_to_string(target_coords), table.concat(owners, ", ")), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Area request sent! Waiting for @1 to accept your request." ..
|
||||||
|
" It will timeout in @2 seconds.", table.concat(areas:getNodeOwners(tpc_target_coords[area.owner]), S(", or ")), tp.timeout_delay), 0xFFFFFF)
|
||||||
|
|
||||||
|
chat2.send_message(minetest.get_player_by_name(area.owner), S("@1 is requesting to teleport to a protected area" ..
|
||||||
|
" of yours @2.", sender, minetest.pos_to_string(tpc_target_coords[area.owner])), 0xFFFFFF)
|
||||||
|
end
|
||||||
|
|
||||||
|
tp.tpc_list[area.owner] = sender
|
||||||
|
tp.tpn_list[sender] = area.owner
|
||||||
|
|
||||||
|
minetest.after(tp.timeout_delay, function(name)
|
||||||
|
if tp.tpc_list[name] then
|
||||||
|
tp.tpc_list[name] = nil
|
||||||
|
minetest.chat_send_player(sender, S("Request timed-out."))
|
||||||
|
minetest.chat_send_player(area.owner, S("Request timed-out."))
|
||||||
|
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(sender), S("Request timed-out."), 0xFFFFFF)
|
||||||
|
chat2.send_message(minetest.get_player_by_name(area.owner), S("Request timed-out."), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end, area.owner)
|
||||||
|
else
|
||||||
|
minetest.record_protection_violation(target_coords, sender)
|
||||||
end
|
end
|
||||||
|
|
||||||
tp.tpc_teleport_player(player)
|
|
||||||
minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
|
||||||
if minetest.get_modpath("chat2") then
|
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Teleporting to: @1, @2, @3", posx, posy, posz), 0xFFFFFF)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player, S("Error: You do not have permission to teleport to those coordinates."))
|
minetest.record_protection_violation(target_coords, sender)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
tp.tpc_teleport_player(sender)
|
||||||
|
target_coords = nil
|
||||||
|
minetest.chat_send_player(sender, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Error: You do not have permission to teleport to those coordinates."), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Teleporting to: @1, @2, @3", posx, posy, posz), 0xFFFFFF)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(sender, S("Error: You do not have permission to teleport to those coordinates."))
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(sender), S("Error: You do not have permission to teleport to those coordinates."), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -384,6 +424,33 @@ function tp.tpc_send(player, coordinates)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function tp.tpr_deny(name)
|
function tp.tpr_deny(name)
|
||||||
|
|
||||||
|
if not tp.tpr_list[name] and not tp.tphr_list[name]
|
||||||
|
and not tp.tpc_list[name] and not tp.tpn_list[name] then
|
||||||
|
minetest.chat_send_player(name, S("Usage: /tpn allows you to deny teleport/area requests sent to you by other players."))
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(name), S("Usage: /tpn allows you to deny teleport/area requests sent to you by other players."), 0xFFFFFF)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Area requests
|
||||||
|
if tp.tpc_list[name] then
|
||||||
|
name2 = tp.tpc_list[name]
|
||||||
|
minetest.chat_send_player(name2, S("Area request denied."))
|
||||||
|
minetest.chat_send_player(name, S("You denied the request @1 sent you.", name2))
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(name2), S("Area request denied."), 0xFFFFFF)
|
||||||
|
chat2.send_message(minetest.get_player_by_name(name), S("You denied the request @1 sent you.", name2), 0xFFFFFF)
|
||||||
|
end
|
||||||
|
tp.tpc_list[name] = nil
|
||||||
|
|
||||||
|
-- Don't allow re-denying requests.
|
||||||
|
tp.tpn_list[name2] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Teleport requests
|
||||||
if tp.tpr_list[name] then
|
if tp.tpr_list[name] then
|
||||||
name2 = tp.tpr_list[name]
|
name2 = tp.tpr_list[name]
|
||||||
minetest.chat_send_player(name2, S("Teleport request denied."))
|
minetest.chat_send_player(name2, S("Teleport request denied."))
|
||||||
@ -426,14 +493,12 @@ function tp.tpr_deny(name)
|
|||||||
|
|
||||||
elseif tp.tphr_list[name2] then
|
elseif tp.tphr_list[name2] then
|
||||||
tp.tphr_list[name2] = nil
|
tp.tphr_list[name2] = nil
|
||||||
|
|
||||||
|
elseif tp.tpc_list[name2] then
|
||||||
|
tp.tpc_list[name2] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
tp.tpn_list[name] = nil
|
tp.tpn_list[name] = nil
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, S("Usage: /tpn allows you to deny teleport requests sent to you by other players."))
|
|
||||||
if minetest.get_modpath("chat2") then
|
|
||||||
chat2.send_message(minetest.get_player_by_name(name), S("Usage: /tpn allows you to deny teleport requests sent to you by other players."), 0xFFFFFF)
|
|
||||||
end
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -441,15 +506,69 @@ end
|
|||||||
-- Teleport Accept Systems
|
-- Teleport Accept Systems
|
||||||
function tp.tpr_accept(name)
|
function tp.tpr_accept(name)
|
||||||
|
|
||||||
-- Check to prevent constant teleporting.
|
-- Check to prevent constant teleporting
|
||||||
if not tp.tpr_list[name] and not tp.tphr_list[name] then
|
if not tp.tpr_list[name] and not tp.tphr_list[name]
|
||||||
minetest.chat_send_player(name, S("Usage: /tpy allows you to accept teleport requests sent to you by other players"))
|
and not tp.tpc_list[name] then
|
||||||
|
minetest.chat_send_player(name, S("Usage: /tpy allows you to accept teleport/area requests sent to you by other players."))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(name), S("Usage: /tpy allows you to accept teleport requests sent to you by other players"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(name), S("Usage: /tpy allows you to accept teleport/area requests sent to you by other players."), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Area requests
|
||||||
|
if tp.tpc_list[name] then
|
||||||
|
|
||||||
|
if tp.tpc_list[name] then
|
||||||
|
name2 = tp.tpc_list[name]
|
||||||
|
source = minetest.get_player_by_name(name)
|
||||||
|
target = minetest.get_player_by_name(name2)
|
||||||
|
chatmsg = S("@1 is teleporting to your protected area @2.", name2, minetest.pos_to_string(tpc_target_coords[name]))
|
||||||
|
tp.tpc_list[name] = nil
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If source or target are not present, abort request.
|
||||||
|
if not source or not target then
|
||||||
|
minetest.chat_send_player(name, S("@1 is not online right now.", name2))
|
||||||
|
tp.tpc_list[name] = nil
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(name), S("@1 is not online right now.", name2), 0xFFFFFF)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not tpc_target_coords[name] then
|
||||||
|
tpc_target_coords[name2] = old_tpc_target_coords[name]
|
||||||
|
tp.tpp_teleport_player(name2, tpc_target_coords[name2])
|
||||||
|
|
||||||
|
chatmsg = S("@1 is teleporting to your protected area @2.", name2, minetest.pos_to_string(tpc_target_coords[name2]))
|
||||||
|
else
|
||||||
|
tp.tpp_teleport_player(name2, tpc_target_coords[name])
|
||||||
|
chatmsg = S("@1 is teleporting to your protected area @2.", name2, minetest.pos_to_string(tpc_target_coords[name]))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Don't allow re-denying requests.
|
||||||
|
if tp.tpn_list[name] or tp.tpn_list[name2] then
|
||||||
|
tp.tpn_list[name] = nil
|
||||||
|
tp.tpn_list[name2] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.chat_send_player(name, chatmsg)
|
||||||
|
minetest.chat_send_player(name2, S("Request Accepted!"))
|
||||||
|
|
||||||
|
-- Avoid abusing with area requests
|
||||||
|
target_coords = nil
|
||||||
|
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(name2), S("Request Accepted!"), 0xFFFFFF)
|
||||||
|
chat2.send_message(minetest.get_player_by_name(name), chatmsg, 0xFFFFFF)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Teleport requests.
|
||||||
if tp.tpr_list[name] then
|
if tp.tpr_list[name] then
|
||||||
name2 = tp.tpr_list[name]
|
name2 = tp.tpr_list[name]
|
||||||
source = minetest.get_player_by_name(name)
|
source = minetest.get_player_by_name(name)
|
||||||
@ -470,15 +589,20 @@ function tp.tpr_accept(name)
|
|||||||
-- Could happen if either player disconnects (or timeout); if so just abort
|
-- Could happen if either player disconnects (or timeout); if so just abort
|
||||||
if not source
|
if not source
|
||||||
or not target then
|
or not target then
|
||||||
minetest.chat_send_player(name, S("@1 doesn't exist, or just disconnected/left (by timeout).", name2))
|
minetest.chat_send_player(name, S("@1 is not online right now.", name2))
|
||||||
|
tp.tpr_list[name] = nil
|
||||||
|
tp.tphr_list[name] = nil
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(name), S("@1 doesn't exist, or just disconnected/left (by timeout).", name2), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(name), S("@1 is not online right now.", name2), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
tp.tpr_teleport_player()
|
tp.tpr_teleport_player()
|
||||||
|
|
||||||
|
-- Avoid abusing with area requests
|
||||||
|
target_coords = nil
|
||||||
|
|
||||||
-- Don't allow re-denying requests.
|
-- Don't allow re-denying requests.
|
||||||
if tp.tpn_list[name] or tp.tpn_list[name2] then
|
if tp.tpn_list[name] or tp.tpn_list[name2] then
|
||||||
tp.tpn_list[name] = nil
|
tp.tpn_list[name] = nil
|
||||||
@ -558,6 +682,9 @@ function tp.tpj(player, param)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
tp.tpc_teleport_player(player)
|
tp.tpc_teleport_player(player)
|
||||||
|
|
||||||
|
-- Avoid abusing with area requests
|
||||||
|
target_coords = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Evade
|
-- Evade
|
||||||
|
7
init.lua
7
init.lua
@ -34,6 +34,7 @@ tp = {
|
|||||||
intllib = S,
|
intllib = S,
|
||||||
tpr_list = {},
|
tpr_list = {},
|
||||||
tphr_list = {},
|
tphr_list = {},
|
||||||
|
tpc_list = {},
|
||||||
tpn_list = {}
|
tpn_list = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +50,12 @@ minetest.register_on_leaveplayer(function(name)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Area requests
|
||||||
|
if tp.tpc_list[name] then
|
||||||
|
tp.tpc_list[name] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if tp.tpn_list[name] then
|
if tp.tpn_list[name] then
|
||||||
tp.tpn_list[name] = nil
|
tp.tpn_list[name] = nil
|
||||||
return
|
return
|
||||||
|
47
locale/es.po
47
locale/es.po
@ -37,8 +37,8 @@ msgid "Usage: /tpr <Player name>"
|
|||||||
msgstr "Uso: /tpr <jugador>"
|
msgstr "Uso: /tpr <jugador>"
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"
|
msgid "There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."
|
||||||
msgstr "No hay jugador con ese nombre. Tenga en cuenta que esto es caso-sensitivo, y el jugador debe de estar én linea."
|
msgstr "No hay jugador con ese nombre. Tenga en cuenta que esto es caso-sensitivo, y el jugador debe de estar én línea."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Teleport request denied, player is in the gamehub!"
|
msgid "Teleport request denied, player is in the gamehub!"
|
||||||
@ -49,12 +49,12 @@ msgid "You are teleporting to @1."
|
|||||||
msgstr "Te estas teletransportando a @1."
|
msgstr "Te estas teletransportando a @1."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "@1 is requesting to teleport to you. /tpy to accept"
|
msgid "@1 is requesting to teleport to you. /tpy to accept."
|
||||||
msgstr "@1 esta pidiendo teletransportarse a ti. /tpy para aceptar"
|
msgstr "@1 esta pidiendo teletransportarse a ti. /tpy para aceptar."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Teleport request sent! It will timeout in @1 seconds"
|
msgid "Teleport request sent! It will timeout in @1 seconds."
|
||||||
msgstr "¡Solicitud enviada! Se agotara en @1 segundos"
|
msgstr "¡Solicitud enviada! Se agotara en @1 segundos."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Request timed-out."
|
msgid "Request timed-out."
|
||||||
@ -69,8 +69,8 @@ msgid "Usage: /tphr <Player name>"
|
|||||||
msgstr "Uso: /tphr <jugador>"
|
msgstr "Uso: /tphr <jugador>"
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny"
|
msgid "@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny."
|
||||||
msgstr "@1 esta pidiendo que tu te teletransportes a el/ella. /tpy para aceptar, /tpn para denegar"
|
msgstr "@1 esta pidiendo que tu te teletransportes a el/ella. /tpy para aceptar, /tpn para denegar."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Usage: /tpc <x, y, z>"
|
msgid "Usage: /tpc <x, y, z>"
|
||||||
@ -85,8 +85,16 @@ msgid "Teleporting to: @1, @2, @3"
|
|||||||
msgstr "Teletransportandose a: @1, @2, @3"
|
msgstr "Teletransportandose a: @1, @2, @3"
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Error: @1 is protected by @2."
|
msgid "Area request sent! Waiting for @1 to accept your request. It will timeout in @2 seconds."
|
||||||
msgstr "Error: @1 esta protegido por @2."
|
msgstr "¡Solicitud de área enviada! Esperando a @1 que acepte tu solicitud. Se agotara en @2 segundos."
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid ", or "
|
||||||
|
msgstr ", o a "
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "@1 is requesting to teleport to a protected area of yours @2."
|
||||||
|
msgstr "@1 solicita teletransportarse a una área protegida tuya @2."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Error: You do not have permission to teleport to those coordinates."
|
msgid "Error: You do not have permission to teleport to those coordinates."
|
||||||
@ -101,6 +109,9 @@ msgid "You denied the request @1 sent you."
|
|||||||
msgstr "Tú denegaste la solicitud de teletransporte que @1 te mando."
|
msgstr "Tú denegaste la solicitud de teletransporte que @1 te mando."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
|
msgid "Usage: /tpn allows you to deny teleport/area requests sent to you by other players."
|
||||||
|
msgstr "Uso: /tpn te permite denegar solicitudes enviadas para ti de otros jugadores."
|
||||||
|
|
||||||
msgid "You denied your request sent to @1."
|
msgid "You denied your request sent to @1."
|
||||||
msgstr "Tú denegaste la solicitud de teletransporte enviada a @1."
|
msgstr "Tú denegaste la solicitud de teletransporte enviada a @1."
|
||||||
|
|
||||||
@ -109,16 +120,20 @@ msgid "@1 denied their request sent to you."
|
|||||||
msgstr "@1 denego su solicitud de teletransporte enviada a usted."
|
msgstr "@1 denego su solicitud de teletransporte enviada a usted."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Usage: /tpn allows you to deny teleport requests sent to you by other players."
|
msgid "Area request denied."
|
||||||
msgstr "Uso: /tpn te permite denegar solicitudes enviadas para ti de otros jugadores."
|
msgstr "Solicitud de área denegada."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Usage: /tpy allows you to accept teleport requests sent to you by other players"
|
msgid "Usage: /tpy allows you to accept teleport/area requests sent to you by other players."
|
||||||
msgstr "Uso: /tpy te permite aceptar solicitudes enviadas para ti de otros jugadores"
|
msgstr "Uso: /tpy te permite aceptar solicitudes enviadas para ti de otros jugadores."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "@1 doesn't exist, or just disconnected/left (by timeout)."
|
msgid "@1 is teleporting to your protected area @2."
|
||||||
msgstr "@1 no existe, o se desconecto/fue."
|
msgstr "@1 se esta teletransportando a tu área protegida @2."
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "@1 is not online right now."
|
||||||
|
msgstr "@1 no esta en línea ahora mismo."
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Request Accepted!"
|
msgid "Request Accepted!"
|
||||||
|
@ -37,7 +37,7 @@ msgid "Usage: /tpr <Player name>"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "There is no player by that name. Keep in mind this is case sensitive, and the player must be online"
|
msgid "There is no player by that name. Keep in mind this is case sensitive, and the player must be online."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
@ -49,11 +49,11 @@ msgid "You are teleporting to @1."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "@1 is requesting to teleport to you. /tpy to accept"
|
msgid "@1 is requesting to teleport to you. /tpy to accept."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Teleport request sent! It will timeout in @1 seconds"
|
msgid "Teleport request sent! It will timeout in @1 seconds."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
@ -69,7 +69,7 @@ msgid "Usage: /tphr <Player name>"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny"
|
msgid "@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
@ -85,13 +85,29 @@ msgid "Teleporting to: @1, @2, @3"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Error: @1 is protected by @2."
|
msgid "Area request sent! Waiting for @1 to accept your request. It will timeout in @2 seconds."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid ", or "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "@1 is requesting to teleport to a protected area of yours @2."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Error: You do not have permission to teleport to those coordinates."
|
msgid "Error: You do not have permission to teleport to those coordinates."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Usage: /tpn allows you to deny teleport/area requests sent to you by other players."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Area request denied."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Teleport request denied."
|
msgid "Teleport request denied."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -101,6 +117,9 @@ msgid "You denied the request @1 sent you."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
|
msgid "Usage: /tpy allows you to accept teleport/area requests sent to you by other players."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "You denied your request sent to @1."
|
msgid "You denied your request sent to @1."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -109,15 +128,11 @@ msgid "@1 denied their request sent to you."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Usage: /tpn allows you to deny teleport requests sent to you by other players."
|
msgid "@1 is teleporting to your protected area @2."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
msgid "Usage: /tpy allows you to accept teleport requests sent to you by other players"
|
msgid "@1 is not online right now."
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua
|
|
||||||
msgid "@1 doesn't exist, or just disconnected/left (by timeout)."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua
|
#: init.lua
|
||||||
|
Loading…
Reference in New Issue
Block a user