+ Recursive teleporting now teleport every 3 seconds
parent
6239f83942
commit
2805cc2542
|
@ -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
|
||||
|
|
10
commands.lua
10
commands.lua
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue