mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-08 22:17:27 +01:00
Fix the /tpe loop
This commit is contained in:
parent
0e0eb50206
commit
38982dadf2
21
init.lua
21
init.lua
@ -256,13 +256,24 @@ end
|
|||||||
-- Evade
|
-- Evade
|
||||||
local function tpe(player)
|
local function tpe(player)
|
||||||
local negatives = { '-','' } -- either it's this way or that way
|
local negatives = { '-','' } -- either it's this way or that way
|
||||||
local isnegative = negatives[math.random(2)]
|
|
||||||
local distance = isnegative .. math.random(4,15) -- the distance to jump
|
|
||||||
local times = math.random(3,6) -- how many times to jump - minimum,maximum
|
|
||||||
local options = { 'x', 'y', 'z' }
|
local options = { 'x', 'y', 'z' }
|
||||||
local axis = options[math.random(3)]
|
local mindistance = 4
|
||||||
|
local maxdistance = 15
|
||||||
|
local isnegative = ''
|
||||||
|
local distance = 0
|
||||||
|
local times = 0
|
||||||
|
local axis = ''
|
||||||
for i = 1,times do
|
for i = 1,times do
|
||||||
minetest.after(1, function() tpj(axis,distance) end) -- do this every 1 second
|
-- do this every 1 second
|
||||||
|
minetest.after(1,
|
||||||
|
function()
|
||||||
|
isnegative = negatives[math.random(2)]
|
||||||
|
distance = isnegative .. math.random(mindistance,maxdistance) -- the distance to jump
|
||||||
|
times = math.random(3,6) -- how many times to jump - minimum,maximum
|
||||||
|
axis = options[math.random(3)]
|
||||||
|
tpj(axis,distance)
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user