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
@@ -17,27 +17,32 @@ vt 1.0 1.0
vt 0.0 1.0
vt 1.0 0.0
vt 1.0 1.0
vt 0.0 1.0
vt 0.0 0.0
vt 1.0 0.0
vt 0.0 1.0
vt 0.0 0.0
vt 0.0 1.0
vt 1.0 0.0
vt 1.0 1.0
vt 1.0 0.0
vt 1.0 1.0
vt 0.0 1.0
vt 0.0 0.0
vn 0.0 -1.0 0.0
vn 0.0 1.0 0.0
vn 1.0 -0.0 0.0
vn -0.0 -0.0 1.0
vn -1.0 -0.0 -0.0
vn 0.0 0.0 -1.0
usemtl $0
vn -0.0 -0.0 1.0
usemtl $2
s off
f 1/1/1 2/2/1 3/3/1 4/4/1
usemtl $3
f 5/5/2 8/6/2 7/7/2 6/8/2
f 1/1/3 5/9/3 6/10/3 2/11/3
f 2/12/4 6/13/4 7/7/4 3/14/4
f 3/15/5 7/16/5 8/17/5 4/4/5
f 5/5/6 1/18/6 4/19/6 8/20/6
usemtl $0
f 1/9/3 5/10/3 6/8/3 2/11/3
usemtl $1
f 3/12/4 7/7/4 8/13/4 4/14/4
usemtl $4
f 5/15/5 1/1/5 4/16/5 8/17/5
usemtl $5
f 2/2/6 6/18/6 7/19/6 3/20/6
+4 -3
View File
@@ -5,10 +5,11 @@
"events/pickup"
],
"models": [
"cube",
"item"
"drop-block",
"drop-item"
],
"rigs": [
"drop"
"drop",
"drop-item"
]
}
+5
View File
@@ -0,0 +1,5 @@
{
"root": {
"model": "drop-item"
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"root": {
"model": "cube"
"model": "drop-block"
}
}
+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)