Move functions...

...to "config.lua" and register privileges in "config.lua".
This makes it easier for people to know where they can personalize TPR to their like.
This commit is contained in:
Panquesito7 2019-07-19 15:53:49 -05:00 committed by GitHub
parent 579f75769c
commit 8aef6b783e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 33 deletions

@ -19,8 +19,43 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
--]]
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-- Timeout delay and mod version.
timeout_delay = 60
version = "1.5"
map_size = 30912
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
-- Enable tpp command
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).
available_places = {
spawn = {x = 0, y = 0, z = 0}, -- Set coordinates of spawn here.
shop = {x = 0, y = 0, z = 0}, -- Set coordinates of the shop here.
}
-- Register privileges
minetest.register_privilege("tp", {
description = S("Let players teleport to other players (request will be sent)"),
give_to_singleplayer = false,
give_to_admin = true,
})
minetest.register_privilege("tp_admin", {
description = S("Gives full admin-access to a player."),
give_to_singleplayer = false,
give_to_admin = true,
})
minetest.register_privilege("tp_tpc", {
description = S("Allow player to teleport to coordinates (if allowed by area protection)"),
give_to_singleplayer = false,
give_to_admin = true,
})

@ -28,47 +28,16 @@ Optional dependencies: areas, intllib
New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/
--]]
-- Enable configuration
enable_configuration = false
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-- Load configuration.
if enable_configuration then
dofile(MP.."/config.lua")
end
local timeout_delay = 60
local version = "1.5"
dofile(MP.."/config.lua")
local tpr_list = {}
local tphr_list = {}
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
minetest.register_privilege("tp", {
description = S("Let players teleport to other players (request will be sent)"),
give_to_singleplayer = false,
give_to_admin = true,
})
minetest.register_privilege("tp_admin", {
description = S("Gives full admin-access to a player."),
give_to_singleplayer = false,
give_to_admin = true,
})
minetest.register_privilege("tp_tpc", {
description = S("Allow player to teleport to coordinates (if allowed by area protection)"),
give_to_singleplayer = true,
give_to_admin = true,
})
local function find_free_position_near(pos)
local tries = {
{x=1,y=0,z=0},
@ -376,7 +345,7 @@ function tpe(player)
end
-- Register chatcommands
if enable_configuration then
if enable_tpp_command then
minetest.register_chatcommand("tpp", {
description = S("Teleport to a place (i.e., spawn, shop)."),
params = S("<place> | leave empty to see available places"),