mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-07 21:47:30 +01:00
Tell both players (sender...
...and receiver) that the request sent timed out. Tested with MT/MTG 5.0.1 and works fine. The functions "clear_tpr_list" and "clear_tphr_list" are not used due to a crash while sending the message to both players. Sorry for any inconveniences. I'll (soon?) probably create a fix for this. If anyone has a fix for this, it would be greatly appreciated. You may comment on my PR.
This commit is contained in:
parent
8555e135a6
commit
f09fde8995
24
init.lua
24
init.lua
@ -113,19 +113,19 @@ end
|
|||||||
function clear_tpr_list(name)
|
function clear_tpr_list(name)
|
||||||
if tpr_list[name] then
|
if tpr_list[name] then
|
||||||
tpr_list[name] = nil
|
tpr_list[name] = nil
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function clear_tphr_list(name)
|
function clear_tphr_list(name)
|
||||||
if tphr_list[name] then
|
if tphr_list[name] then
|
||||||
tphr_list[name] = nil
|
tphr_list[name] = nil
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function tpr_send(sender, receiver)
|
function tpr_send(sender, receiver)
|
||||||
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
-- Teleport timeout delay
|
|
||||||
minetest.after(timeout_delay, clear_tpr_list, receiver)
|
|
||||||
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>"))
|
||||||
return
|
return
|
||||||
@ -157,14 +157,19 @@ function tpr_send(sender, receiver)
|
|||||||
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
tpr_list[receiver] = sender
|
tpr_list[receiver] = sender
|
||||||
-- Teleport timeout delay
|
-- Teleport timeout delay
|
||||||
minetest.after(timeout_delay, clear_tpr_list, receiver)
|
minetest.after(timeout_delay, function(name)
|
||||||
|
if tpr_list[name] then
|
||||||
|
tpr_list[name] = nil
|
||||||
|
minetest.chat_send_player(sender, S("Request timed-out."))
|
||||||
|
minetest.chat_send_player(receiver, S("Request timed-out."))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end, receiver)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function tphr_send(sender, receiver)
|
function tphr_send(sender, receiver)
|
||||||
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
-- Teleport timeout delay
|
|
||||||
minetest.after(timeout_delay, clear_tphr_list, 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>"))
|
||||||
return
|
return
|
||||||
@ -195,7 +200,14 @@ function tphr_send(sender, receiver)
|
|||||||
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
tphr_list[receiver] = sender
|
tphr_list[receiver] = sender
|
||||||
-- Teleport timeout delay
|
-- Teleport timeout delay
|
||||||
minetest.after(timeout_delay, clear_tphr_list, receiver)
|
minetest.after(timeout_delay, function(name)
|
||||||
|
if tphr_list[name] then
|
||||||
|
tphr_list[name] = nil
|
||||||
|
minetest.chat_send_player(sender, S("Request timed-out."))
|
||||||
|
minetest.chat_send_player(receiver, S("Request timed-out."))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end, receiver)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user