+ Recursive teleporting now teleport every 3 seconds

master
Giov4 2020-11-13 00:52:23 +01:00
parent 6239f83942
commit 2805cc2542
2 changed files with 8 additions and 7 deletions

View File

@ -253,12 +253,13 @@ end
function keep_teleporting(player, pos, seconds, current_second)
local step = 3
current_second = current_second or 1
if current_second > seconds then return end
minetest.after(1, function()
minetest.after(step, function()
player:set_pos(pos)
keep_teleporting(player, pos, seconds, current_second + 1)
keep_teleporting(player, pos, seconds, current_second + step)
end)
end

View File

@ -329,6 +329,11 @@ ChatCmdBuilder.new("skywars", function(cmd)
return
end
if min_treasures <= 0 or max_treasures <= 0 then
skywars.print_error(sender, skywars.T("The minimum or maximum amount of treasures has to be greater than 0!"))
return
end
local chest_id = 1
if arena.chests[#arena.chests] then chest_id = arena.chests[#arena.chests].id+1 end
local chest =
@ -341,11 +346,6 @@ ChatCmdBuilder.new("skywars", function(cmd)
id = chest_id
}
if min_treasures <= 0 or max_treasures <= 0 then
skywars.print_error(sender, skywars.T("The minimum or maximum amount of treasures has to be greater than 0!"))
return
end
for i=1, #arena.chests do
if vector.equals(arena.chests[i].pos, pos) then
exists = true