Merge branch 'main' into refactor-world-renderer

This commit is contained in:
MihailRis 2026-08-02 20:05:42 +03:00
commit 61b601f95a
41 changed files with 464 additions and 78 deletions

View file

@ -1,3 +1,4 @@
generator = "base:demo"
player-entity = "base:player"
hand-skeleton = "base:hand"
block-material = "base:stone"

View file

@ -10,7 +10,7 @@ dropitem = ARGS
if dropitem.item then
dropitem.id = item.index(dropitem.item)
end
if dropitem then
if dropitem then
timer = dropitem.pickup_delay or timer
end
if SAVED_DATA.item then
@ -26,6 +26,7 @@ function on_save()
end
if vc.is_client() then
local SCALE = 0.3
local scale = {1, 1, 1}
local rotation = mat4.rotate({
math.random(), math.random(), math.random()
@ -35,7 +36,7 @@ if vc.is_client() then
local matrix = mat4.idt()
rig:set_model(0, item.model_name(dropitem.id))
local bodysize = math.min(scale[1], scale[2], scale[3])
body:set_size({scale[1], bodysize, scale[3]})
body:set_size(vec3.mul({scale[1], bodysize, scale[3]}, SCALE))
mat4.mul(matrix, rotation, matrix)
mat4.scale(matrix, scale, matrix)
rig:set_matrix(0, matrix)

View file

@ -3,6 +3,7 @@ function on_open(params)
mode = params.mode
end
refresh()
document.search_textbox.focused = true
end
-- add - packs to be added to the world (after apply)

View file

@ -1,4 +1,4 @@
local rules = {nexid = 1, rules = {}}
local rules = {nextid = 1, rules = {}}
function rules.get_rule(name)
local rule = rules.rules[name]
@ -27,13 +27,13 @@ end
function rules.reset(name)
local rule = rules.get_rule(name)
rules.set(rule.default)
rules.set(name, rule.default)
end
function rules.listen(name, handler)
local rule = rules.get_rule(name)
local id = rules.nexid
rules.nextid = rules.nexid + 1
local id = rules.nextid
rules.nextid = rules.nextid + 1
rule.listeners[utf8.encode(id)] = handler
return id
end

View file

@ -3,5 +3,6 @@ name = "default"
base_packs = ["base"]
permissions = [
"network",
"record-audio"
"record-audio",
"sub-instances",
]

View file

@ -140,7 +140,7 @@ console.add_command(
for y=y1,y2 do
for z=z1,z2 do
for x=x1,x2 do
block.set(x, y, z, id)
block.set(x, y, z, id, 0, true)
end
end
end

View file

@ -140,7 +140,20 @@ local __vc_named_coroutines = {}
local __vc_next_coroutine = 1
function __vc_start_coroutine(chunk)
local co = coroutine.create(chunk)
local co = coroutine.create(function()
local _, err = xpcall(chunk, function(msg)
local traceback = debug.get_traceback(0)
local s = string.format("%s:", msg)
for i=1,#traceback - 2 do
local frame = traceback[i]
s = s .. "\n\t"..tb_frame_tostring(frame)
end
return s
end)
if err then
error(err)
end
end)
local id = __vc_next_coroutine
__vc_next_coroutine = __vc_next_coroutine + 1
__vc_coroutines[id] = co

View file

@ -10,8 +10,9 @@ vc = {
is_client = function()
return not _vc_headless
end,
get_version = __vc_app.get_version,
get_setting = __vc_app.get_setting,
get_setting_str = __vc_app.get_setting_str,
str_setting = __vc_app.str_setting,
get_setting_info = __vc_app.get_setting_info,
}