mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2024-08-20 21:34:06 +02:00
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:
parent
579f75769c
commit
8aef6b783e
35
config.lua
35
config.lua
@ -19,8 +19,43 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|||||||
USA
|
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).
|
-- 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 = {
|
||||||
spawn = {x = 0, y = 0, z = 0}, -- Set coordinates of spawn here.
|
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.
|
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,
|
||||||
|
})
|
||||||
|
33
init.lua
33
init.lua
@ -28,47 +28,16 @@ Optional dependencies: areas, intllib
|
|||||||
New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/
|
New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Enable configuration
|
|
||||||
enable_configuration = false
|
|
||||||
|
|
||||||
-- Load support for intllib.
|
-- Load support for intllib.
|
||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
-- Load configuration.
|
-- Load configuration.
|
||||||
if enable_configuration then
|
|
||||||
dofile(MP.."/config.lua")
|
dofile(MP.."/config.lua")
|
||||||
end
|
|
||||||
|
|
||||||
local timeout_delay = 60
|
|
||||||
|
|
||||||
local version = "1.5"
|
|
||||||
|
|
||||||
local tpr_list = {}
|
local tpr_list = {}
|
||||||
local tphr_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 function find_free_position_near(pos)
|
||||||
local tries = {
|
local tries = {
|
||||||
{x=1,y=0,z=0},
|
{x=1,y=0,z=0},
|
||||||
@ -376,7 +345,7 @@ function tpe(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Register chatcommands
|
-- Register chatcommands
|
||||||
if enable_configuration then
|
if enable_tpp_command then
|
||||||
minetest.register_chatcommand("tpp", {
|
minetest.register_chatcommand("tpp", {
|
||||||
description = S("Teleport to a place (i.e., spawn, shop)."),
|
description = S("Teleport to a place (i.e., spawn, shop)."),
|
||||||
params = S("<place> | leave empty to see available places"),
|
params = S("<place> | leave empty to see available places"),
|
||||||
|
Loading…
Reference in New Issue
Block a user