Add Factorio Luacheck (#25)
See https://github.com/marketplace/actions/factorio-mod-luacheck for more information.
This commit is contained in:
parent
2005c1fe77
commit
4d609719ed
11
.github/workflows/check-release.yml
vendored
Normal file
11
.github/workflows/check-release.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
on: [push, pull_request]
|
||||||
|
name: Check & Release
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: lint
|
||||||
|
uses: Roang-zero1/factorio-mod-luacheck@master
|
||||||
|
with:
|
||||||
|
luacheckrc_url: https://raw.githubusercontent.com/ChaosWormz/teleport-request/add_luacheck/.luacheckrc # Will be changed soon to "master"
|
20
.luacheckrc
Normal file
20
.luacheckrc
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
unused_args = false
|
||||||
|
allow_defined_top = true
|
||||||
|
max_line_length = 999
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"tp"
|
||||||
|
}
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
string = {fields = {"split", "trim"}},
|
||||||
|
table = {fields = {"copy", "getn"}},
|
||||||
|
|
||||||
|
"minetest", "core",
|
||||||
|
"vector", "ItemStack",
|
||||||
|
"dump", "dump2",
|
||||||
|
|
||||||
|
"chat2", "gamehub",
|
||||||
|
"intllib", "areas",
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,8 @@
|
|||||||
# Teleport Request
|
# Teleport Request
|
||||||
|
|
||||||
|
![](https://github.com/ChaosWormz/teleport-request/workflows/Check%20&%20Release/badge.svg)
|
||||||
|
[![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
Allows players to request from another player to be teleported to them.
|
Allows players to request from another player to be teleported to them.
|
||||||
|
|
||||||
## Privileges
|
## Privileges
|
||||||
|
@ -18,9 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|||||||
USA
|
USA
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Support for intllib
|
|
||||||
local S = tp.intllib
|
|
||||||
|
|
||||||
-- Timeout delay and mod version.
|
-- Timeout delay and mod version.
|
||||||
tp.timeout_delay = tonumber(minetest.settings:get("tp.timeout_delay")) or 60
|
tp.timeout_delay = tonumber(minetest.settings:get("tp.timeout_delay")) or 60
|
||||||
tp.version = "1.5"
|
tp.version = "1.5"
|
||||||
@ -28,8 +25,6 @@ tp.version = "1.5"
|
|||||||
-- Enable teleporting immediately to the specified player for those with "tp_admin" privilege.
|
-- Enable teleporting immediately to the specified player for those with "tp_admin" privilege.
|
||||||
tp.enable_immediate_teleport = minetest.settings:get_bool("tp.enable_immediate_teleport")
|
tp.enable_immediate_teleport = minetest.settings:get_bool("tp.enable_immediate_teleport")
|
||||||
|
|
||||||
local chatmsg, source, target, name2, target_coords, pos
|
|
||||||
|
|
||||||
-- 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).
|
||||||
-- You must activate "enable_tpp_command" in order to make this to work.
|
-- You must activate "enable_tpp_command" in order to make this to work.
|
||||||
tp.available_places = {
|
tp.available_places = {
|
||||||
|
117
functions.lua
117
functions.lua
@ -21,6 +21,9 @@ USA
|
|||||||
-- Support for intllib
|
-- Support for intllib
|
||||||
local S = tp.intllib
|
local S = tp.intllib
|
||||||
|
|
||||||
|
-- Placeholders
|
||||||
|
local chatmsg, source, target, name2, target_coords, pos2
|
||||||
|
|
||||||
local map_size = 30912
|
local map_size = 30912
|
||||||
function tp.can_teleport(to)
|
function tp.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
|
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
|
||||||
@ -28,29 +31,29 @@ end
|
|||||||
|
|
||||||
-- Teleport player to a player (used in "/tpr" and in "/tphr" command).
|
-- Teleport player to a player (used in "/tpr" and in "/tphr" command).
|
||||||
function tp.tpr_teleport_player()
|
function tp.tpr_teleport_player()
|
||||||
local target_coords = source:get_pos()
|
target_coords = source:get_pos()
|
||||||
local target_sound = target:get_pos()
|
local target_sound = target:get_pos()
|
||||||
target:set_pos(tp.find_free_position_near(target_coords))
|
target:set_pos(tp.find_free_position_near(target_coords))
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos2 = target_coords, gain = 0.5, max_hear_distance = 10})
|
||||||
minetest.sound_play("whoosh", {pos = target_sound, gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos2 = target_sound, gain = 0.5, max_hear_distance = 10})
|
||||||
--tp.parti2(target_coords)
|
--tp.parti2(target_coords)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TPC & TPJ
|
-- TPC & TPJ
|
||||||
function tp.tpc_teleport_player(player)
|
function tp.tpc_teleport_player(player)
|
||||||
local pname = minetest.get_player_by_name(player)
|
local pname = minetest.get_player_by_name(player)
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos2 = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
||||||
pname:set_pos(tp.find_free_position_near(target_coords))
|
pname:set_pos(tp.find_free_position_near(target_coords))
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos2 = target_coords, gain = 0.5, max_hear_distance = 10})
|
||||||
--tp.parti2(target_coords)
|
--tp.parti2(target_coords)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TPP
|
-- TPP
|
||||||
function tp.tpp_teleport_player(player)
|
function tp.tpp_teleport_player(player)
|
||||||
local pname = minetest.get_player_by_name(player)
|
local pname = minetest.get_player_by_name(player)
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos2 = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
||||||
pname:set_pos(tp.find_free_position_near(pos))
|
pname:set_pos(tp.find_free_position_near(pos2))
|
||||||
minetest.sound_play("whoosh", {pos = pos, gain = 0.5, max_hear_distance = 10})
|
minetest.sound_play("whoosh", {pos2 = pos2, gain = 0.5, max_hear_distance = 10})
|
||||||
--tp.parti2(target_coords)
|
--tp.parti2(target_coords)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -97,6 +100,14 @@ end
|
|||||||
function tp.tpr_send(sender, receiver)
|
function tp.tpr_send(sender, receiver)
|
||||||
-- Compatibility with beerchat
|
-- Compatibility with beerchat
|
||||||
if minetest.get_modpath("beerchat") and not minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.get_modpath("beerchat") and not minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
|
if receiver == "" then
|
||||||
|
minetest.chat_send_player(sender, S("Usage: /tpr <Player name>"))
|
||||||
|
if minetest.get_modpath("chat2") then
|
||||||
|
chat2.send_message(minetest.get_player_by_name(sender), S("Usage: /tpr <Player name>"), 0xFFFFFF)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
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"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
@ -118,18 +129,18 @@ function tp.tpr_send(sender, receiver)
|
|||||||
if minetest.check_player_privs(sender, {tp_admin = true}) and tp.enable_immediate_teleport then
|
if minetest.check_player_privs(sender, {tp_admin = true}) and tp.enable_immediate_teleport then
|
||||||
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>"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Usage: /tpr <Player name>"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Usage: /tpr <Player name>"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
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"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
tp.tpr_list[receiver] = sender
|
tp.tpr_list[receiver] = sender
|
||||||
@ -140,29 +151,29 @@ function tp.tpr_send(sender, receiver)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
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>"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Usage: /tpr <Player name>"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Usage: /tpr <Player name>"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
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"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("gamehub") then -- Compatibility with gamehub (UNTESTED)
|
if minetest.get_modpath("gamehub") then -- Compatibility with gamehub (UNTESTED)
|
||||||
if gamehub.players[receiver] then
|
if gamehub.players[receiver] then
|
||||||
minetest.chat_send_player(sender, S("Teleport request denied, player is in the gamehub!"))
|
minetest.chat_send_player(sender, S("Teleport request denied, player is in the gamehub!"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request denied, player is in the gamehub!"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request denied, player is in the gamehub!"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -201,7 +212,7 @@ function tp.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"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -218,18 +229,18 @@ function tp.tphr_send(sender, receiver)
|
|||||||
if minetest.check_player_privs(sender, {tp_admin = true}) and tp.enable_immediate_teleport then
|
if minetest.check_player_privs(sender, {tp_admin = true}) and tp.enable_immediate_teleport then
|
||||||
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>"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Usage. /tphr <Player name>"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Usage. /tphr <Player name>"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
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"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
tp.tphr_list[receiver] = sender
|
tp.tphr_list[receiver] = sender
|
||||||
@ -243,26 +254,26 @@ function tp.tphr_send(sender, 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>"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Usage. /tphr <Player name>"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Usage. /tphr <Player name>"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_player_by_name(receiver) then
|
if not minetest.get_player_by_name(receiver) then
|
||||||
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"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("gamehub") then -- Compatibility with gamehub (UNTESTED)
|
if minetest.get_modpath("gamehub") then -- Compatibility with gamehub (UNTESTED)
|
||||||
if gamehub.players[receiver] then
|
if gamehub.players[receiver] then
|
||||||
minetest.chat_send_player(sender, S("Teleport request denied, player is in the gamehub!"))
|
minetest.chat_send_player(sender, S("Teleport request denied, player is in the gamehub!"))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request denied, player is in the gamehub!"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request denied, player is in the gamehub!"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -391,7 +402,7 @@ function tp.tpr_deny(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Teleport Accept Systems
|
-- Teleport Accept Systems
|
||||||
function tp.tpr_accept(name, param)
|
function tp.tpr_accept(name)
|
||||||
|
|
||||||
-- Check to prevent constant teleporting.
|
-- Check to prevent constant teleporting.
|
||||||
if not tp.tpr_list[name] and not tp.tphr_list[name] then
|
if not tp.tpr_list[name] and not tp.tphr_list[name] then
|
||||||
@ -401,7 +412,7 @@ function tp.tpr_accept(name, param)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if tp.tpr_list[name] then
|
if tp.tpr_list[name] then
|
||||||
name2 = tp.tpr_list[name]
|
name2 = tp.tpr_list[name]
|
||||||
source = minetest.get_player_by_name(name)
|
source = minetest.get_player_by_name(name)
|
||||||
@ -418,7 +429,7 @@ function tp.tpr_accept(name, param)
|
|||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 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
|
||||||
@ -440,7 +451,6 @@ end
|
|||||||
|
|
||||||
-- Teleport Jump - Relative Position Teleportation by number of nodes
|
-- Teleport Jump - Relative Position Teleportation by number of nodes
|
||||||
function tp.tpj(player, param)
|
function tp.tpj(player, param)
|
||||||
local pname = minetest.get_player_by_name(player)
|
|
||||||
|
|
||||||
if param == "" then
|
if param == "" then
|
||||||
minetest.chat_send_player(player, S("Usage: <x|y|z> <number>"))
|
minetest.chat_send_player(player, S("Usage: <x|y|z> <number>"))
|
||||||
@ -458,14 +468,14 @@ function tp.tpj(player, param)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not tonumber(args[2]) then
|
if not tonumber(args[2]) then
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Not a number!"), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(player), S("Not a number!"), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
return false, S("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.
|
||||||
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
|
||||||
@ -510,7 +520,7 @@ function tp.tpe(player)
|
|||||||
for i = 1,times do
|
for i = 1,times do
|
||||||
-- do this every 1 second
|
-- do this every 1 second
|
||||||
minetest.after(iteration,
|
minetest.after(iteration,
|
||||||
function()
|
function()
|
||||||
isnegative = negatives[math.random(2)] -- choose randomly whether this is this way or that
|
isnegative = negatives[math.random(2)] -- choose randomly whether this is this way or that
|
||||||
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)]
|
||||||
@ -526,8 +536,7 @@ end
|
|||||||
if tp.enable_tpp_command then
|
if tp.enable_tpp_command then
|
||||||
|
|
||||||
function tp.tpp(player, param)
|
function tp.tpp(player, param)
|
||||||
local pname = minetest.get_player_by_name(player)
|
|
||||||
|
|
||||||
-- 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 = {}
|
||||||
@ -552,14 +561,14 @@ if tp.enable_tpp_command then
|
|||||||
|
|
||||||
-- 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 tp.available_places[param] then
|
elseif tp.available_places[param] then
|
||||||
pos = {x = tp.available_places[param].x, y = tp.available_places[param].y, z = tp.available_places[param].z}
|
pos2 = {x = tp.available_places[param].x, y = tp.available_places[param].y, z = tp.available_places[param].z}
|
||||||
tp.tpp_teleport_player(player)
|
tp.tpp_teleport_player(player)
|
||||||
minetest.chat_send_player(player, S("Teleporting to @1.", param))
|
minetest.chat_send_player(player, S("Teleporting to @1.", param))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
chat2.send_message(minetest.get_player_by_name(player), S("Teleporting to @1.", param), 0xFFFFFF)
|
chat2.send_message(minetest.get_player_by_name(player), S("Teleporting to @1.", param), 0xFFFFFF)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if the place exists.
|
-- Check if the place exists.
|
||||||
elseif not tp.available_places[param] then
|
elseif not tp.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."))
|
||||||
if minetest.get_modpath("chat2") then
|
if minetest.get_modpath("chat2") then
|
||||||
|
11
init.lua
11
init.lua
@ -28,22 +28,21 @@ License: LGPLv2.1+ for everything.
|
|||||||
|
|
||||||
-- 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 = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
tp = {
|
tp = {
|
||||||
intllib = S
|
intllib = S,
|
||||||
|
tpr_list = {},
|
||||||
|
tphr_list = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tp.tpr_list = {}
|
|
||||||
tp.tphr_list = {}
|
|
||||||
|
|
||||||
-- Clear requests when the player leaves
|
-- Clear requests when the player leaves
|
||||||
minetest.register_on_leaveplayer(function(name)
|
minetest.register_on_leaveplayer(function(name)
|
||||||
if tp.tpr_list[name] then
|
if tp.tpr_list[name] then
|
||||||
tp.tpr_list[name] = nil
|
tp.tpr_list[name] = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if tp.tphr_list[name] then
|
if tp.tphr_list[name] then
|
||||||
tp.tphr_list[name] = nil
|
tp.tphr_list[name] = nil
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user