mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add player.create, test.set_setting, test.sleep_until, world.count_chunks
This commit is contained in:
parent
8a5042f2a2
commit
9ec8788838
10 changed files with 84 additions and 34 deletions
|
|
@ -16,7 +16,19 @@ if test then
|
|||
test.open_world = core.open_world
|
||||
test.close_world = core.close_world
|
||||
test.reconfig_packs = core.reconfig_packs
|
||||
test.set_setting = core.set_setting
|
||||
test.tick = coroutine.yield
|
||||
|
||||
function test.sleep_until(predicate, max_ticks)
|
||||
max_ticks = max_ticks or 1e9
|
||||
local ticks = 0
|
||||
while ticks < max_ticks and not predicate() do
|
||||
test.tick()
|
||||
end
|
||||
if ticks == max_ticks then
|
||||
error("max ticks exceed")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue