implement actual items dropping
This commit is contained in:
@@ -5,6 +5,7 @@ local rig = entity.modeltree
|
||||
inair = true
|
||||
ready = false
|
||||
|
||||
local item = ARGS.item
|
||||
|
||||
local rotation = mat4.rotate({0, 1, 0}, math.random() * 360)
|
||||
mat4.rotate(rotation, {1, 0, 0}, math.random() * 360, rotation)
|
||||
@@ -24,7 +25,7 @@ end
|
||||
function on_trigger_enter(index, oid)
|
||||
if ready and oid == 0 then
|
||||
entity:despawn()
|
||||
inventory.add(player.get_inventory(oid), item.index("base:stone.item"), 1)
|
||||
inventory.add(player.get_inventory(oid), item.id, item.count)
|
||||
audio.play_sound_2d("events/pickup", 0.5, 0.8+math.random()*0.4, "regular")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user