mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-22 21:01:25 +01:00
Remove duplicated code
This commit is contained in:
parent
fb0ec6ca24
commit
8555e135a6
13
init.lua
13
init.lua
@ -53,16 +53,7 @@ function tpr_teleport_player()
|
|||||||
--parti2(target_coords)
|
--parti2(target_coords)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TPJ
|
-- TPC & TPJ
|
||||||
function tpj_teleport_player(player)
|
|
||||||
local pname = minetest.get_player_by_name(player)
|
|
||||||
minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
|
||||||
pname:set_pos(find_free_position_near(target_coords))
|
|
||||||
minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
|
|
||||||
--parti2(target_coords)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- TPC
|
|
||||||
function tpc_teleport_player(player)
|
function 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", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10})
|
||||||
@ -338,7 +329,7 @@ function tpj(player, param)
|
|||||||
minetest.chat_send_player(player, S("You cannot teleport to a location outside the map!"))
|
minetest.chat_send_player(player, S("You cannot teleport to a location outside the map!"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
tpj_teleport_player(player)
|
tpc_teleport_player(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Evade
|
-- Evade
|
||||||
|
Loading…
Reference in New Issue
Block a user