mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
Merge branch 'main' into background-assets-loader
This commit is contained in:
commit
3c900460e6
3 changed files with 19 additions and 3 deletions
|
|
@ -18,7 +18,7 @@ function ores.place(placements, x, z, w, d, seed, hmap, chunk_height)
|
||||||
for i=1,count do
|
for i=1,count do
|
||||||
local sx = math.random() * w
|
local sx = math.random() * w
|
||||||
local sz = math.random() * d
|
local sz = math.random() * d
|
||||||
local sy = math.random() * (chunk_height * 0.5)
|
local sy = math.random() * (chunk_height * 0.5) + 6
|
||||||
if sy < hmap:at(sx, sz) * chunk_height - 6 then
|
if sy < hmap:at(sx, sz) * chunk_height - 6 then
|
||||||
table.insert(placements, {ore.struct, {sx, sy, sz}, math.random()*4, -1})
|
table.insert(placements, {ore.struct, {sx, sy, sz}, math.random()*4, -1})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ local function include(id, is_include)
|
||||||
end
|
end
|
||||||
|
|
||||||
function apply()
|
function apply()
|
||||||
core.reconfig_packs(add_packs, rem_packs)
|
time.post_runnable(function ()
|
||||||
|
app.reconfig_packs(add_packs, rem_packs)
|
||||||
|
end)
|
||||||
if mode ~= "world" then
|
if mode ~= "world" then
|
||||||
menu:back()
|
menu:back()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ function tb_frame_tostring(frame)
|
||||||
end
|
end
|
||||||
|
|
||||||
local __vc__app_script_coroutine
|
local __vc__app_script_coroutine
|
||||||
|
local __vc__is_post_runnable = false
|
||||||
|
|
||||||
local function complete_app_lib(app)
|
local function complete_app_lib(app)
|
||||||
local __app_load_content = app.load_content
|
local __app_load_content = app.load_content
|
||||||
|
|
@ -44,6 +45,10 @@ local function complete_app_lib(app)
|
||||||
app.tick = __app_tick
|
app.tick = __app_tick
|
||||||
|
|
||||||
local function call_in_app_script_co(func, ...)
|
local function call_in_app_script_co(func, ...)
|
||||||
|
if __vc__is_post_runnable then
|
||||||
|
func(...)
|
||||||
|
return
|
||||||
|
end
|
||||||
local running = coroutine.running()
|
local running = coroutine.running()
|
||||||
if not running or running ~= __vc__app_script_coroutine then
|
if not running or running ~= __vc__app_script_coroutine then
|
||||||
error("content must be reload in application script coroutine")
|
error("content must be reload in application script coroutine")
|
||||||
|
|
@ -513,7 +518,7 @@ local fn_audio_reset_fetch_buffer = audio.__reset_fetch_buffer
|
||||||
audio.__reset_fetch_buffer = nil
|
audio.__reset_fetch_buffer = nil
|
||||||
core.get_core_token = audio.input.__get_core_token
|
core.get_core_token = audio.input.__get_core_token
|
||||||
|
|
||||||
function __process_post_runnables()
|
local function __vc__process_post_runnables()
|
||||||
if #__post_runnables then
|
if #__post_runnables then
|
||||||
for _, func in ipairs(__post_runnables) do
|
for _, func in ipairs(__post_runnables) do
|
||||||
local status, result = xpcall(func, __vc__error)
|
local status, result = xpcall(func, __vc__error)
|
||||||
|
|
@ -547,6 +552,15 @@ function __process_post_runnables()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function __process_post_runnables()
|
||||||
|
__vc__is_post_runnable = true
|
||||||
|
local success, err = pcall(__vc__process_post_runnables)
|
||||||
|
if not success then
|
||||||
|
debug.error("an error ocurred while processing post-runnables: ".. err)
|
||||||
|
end
|
||||||
|
__vc__is_post_runnable = false
|
||||||
|
end
|
||||||
|
|
||||||
function time.post_runnable(runnable)
|
function time.post_runnable(runnable)
|
||||||
table.insert(__post_runnables, runnable)
|
table.insert(__post_runnables, runnable)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue