add modeltree:set_texture
This commit is contained in:
@@ -5,12 +5,14 @@ local rig = entity.modeltree
|
||||
inair = true
|
||||
ready = false
|
||||
|
||||
local item = ARGS.item
|
||||
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)
|
||||
rig:set_texture("$0", icon:gsub("block%-previews", "blocks"):gsub("base%:", ""))
|
||||
|
||||
function on_grounded(force)
|
||||
rig:set_matrix(0, mat4.rotate({0, 1, 0}, math.random()*360))
|
||||
@@ -25,7 +27,7 @@ end
|
||||
function on_trigger_enter(index, oid)
|
||||
if ready and oid == 0 then
|
||||
entity:despawn()
|
||||
inventory.add(player.get_inventory(oid), item.id, item.count)
|
||||
inventory.add(player.get_inventory(oid), dropitem.id, dropitem.count)
|
||||
audio.play_sound_2d("events/pickup", 0.5, 0.8+math.random()*0.4, "regular")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,6 +27,7 @@ local Modeltree = {__index={
|
||||
get_model=function(self, i) return __modeltree.get_model(self.eid, i) end,
|
||||
get_matrix=function(self, i) return __modeltree.get_matrix(self.eid, i) end,
|
||||
set_matrix=function(self, i, m) return __modeltree.set_matrix(self.eid, i, m) end,
|
||||
set_texture=function(self, s, s2) return __modeltree.set_texture(self.eid, s, s2) end,
|
||||
}}
|
||||
|
||||
function new_Modeltree(eid)
|
||||
|
||||
Reference in New Issue
Block a user