add teleport_request mod, update .conf

master
elite 2017-07-29 15:21:21 -04:00
parent e0061017f9
commit a3a59be15d
7 changed files with 435 additions and 3 deletions

View File

@ -1,12 +1,12 @@
#################UGX Realms######################
name = aerozoic
name = cessna151
################Server#####################
#
server_announce = true
server_name = UGX Realms (AMHI Inspired remake)
server_description = A survival server inspired by the old AMHI server, but with several improvements and new features. (Unified inventory, PVP toggle button, and more!)
server_address = minetestservers.ddns.net
server_url =
server_url = https://forum.minetest.net/viewtopic.php?f=10&t=18183
max_users = 30
port = 33151
remote_port = 33151
@ -36,7 +36,7 @@ share_bones_time_early = 0 #If player dies in protected area... (0=disabled)
default_privs = interact, home, shout, spawn, fast
enable_floating_dungeons = false
give_initial_stuff = true
initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 99,default:cobble 99,wool:white 99,default:goldblock
initial_stuff = default:pick_steel,default:axe_steel,default:torch 99,default:cobble 99,wool:white 99,default:goldblock,protector:protect2
enable_fire = false
playereffects_autosave = 60
enable_sprinting = true
@ -49,6 +49,7 @@ protector_pvp = false
protector_radius = 7
day_time_ratio = 80
night_time_ratio = 20
time_speed = 48 #(30 min), Sets duration of one full day/night cycle, default = 72 (20 min)
maximum_characters_per_message = 300
#
#################IRC################

View File

@ -0,0 +1,11 @@
####DO WHAT YOU WANT TO PUBLIC LICENSE (DWYWPL)
December 2nd 2015
License Copyright (C) 2015 Michael Tomaino (PlatinumArts@gmail.com)
[www.sandboxgamemaker.com/DWYWPL/](www.sandboxgamemaker.com/DWYWPL/)
#####DO WHAT YOU WANT TO PUBLIC LICENSE
######TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1. You are allowed to do whatever you want to with what content is using this license.
2. This content is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this content.

View File

@ -0,0 +1,76 @@
##*tps_teleport* is a mod for Minetest game servers.
##Description:
[The Pixel Shadow](https://minetest.tv/) Minetest game servers have switched from "teleport" to "teleport request" via the *tps_teleport* mod. This mod makes it so players must send a request to another player in order to teleport to them. Before they will be allowed to do so, the player must accept the request. This prevents malicious users from teleporting to players' private areas without their permission. It also enhances the overall privacy of our services since if denied teleport, a player must instead travel to the area and "use the front door" so to speak... which might be a locked iron door.
##Privileges:
- **interact** Permits use of /tpr and /tphr
- **tp_tpc** Permits use of /tpc
- **tp_admin** Admin priv allows admin to teleport anywhere without permission
Players may also teleport to coordinates, however if the area is protected, the teleport will be denied.
##Usage:
``` /tpr [playername] ```
- **Name:** Teleport Request
- **Description:** Requests permission to teleport to another player, where [playername] is their exact name.
- **Required Privilege:** interact
- **Example Usage:** */tpr RobbieF* - requests permission from RobbieF to teleport to them.
- **Notes:** Usernames are case-sensitive.
``` /tphr [playername] ```
- **Name:** Teleport Here Request
- **Description:** Request permission to teleport another player to you.
- **Required Privilege:** interact
- **Example Usage:** /tphr RobbieF - requests RobbieF to teleport to you.
- **Notes:** Usernames are case-sensitive.
``` /tpc [x,y,z] ```
- **Name:** Teleport to Coordinates
- **Description:** Teleport to coordinates.
- **Required Privilege:** interact, tp_tpc
- **Notes:** Honors area protection: if the area is protected, it must be owned by you in order to teleport to it.
``` /tpj [axis] [distance] ```
- **Name:** Teleport Jump
- **Description:** Teleport a specified distance along a single specified axis.
- **Required Privilege:** interact
- **Available Options for *axis*:** x, y, z
- **Example Usage:** '/tpj y 10' - teleport 10 nodes into the air.
``` /tpe ```
- **Name:** Teleport Evade
- **Description:** In a sticky situation? Evade your enemy by teleporting to several nearby coordinates in random pattern. There's no knowing where you'll end up.
- **Required Privilege:** interact
- **Example Usage:** '/tpe' - teleports you to a random number of random coordinates in an evasive pattern.
``` /tpy ```
- **Description:** Accept a user's request to teleport to you or teleport you to them.
``` /tpn ```
- **Description:** Deny a user's request to teleport to youor teleport you to them.
###Please Note:
Players with the 'tp_admin' privilege override all the required privileges above, except 'interact'.
##Contributors:
- [RobbieF](https://minetest.tv) | [GitHub](https://github.com/Cat5TV)
- [DonBatman](https://github.com/donbatman)
- [NathanS21](http://nathansalapat.com/)
- [ChaosWormz](https://github.com/ChaosWormz)
- [Traxie21](https://github.com/Traxie21) The original creater of this mod
- All those who contributed to the original mod (please see init.lua)
##To Do:
- 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.
- Make it so tp_admin priv also overrides need for player to accept /tpr or /tphr
- 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)
- Add a handful of coordinates which can be set in config and teleported to by anyone regardless of their protection status (eg., Spawn).
- Add a privilege which is required in order to use all commands. I haven't added such a thing since it hasn't been needed on our servers, but I imagine it would be useful on other servers who desire to grant these features only to specific players.
- Create a new function for the actual setpos() 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.
- Add a [different] sound effect at the source coords when a TP takes place (so other players hear it when to teleport away).
- Make evade respect land: no teleporting inside land, but instead make sure player is standing on surface or in water.

View File

@ -0,0 +1 @@
areas

View File

@ -0,0 +1,343 @@
-- Originally Teleport Request by Traxie21 and released with the WTFPL license
-- https://forum.minetest.net/viewtopic.php?id=4457
-- Updates by Zeno and ChaosWormz
-- New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/
local timeout_delay = 60
local version = "1.5"
local tpr_list = {}
local tphr_list = {}
--Not needed...
--[[
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 tries = {
{x=1,y=0,z=0},
{x=-1,y=0,z=0},
{x=0,y=0,z=1},
{x=0,y=0,z=-1},
}
for _,d in pairs(tries) do
local p = vector.add(pos, d)
if not minetest.registered_nodes[minetest.get_node(p).name].walkable then
return p, true
end
end
return pos, false
end
local function parti(pos)
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=0, y=5, z=0}, {x=0, y=0, z=0},
{x=0, y=5, z=0}, {x=0, y=0, z=0},
3, 5,
3, 5,
false,
"tps_portal_parti.png")
end
local function parti2(pos)
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=0, y=-5, z=0}, {x=0, y=0, z=0},
{x=0, y=-5, z=0}, {x=0, y=0, z=0},
3, 5,
3, 5,
false,
"tps_portal_parti.png")
end
--Teleport Request System
local function tpr_send(sender, receiver)
if receiver == "" then
minetest.chat_send_player(sender, "Usage: /tpr <Player name>")
return
end
if not minetest.get_player_by_name(receiver) then
minetest.chat_send_player(sender, "There is no player by that name. Keep in mind this is case sensitive, and the player must be online.")
return
end
minetest.chat_send_player(receiver, sender ..' is requesting to teleport to you. /tpy to accept.')
minetest.chat_send_player(sender, 'Teleport request sent! It will time out in '.. timeout_delay ..' seconds.')
--Write name values to list and clear old values.
tpr_list[receiver] = sender
--Teleport timeout delay
minetest.after(timeout_delay, function(name)
if tpr_list[name] then
tpr_list[name] = nil
end
end, sender)
end
local function tphr_send(sender, receiver)
if receiver == "" then
minetest.chat_send_player(sender, "Usage: /tphr <Player name>")
return
end
if not minetest.get_player_by_name(receiver) then
minetest.chat_send_player(sender, "There is no player by that name. Keep in mind this is case sensitive, and the player must be online.")
return
end
minetest.chat_send_player(receiver, sender ..' is requesting that you teleport to them. /tpy to accept; /tpn to deny')
minetest.chat_send_player(sender, 'Teleport request sent! It will time out in '.. timeout_delay ..' seconds.')
--Write name values to list and clear old values.
tphr_list[receiver] = sender
--Teleport timeout delay
minetest.after(timeout_delay, function(name)
if tphr_list[name] then
tphr_list[name] = nil
end
end, sender)
end
--Not needed...
--[[
local function tpc_send(player,coordinates)
local posx,posy,posz = string.match(coordinates, "^(-?%d+),(-?%d+),(-?%d+)$")
local pname = minetest.get_player_by_name(player)
if posx ~= nil or posy ~= nil or posz ~= nil then
posx = tonumber(posx) + 0.0
posy = tonumber(posy) + 0.0
posz = tonumber(posz) + 0.0
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
minetest.chat_send_player(player, "Usage: /tpc <x,y,z>")
return nil
end
if posx > 32765 or posx < -32765 or posy > 32765 or posy < -32765 or posz > 32765 or posz < -32765 then
minetest.chat_send_player(player, "Error: Invalid coordinates.")
return nil
end
local target_coords={x=posx, y=posy, z=posz}
-- 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
if minetest.check_player_privs(pname, {tp_admin=true}) then
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
if minetest.check_player_privs(pname, {tp_tpc=true}) then
local protected = minetest.is_protected(target_coords,pname)
if protected 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)
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
end
--]]
local function tpr_deny(name)
if tpr_list[name] then
minetest.chat_send_player(tpr_list[name], 'Teleport request denied.')
tpr_list[name] = nil
end
if tphr_list[name] then
minetest.chat_send_player(tphr_list[name], 'Teleport request denied.')
tphr_list[name] = nil
end
end
--Teleport Accept Systems
local function tpr_accept(name, param)
--Check to prevent constant teleporting.
if not tpr_list[name]
and not tphr_list[name] then
minetest.chat_send_player(name, "Usage: /tpy allows you to accept teleport requests sent to you by other players.")
return
end
local chatmsg, source, target, name2
if tpr_list[name] then
name2 = tpr_list[name]
source = minetest.get_player_by_name(name)
target = minetest.get_player_by_name(name2)
chatmsg = name2 .. " is teleporting to you."
minetest.log("action", name2 .. " teleported to " .. name .. " via tpr.")
tpr_list[name] = nil
elseif tphr_list[name] then
name2 = tphr_list[name]
source = minetest.get_player_by_name(name2)
target = minetest.get_player_by_name(name)
chatmsg = "You are teleporting to " .. name2 .. "."
minetest.log("action", name .. " teleported to " .. name2 .. " via tphr.")
tphr_list[name] = nil
else
return
end
-- Could happen if either player disconnects (or timeout); if so just abort
if not source
or not target then
return
end
minetest.chat_send_player(name2, "Request Accepted!")
minetest.chat_send_player(name, chatmsg)
local target_coords=source:getpos()
target: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
--Not needed...
--[[
-- Teleport Jump - Relative Position Teleportation by number of nodes
local function tpj(player,param)
local pname = minetest.get_player_by_name(player)
if param == "" then
minetest.chat_send_player(player, "Usage. <X|Y|Z> <Number>")
return false
end
local args = param:split(" ") -- look into this. Can it crash if the player does not have two parameters?
if #args < 2 then
minetest.chat_send_player(player, "Usage. <X|Y|Z> <Number>")
return false
end
if not tonumber(args[2]) then
return false, "Not a Number!"
end
-- 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):getpos()
if args[1] == "x" then
target_coords["x"] = target_coords["x"] + tonumber(args[2])
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)
elseif args[1] == "y" then
target_coords["y"] = target_coords["y"] + tonumber(args[2])
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)
elseif args[1] == "z" then
target_coords["z"] = target_coords["z"] + tonumber(args[2])
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,"Not a valid axis. Valid options are X, Y or Z.")
end
end
--]]
--Disabled until it can detect if PVP is enabled.
--[[
-- Evade
local function tpe(player)
minetest.chat_send_player(player, "EVADE!")
local mindistance = 15
local maxdistance = 50
local times = math.random(6,20) -- how many times to jump - minimum,maximum
local negatives = { '-','' } -- either it's this way or that way: the difference between -10 and 10
local options = { 'x', 'y', 'z' }
local isnegative = ''
local distance = 0
local axis = ''
local iteration = 0
for i = 1,times do
-- do this every 1 second
minetest.after(iteration,
function()
isnegative = negatives[math.random(2)] -- choose randomly whether this is this way or that
distance = isnegative .. math.random(mindistance,maxdistance) -- the distance to jump
axis = options[math.random(3)]
local command = axis .. " " .. distance
tpj(player,command)
end
)
iteration = iteration + 0.5
end
end
--]]
minetest.register_chatcommand("tpr", {
description = "Request teleport to another player",
params = "<playername> | leave playername empty to see help message",
privs = {interact=true},
func = tpr_send
})
minetest.register_chatcommand("tphr", {
description = "Request player to teleport to you",
params = "<playername> | leave playername empty to see help message",
privs = {interact=true},
func = tphr_send
})
--[[
minetest.register_chatcommand("tpc", {
description = "Teleport to coordinates",
params = "<coordinates> | leave coordinates empty to see help message",
privs = {interact=true,tp_tpc=true},
func = tpc_send
})
minetest.register_chatcommand("tpj", {
description = "Teleport to relative position",
params = "<axis> <distance> | leave empty to see help message",
privs = {interact=true,tp_tpc=true},
func = tpj
})
minetest.register_chatcommand("tpe", {
description = "Evade Enemy",
privs = {interact=true,tp_tpc=true},
func = tpe
})
--]]
minetest.register_chatcommand("tpy", {
description = "Accept teleport requests from another player",
privs = {interact=true},
func = tpr_accept
})
minetest.register_chatcommand("tpn", {
description = "Deny teleport requests from another player",
privs = {interact=true},
func = tpr_deny
})
minetest.log("info", "[Teleport Request] TPS Teleport v" .. version .. " Loaded.")

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B