add drop-item model, new block functions

This commit is contained in:
MihailRis
2024-07-03 16:34:09 +03:00
parent 1c4e13dc67
commit 48b5be6bc9
11 changed files with 81 additions and 24 deletions
+20 -12
View File
@@ -7,19 +7,27 @@ ready = false
local dropitem = ARGS.item
local rotation = mat4.rotate({0, 1, 0}, math.random() * 360)
mat4.rotate(rotation, {1, 0, 0}, math.random() * 360, rotation)
mat4.rotate(rotation, {0, 0, 1}, math.random() * 360, rotation)
rig:set_matrix(0, rotation)
local icon = item.icon(dropitem.id)
if icon:find("^block%-previews%:") then
local bid = block.index(icon:sub(16))
local textures = block.get_textures(bid)
for i,t in ipairs(textures) do
rig:set_texture("$"..tostring(i-1), "blocks:"..textures[i])
do -- setup visuals
local rotation = mat4.rotate({0, 1, 0}, math.random() * 360)
mat4.rotate(rotation, {1, 0, 0}, math.random() * 360, rotation)
mat4.rotate(rotation, {0, 0, 1}, math.random() * 360, rotation)
rig:set_matrix(0, rotation)
local icon = item.icon(dropitem.id)
if icon:find("^block%-previews%:") then
local bid = block.index(icon:sub(16))
if block.get_model(bid) == "X" then
entity:set_rig("drop-item")
rig:set_texture("$0", icon)
else
local textures = block.get_textures(bid)
for i,t in ipairs(textures) do
rig:set_texture("$"..tostring(i-1), "blocks:"..textures[i])
end
end
else
entity:set_rig("drop-item")
rig:set_texture("$0", icon)
end
else
rig:set_texture("$0", icon)
end
function on_grounded(force)