mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-09 06:17:37 +01:00
Admin priv update
Heh - I had no idea the original author had already added a placeholder for a priv called tpr_admin (how did I miss that), but since it did nothing, I removed it. I also renamed my admin priv to "tp_admin" - I'd originally called it tpr_admin because I still tend to refer to the mod as TPR even though it's evolving into something different, but then realized people might get confused since this mod is called tps_teleport (so should it be tps_admin?) -- so I opted for tp_admin instead... avoid the confusion, and since the original mod doesn't yet use tpr_admin, there's no reason to keep it as that. Also, incremented the version to 1.3 because I feel we've been making pretty big headway here.
This commit is contained in:
parent
589c4e60d8
commit
9f6f5034d8
22
init.lua
22
init.lua
@ -5,15 +5,12 @@
|
|||||||
|
|
||||||
local timeout_delay = 60
|
local timeout_delay = 60
|
||||||
|
|
||||||
-- Set to true to register tpr_admin priv
|
local version = "1.3"
|
||||||
local regnewpriv = false
|
|
||||||
|
|
||||||
local version = "1.2"
|
|
||||||
|
|
||||||
local tpr_list = {}
|
local tpr_list = {}
|
||||||
local tphr_list = {}
|
local tphr_list = {}
|
||||||
|
|
||||||
minetest.register_privilege("tpr_admin", {description = "Admin overrides for TPC.", give_to_singleplayer=false,})
|
minetest.register_privilege("tp_admin", {description = "Admin overrides for tps_teleport.", give_to_singleplayer=false,})
|
||||||
|
|
||||||
--Teleport Request System
|
--Teleport Request System
|
||||||
local function tpr_send(sender, receiver)
|
local function tpr_send(sender, receiver)
|
||||||
@ -90,8 +87,8 @@ local function tpc_send(player,coordinates)
|
|||||||
|
|
||||||
-- 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.
|
-- 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 "tpr_admin") overrides all protection
|
-- Admin user (priv "tp_admin") overrides all protection
|
||||||
if minetest.check_player_privs(user.get_player_name(user), {tpr_admin=true}) then
|
if minetest.check_player_privs(user.get_player_name(user), {tp_admin=true}) then
|
||||||
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
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})
|
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
||||||
pname:setpos(target_coords)
|
pname:setpos(target_coords)
|
||||||
@ -180,17 +177,6 @@ local function tpr_accept(name, param)
|
|||||||
target:setpos(find_free_position_near(source:getpos()))
|
target:setpos(find_free_position_near(source:getpos()))
|
||||||
end
|
end
|
||||||
|
|
||||||
--Initalize Permissions.
|
|
||||||
|
|
||||||
if regnewpriv then
|
|
||||||
minetest.register_privilege("tpr_admin", {
|
|
||||||
description = "Permission to override teleport to other players. UNFINISHED",
|
|
||||||
give_to_singleplayer = true
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
--Initalize Commands.
|
|
||||||
|
|
||||||
minetest.register_chatcommand("tpr", {
|
minetest.register_chatcommand("tpr", {
|
||||||
description = "Request teleport to another player",
|
description = "Request teleport to another player",
|
||||||
params = "<playername> | leave playername empty to see help message",
|
params = "<playername> | leave playername empty to see help message",
|
||||||
|
Loading…
Reference in New Issue
Block a user