add drop-item model, new block functions
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user