mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-08 22:17:27 +01:00
Merge pull request #12 from Panquesito7/master
Complete 1 task from TODO list
This commit is contained in:
commit
202ce65389
@ -76,15 +76,16 @@ LGPL-2.1 for code, CC-BY-SA-4.0 for [media](https://github.com/ChaosWormz/telepo
|
|||||||
## Contributors:
|
## Contributors:
|
||||||
- [RobbieF](https://minetest.tv) | [GitHub](https://github.com/Cat5TV)
|
- [RobbieF](https://minetest.tv) | [GitHub](https://github.com/Cat5TV)
|
||||||
- [DonBatman](https://github.com/donbatman)
|
- [DonBatman](https://github.com/donbatman)
|
||||||
- [NathanS21](http://nathansalapat.com/)
|
- [NathanS21](http://nathansalapat.com/) | [GitHub](https://github.com/NathanSalapat)
|
||||||
- [ChaosWormz](https://github.com/ChaosWormz)
|
- [ChaosWormz](https://github.com/ChaosWormz)
|
||||||
- [Panquesito7](https://github.com/Panquesito7)
|
- [Panquesito7](https://github.com/Panquesito7)
|
||||||
|
- [coil0](https://github.com/coil0)
|
||||||
- Traxie21, the original creator of this mod (however, he/she does not have a GitHub account anymore).
|
- Traxie21, the original creator of this mod (however, he/she does not have a GitHub account anymore).
|
||||||
|
|
||||||
All those who contributed to the original mod (please see `init.lua`).
|
All those who contributed to the original mod (please see `init.lua`).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
- Unzip the archive, rename the folder to "tpr" (**without the quotes**) and
|
- Unzip the archive, rename the folder to tpr and
|
||||||
place it in ..minetest/mods/
|
place it in ..minetest/mods/
|
||||||
|
|
||||||
- GNU/Linux: If you use a system-wide installation place
|
- GNU/Linux: If you use a system-wide installation place
|
||||||
@ -101,6 +102,5 @@ https://wiki.minetest.net/Installing_Mods
|
|||||||
- 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)
|
||||||
- Create a new function for the actual set_pos() to remove all the redundant code each time the player is moved and the sound played.
|
|
||||||
- Rewrite to place all chat commands into one single command much like how /teleport works.
|
- Rewrite to place all chat commands into one single command much like how /teleport works.
|
||||||
- Make evade respect land: no teleporting inside land, but instead make sure player is standing on surface or in water.
|
- Make evade respect land: no teleporting inside land, but instead make sure player is standing on surface or in water.
|
||||||
|
12
config.lua
12
config.lua
@ -27,13 +27,10 @@ local S, NS = dofile(MP.."/intllib.lua")
|
|||||||
timeout_delay = 60
|
timeout_delay = 60
|
||||||
version = "1.5"
|
version = "1.5"
|
||||||
|
|
||||||
map_size = 30912
|
-- Enable teleporting immediately to the player with "tp_admin" privilege.
|
||||||
function can_teleport(to)
|
enable_immediate_teleport = true
|
||||||
return to.x < map_size and to.x > -map_size and to.y < map_size and to.y > -map_size and to.z < map_size and to.z > -map_size
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Enable tpp command
|
local chatmsg, source, target, name2, target_coords, pos
|
||||||
enable_tpp_command = false
|
|
||||||
|
|
||||||
-- Set the values of the positions of your places, players will be able to teleport to them (no matter if it is protected, or not).
|
-- Set the values of the positions of your places, players will be able to teleport to them (no matter if it is protected, or not).
|
||||||
available_places = {
|
available_places = {
|
||||||
@ -41,6 +38,9 @@ available_places = {
|
|||||||
shop = {x = 0, y = 0, z = 0}, -- Set coordinates of the shop here.
|
shop = {x = 0, y = 0, z = 0}, -- Set coordinates of the shop here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Enable tpp command
|
||||||
|
enable_tpp_command = false
|
||||||
|
|
||||||
-- Register privileges
|
-- Register privileges
|
||||||
minetest.register_privilege("tp", {
|
minetest.register_privilege("tp", {
|
||||||
description = S("Let players teleport to other players (request will be sent)"),
|
description = S("Let players teleport to other players (request will be sent)"),
|
||||||
|
156
init.lua
156
init.lua
@ -38,7 +38,40 @@ dofile(MP.."/config.lua")
|
|||||||
local tpr_list = {}
|
local tpr_list = {}
|
||||||
local tphr_list = {}
|
local tphr_list = {}
|
||||||
|
|
||||||
local function find_free_position_near(pos)
|
local map_size = 30912
|
||||||
|
local function can_teleport(to)
|
||||||
|
return to.x < map_size and to.x > -map_size and to.y < map_size and to.y > -map_size and to.z < map_size and to.z > -map_size
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Teleport player to a player (used in "/tpr" and in "/tphr" command).
|
||||||
|
function tpr_teleport_player()
|
||||||
|
local target_coords = source:get_pos()
|
||||||
|
local target_sound = target:get_pos()
|
||||||
|
target:set_pos(find_free_position_near(target_coords))
|
||||||
|
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
||||||
|
minetest.sound_play("whoosh", {pos = target_sound, gain = 0.5, max_hear_distance = 10})
|
||||||
|
--parti2(target_coords)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TPC & TPJ
|
||||||
|
function tpc_teleport_player(player)
|
||||||
|
local pname = minetest.get_player_by_name(player)
|
||||||
|
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
||||||
|
pname:set_pos(find_free_position_near(target_coords))
|
||||||
|
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
||||||
|
--parti2(target_coords)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TPP
|
||||||
|
function tpp_teleport_player(player)
|
||||||
|
local pname = minetest.get_player_by_name(player)
|
||||||
|
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
||||||
|
pname:set_pos(find_free_position_near(pos))
|
||||||
|
minetest.sound_play("whoosh", {pos = pos, gain = 0.5, max_hear_distance = 10})
|
||||||
|
--parti2(target_coords)
|
||||||
|
end
|
||||||
|
|
||||||
|
function find_free_position_near(pos)
|
||||||
local tries = {
|
local tries = {
|
||||||
{x=1,y=0,z=0},
|
{x=1,y=0,z=0},
|
||||||
{x=-1,y=0,z=0},
|
{x=-1,y=0,z=0},
|
||||||
@ -54,7 +87,7 @@ local function find_free_position_near(pos)
|
|||||||
return pos, false
|
return pos, false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function parti(pos)
|
function parti(pos)
|
||||||
minetest.add_particlespawner(50, 0.4,
|
minetest.add_particlespawner(50, 0.4,
|
||||||
{x=pos.x + 0.5, y=pos.y, z=pos.z + 0.5}, {x=pos.x - 0.5, y=pos.y, z=pos.z - 0.5},
|
{x=pos.x + 0.5, y=pos.y, z=pos.z + 0.5}, {x=pos.x - 0.5, y=pos.y, z=pos.z - 0.5},
|
||||||
{x=0, y=5, z=0}, {x=0, y=0, z=0},
|
{x=0, y=5, z=0}, {x=0, y=0, z=0},
|
||||||
@ -65,7 +98,7 @@ local function parti(pos)
|
|||||||
"tps_portal_parti.png")
|
"tps_portal_parti.png")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function parti2(pos)
|
function parti2(pos)
|
||||||
minetest.add_particlespawner(50, 0.4,
|
minetest.add_particlespawner(50, 0.4,
|
||||||
{x=pos.x + 0.5, y=pos.y + 10, z=pos.z + 0.5}, {x=pos.x - 0.5, y=pos.y, z=pos.z - 0.5},
|
{x=pos.x + 0.5, y=pos.y + 10, z=pos.z + 0.5}, {x=pos.x - 0.5, y=pos.y, z=pos.z - 0.5},
|
||||||
{x=0, y=-5, z=0}, {x=0, y=0, z=0},
|
{x=0, y=-5, z=0}, {x=0, y=0, z=0},
|
||||||
@ -80,21 +113,32 @@ end
|
|||||||
function clear_tpr_list(name)
|
function clear_tpr_list(name)
|
||||||
if tpr_list[name] then
|
if tpr_list[name] then
|
||||||
tpr_list[name] = nil
|
tpr_list[name] = nil
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function clear_tphr_list(name)
|
function clear_tphr_list(name)
|
||||||
if tphr_list[name] then
|
if tphr_list[name] then
|
||||||
tphr_list[name] = nil
|
tphr_list[name] = nil
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Clear requests when the player leaves
|
||||||
|
minetest.register_on_leaveplayer(function(name)
|
||||||
|
if tpr_list[name] then
|
||||||
|
tpr_list[name] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if tphr_list[name] then
|
||||||
|
tphr_list[name] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
function tpr_send(sender, receiver)
|
function tpr_send(sender, receiver)
|
||||||
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.check_player_privs(sender, {tp_admin = true}) and enable_immediate_teleport then
|
||||||
-- Write name values to list and clear old values.
|
|
||||||
tpr_list[receiver] = sender
|
|
||||||
-- Teleport timeout delay
|
|
||||||
minetest.after(timeout_delay, clear_tpr_list, receiver)
|
|
||||||
if receiver == "" then
|
if receiver == "" then
|
||||||
minetest.chat_send_player(sender, S("Usage: /tpr <Player name>"))
|
minetest.chat_send_player(sender, S("Usage: /tpr <Player name>"))
|
||||||
return
|
return
|
||||||
@ -103,6 +147,7 @@ function tpr_send(sender, receiver)
|
|||||||
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"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
tpr_list[receiver] = sender
|
||||||
tpr_accept(receiver)
|
tpr_accept(receiver)
|
||||||
minetest.chat_send_player(sender, S("You are teleporting to @1.", receiver))
|
minetest.chat_send_player(sender, S("You are teleporting to @1.", receiver))
|
||||||
return
|
return
|
||||||
@ -122,19 +167,20 @@ function tpr_send(sender, receiver)
|
|||||||
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds", timeout_delay))
|
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds", timeout_delay))
|
||||||
|
|
||||||
-- Write name values to list and clear old values.
|
-- Write name values to list and clear old values.
|
||||||
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
tpr_list[receiver] = sender
|
||||||
tpr_list[receiver] = sender
|
-- Teleport timeout delay
|
||||||
-- Teleport timeout delay
|
minetest.after(timeout_delay, function(name)
|
||||||
minetest.after(timeout_delay, clear_tpr_list, receiver)
|
if tpr_list[name] then
|
||||||
end
|
tpr_list[name] = nil
|
||||||
|
minetest.chat_send_player(sender, S("Request timed-out."))
|
||||||
|
minetest.chat_send_player(receiver, S("Request timed-out."))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end, receiver)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tphr_send(sender, receiver)
|
function tphr_send(sender, receiver)
|
||||||
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.check_player_privs(sender, {tp_admin = true}) and enable_immediate_teleport then
|
||||||
-- Write name values to list and clear old values.
|
|
||||||
tphr_list[receiver] = sender
|
|
||||||
-- Teleport timeout delay
|
|
||||||
minetest.after(timeout_delay, clear_tphr_list, receiver)
|
|
||||||
if receiver == "" then
|
if receiver == "" then
|
||||||
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
|
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
|
||||||
return
|
return
|
||||||
@ -143,6 +189,7 @@ function tphr_send(sender, receiver)
|
|||||||
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"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
tphr_list[receiver] = sender
|
||||||
tpr_accept(receiver)
|
tpr_accept(receiver)
|
||||||
minetest.chat_send_player(sender, S("@1 is teleporting to you.", receiver))
|
minetest.chat_send_player(sender, S("@1 is teleporting to you.", receiver))
|
||||||
return
|
return
|
||||||
@ -158,14 +205,19 @@ function tphr_send(sender, receiver)
|
|||||||
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 ", timeout_delay))
|
minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds", timeout_delay))
|
||||||
|
|
||||||
-- Write name values to list and clear old values.
|
-- Write name values to list and clear old values.
|
||||||
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
tphr_list[receiver] = sender
|
||||||
tphr_list[receiver] = sender
|
-- Teleport timeout delay
|
||||||
-- Teleport timeout delay
|
minetest.after(timeout_delay, function(name)
|
||||||
minetest.after(timeout_delay, clear_tphr_list, receiver)
|
if tphr_list[name] then
|
||||||
end
|
tphr_list[name] = nil
|
||||||
|
minetest.chat_send_player(sender, S("Request timed-out."))
|
||||||
|
minetest.chat_send_player(receiver, S("Request timed-out."))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end, receiver)
|
||||||
end
|
end
|
||||||
|
|
||||||
function tpc_send(player, coordinates)
|
function tpc_send(player, coordinates)
|
||||||
@ -184,7 +236,7 @@ function tpc_send(player, coordinates)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local target_coords = {x=posx, y=posy, z=posz}
|
target_coords = {x=posx, y=posy, z=posz}
|
||||||
|
|
||||||
if can_teleport(target_coords) == false then
|
if 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(player, S("You cannot teleport to a location outside the map!"))
|
||||||
@ -195,11 +247,8 @@ 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
|
||||||
|
tpc_teleport_player(player)
|
||||||
minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
|
||||||
pname:set_pos(find_free_position_near(target_coords))
|
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
|
||||||
--parti2(target_coords)
|
|
||||||
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,pname)
|
local protected = minetest.is_protected(target_coords,pname)
|
||||||
@ -210,11 +259,8 @@ function tpc_send(player, coordinates)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
tpc_teleport_player(player)
|
||||||
minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz))
|
||||||
pname:set_pos(find_free_position_near(target_coords))
|
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
|
||||||
--parti2(target_coords)
|
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player, S("Error: You do not have permission to teleport to coordinates."))
|
minetest.chat_send_player(player, S("Error: You do not have permission to teleport to coordinates."))
|
||||||
return
|
return
|
||||||
@ -224,12 +270,18 @@ end
|
|||||||
|
|
||||||
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], S("Teleport request denied."))
|
name2 = tpr_list[name]
|
||||||
|
minetest.chat_send_player(name2, S("Teleport request denied."))
|
||||||
|
minetest.chat_send_player(name, S("You denied the request @1 sent you.", name2))
|
||||||
tpr_list[name] = nil
|
tpr_list[name] = nil
|
||||||
end
|
elseif tphr_list[name] then
|
||||||
if tphr_list[name] then
|
name2 = tphr_list[name]
|
||||||
minetest.chat_send_player(tphr_list[name], S("Teleport request denied."))
|
minetest.chat_send_player(name2, S("Teleport request denied."))
|
||||||
|
minetest.chat_send_player(name, S("You denied the request @1 sent you.", name2))
|
||||||
tphr_list[name] = nil
|
tphr_list[name] = nil
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name, S("Usage: /tpn allows you to deny teleport requests sent to you by other players."))
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -242,8 +294,6 @@ function tpr_accept(name, param)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local chatmsg, source, target, name2
|
|
||||||
|
|
||||||
if tpr_list[name] then
|
if tpr_list[name] then
|
||||||
name2 = tpr_list[name]
|
name2 = tpr_list[name]
|
||||||
source = minetest.get_player_by_name(name)
|
source = minetest.get_player_by_name(name)
|
||||||
@ -263,18 +313,13 @@ function tpr_accept(name, param)
|
|||||||
-- 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 just disconnected/left (by timeout).", name2))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(name2, S("Request Accepted!"))
|
minetest.chat_send_player(name2, S("Request Accepted!"))
|
||||||
minetest.chat_send_player(name, chatmsg)
|
minetest.chat_send_player(name, chatmsg)
|
||||||
|
tpr_teleport_player()
|
||||||
local target_coords = source:get_pos()
|
|
||||||
local target_sound = target:get_pos()
|
|
||||||
target:set_pos(find_free_position_near(target_coords))
|
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
|
||||||
minetest.sound_play("whoosh", {pos = target_sound, gain = 0.5, max_hear_distance = 10})
|
|
||||||
--parti2(target_coords)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Teleport Jump - Relative Position Teleportation by number of nodes
|
-- Teleport Jump - Relative Position Teleportation by number of nodes
|
||||||
@ -293,11 +338,11 @@ function tpj(player, param)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not tonumber(args[2]) then
|
if not tonumber(args[2]) then
|
||||||
return false, "Not a Number!"
|
return false, S("Not a number!")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initially generate the target coords from the player's current position (since it's relative) and then perform the math.
|
-- Initially generate the target coords from the player's current position (since it's relative) and then perform the math.
|
||||||
local target_coords = minetest.get_player_by_name(player):get_pos()
|
target_coords = minetest.get_player_by_name(player):get_pos()
|
||||||
if args[1] == "x" then
|
if args[1] == "x" then
|
||||||
target_coords["x"] = target_coords["x"] + tonumber(args[2])
|
target_coords["x"] = target_coords["x"] + tonumber(args[2])
|
||||||
elseif args[1] == "y" then
|
elseif args[1] == "y" then
|
||||||
@ -312,10 +357,7 @@ function tpj(player, param)
|
|||||||
minetest.chat_send_player(player, S("You cannot teleport to a location outside the map!"))
|
minetest.chat_send_player(player, S("You cannot teleport to a location outside the map!"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
tpc_teleport_player(player)
|
||||||
pname:set_pos(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
|
||||||
|
|
||||||
-- Evade
|
-- Evade
|
||||||
@ -338,7 +380,7 @@ function tpe(player)
|
|||||||
distance = isnegative .. math.random(mindistance,maxdistance) -- the distance to jump
|
distance = isnegative .. math.random(mindistance,maxdistance) -- the distance to jump
|
||||||
axis = options[math.random(3)]
|
axis = options[math.random(3)]
|
||||||
local command = axis .. " " .. distance
|
local command = axis .. " " .. distance
|
||||||
tpj(player,command)
|
tpj(player, command)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
iteration = iteration + 0.5
|
iteration = iteration + 0.5
|
||||||
@ -358,6 +400,7 @@ if enable_tpp_command then
|
|||||||
-- Show the available places to the player (taken from shivajiva101's POI mod, thanks!).
|
-- Show the available places to the player (taken from shivajiva101's POI mod, thanks!).
|
||||||
if param == "" then
|
if param == "" then
|
||||||
local places = {}
|
local places = {}
|
||||||
|
if not available_places then available_places = {} end
|
||||||
for key, value in pairs(available_places) do
|
for key, value in pairs(available_places) do
|
||||||
table.insert(places, key)
|
table.insert(places, key)
|
||||||
end
|
end
|
||||||
@ -366,14 +409,11 @@ if enable_tpp_command then
|
|||||||
end
|
end
|
||||||
table.insert(places, S("Usage: /tpp <place>"))
|
table.insert(places, S("Usage: /tpp <place>"))
|
||||||
return true, table.concat(places, "\n")
|
return true, table.concat(places, "\n")
|
||||||
|
|
||||||
-- Teleport player to the specified place (taken from shivajiva101's POI mod, thanks!).
|
-- Teleport player to the specified place (taken from shivajiva101's POI mod, thanks!).
|
||||||
elseif available_places[param] then
|
elseif available_places[param] then
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
pos = {x = available_places[param].x, y = available_places[param].y, z = available_places[param].z}
|
||||||
local pos = {x = available_places[param].x, y = available_places[param].y, z = available_places[param].z}
|
tpp_teleport_player(player)
|
||||||
pname:set_pos(pos)
|
|
||||||
minetest.chat_send_player(player, S("Teleporting to @1.", param))
|
minetest.chat_send_player(player, S("Teleporting to @1.", param))
|
||||||
minetest.sound_play("whoosh", {pos = pos, gain = 0.5, max_hear_distance = 10})
|
|
||||||
-- Check if the place exists.
|
-- Check if the place exists.
|
||||||
elseif not available_places[param] then
|
elseif not available_places[param] then
|
||||||
minetest.chat_send_player(player, S("There is no place by that name. Keep in mind this is case-sensitive."))
|
minetest.chat_send_player(player, S("There is no place by that name. Keep in mind this is case-sensitive."))
|
||||||
|
24
locale/es.po
24
locale/es.po
@ -48,6 +48,10 @@ msgstr "@1 esta pidiendo teletransportarse a ti. /tpy para aceptar"
|
|||||||
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
|
||||||
|
msgid "Request timed-out."
|
||||||
|
msgstr "La solicitud enviada expiró."
|
||||||
|
|
||||||
#: init.lua:147
|
#: init.lua:147
|
||||||
msgid "@1 is teleporting to you."
|
msgid "@1 is teleporting to you."
|
||||||
msgstr "@1 se esta teletransportando a ti."
|
msgstr "@1 se esta teletransportando a ti."
|
||||||
@ -66,7 +70,7 @@ msgstr "Uso: /tpc <x, y, z>"
|
|||||||
|
|
||||||
#: init.lua:194
|
#: init.lua:194
|
||||||
msgid "You cannot teleport to a location outside the map!"
|
msgid "You cannot teleport to a location outside the map!"
|
||||||
msgstr "No puedes teletransportarte afuera del mundo!"
|
msgstr "¡No puedes teletransportarte afuera del mundo!"
|
||||||
|
|
||||||
#: init.lua:204
|
#: init.lua:204
|
||||||
msgid "Teleporting to: @1, @2, @3"
|
msgid "Teleporting to: @1, @2, @3"
|
||||||
@ -84,13 +88,25 @@ msgstr "Error: No tienes permiso para teletransportarte a esas coordenadas."
|
|||||||
msgid "Teleport request denied."
|
msgid "Teleport request denied."
|
||||||
msgstr "Solicitud denegada."
|
msgstr "Solicitud denegada."
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "You denied the request @1 sent you."
|
||||||
|
msgstr "Tú denegaste la solicitud de teletransporte que @1 te mando."
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Usage: /tpn allows you to deny teleport requests sent to you by other players."
|
||||||
|
msgstr "Uso: /tpn te permite denegar solicitudes enviadas para ti de otros jugadores."
|
||||||
|
|
||||||
#: init.lua:278
|
#: init.lua:278
|
||||||
msgid "Usage: /tpy allows you to accept teleport requests sent to you by other players"
|
msgid "Usage: /tpy allows you to accept teleport 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
|
||||||
|
msgid "@1 just disconnected/left (by timeout)."
|
||||||
|
msgstr "@1 se desconecto/fue."
|
||||||
|
|
||||||
#: init.lua:317
|
#: init.lua:317
|
||||||
msgid "Request Accepted!"
|
msgid "Request Accepted!"
|
||||||
msgstr "Solicitud aceptada!"
|
msgstr "¡Solicitud aceptada!"
|
||||||
|
|
||||||
#: init.lua:330
|
#: init.lua:330
|
||||||
msgid "Usage: <x|y|z> <number>"
|
msgid "Usage: <x|y|z> <number>"
|
||||||
@ -100,6 +116,10 @@ msgstr "Uso: <x|y|z> <numero>"
|
|||||||
msgid "Not a valid axis. Valid options are X, Y or Z"
|
msgid "Not a valid axis. Valid options are X, Y or Z"
|
||||||
msgstr "Eje invalido. Opciones validas son x, y, o z"
|
msgstr "Eje invalido. Opciones validas son x, y, o z"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Not a number!"
|
||||||
|
msgstr "¡No un número!"
|
||||||
|
|
||||||
#: init.lua:367
|
#: init.lua:367
|
||||||
msgid "EVADE!"
|
msgid "EVADE!"
|
||||||
msgstr "¡EVADIR!"
|
msgstr "¡EVADIR!"
|
||||||
|
@ -48,6 +48,10 @@ msgstr ""
|
|||||||
msgid "Teleport request sent! It will timeout in @1 seconds"
|
msgid "Teleport request sent! It will timeout in @1 seconds"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Request timed-out."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua:147
|
#: init.lua:147
|
||||||
msgid "@1 is teleporting to you."
|
msgid "@1 is teleporting to you."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -84,10 +88,22 @@ msgstr ""
|
|||||||
msgid "Teleport request denied."
|
msgid "Teleport request denied."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "You denied the request @1 sent you."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Usage: /tpn allows you to deny teleport requests sent to you by other players."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua:278
|
#: init.lua:278
|
||||||
msgid "Usage: /tpy allows you to accept teleport requests sent to you by other players"
|
msgid "Usage: /tpy allows you to accept teleport requests sent to you by other players"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "@1 just disconnected/left (by timeout)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua:317
|
#: init.lua:317
|
||||||
msgid "Request Accepted!"
|
msgid "Request Accepted!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -100,6 +116,10 @@ msgstr ""
|
|||||||
msgid "Not a valid axis. Valid options are X, Y or Z"
|
msgid "Not a valid axis. Valid options are X, Y or Z"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Not a number!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: init.lua:367
|
#: init.lua:367
|
||||||
msgid "EVADE!"
|
msgid "EVADE!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,3 +1,3 @@
|
|||||||
name = tpr
|
name = tpr
|
||||||
optional_depends = areas, intllib
|
optional_depends = areas, intllib
|
||||||
description = Allows players to send a request to other players to teleport to them.
|
description = Allows players to send a request to other players to teleport to them, and do much more.
|
||||||
|
Loading…
Reference in New Issue
Block a user