Improve item dropping

This commit is contained in:
Panquesito7 2020-06-04 12:19:53 -05:00 committed by SmallJoker
parent de43121ba1
commit b1cee5fb22

View File

@ -398,7 +398,18 @@ function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_he
pass:set_hp(pass:get_hp() - intensity)
end
local pos = entity.object:get_pos()
minetest.add_item(pos, entity.drop_on_destroy)
-- Handle drops
local i = math.random(1, #entity.drop_on_destroy)
local j = math.random(2, #entity.drop_on_destroy)
if i ~= j then
minetest.add_item(pos, entity.drop_on_destroy[i])
minetest.add_item(pos, entity.drop_on_destroy[j])
else
minetest.add_item(pos, entity.drop_on_destroy[i])
end
entity.removed = true
-- delay remove to ensure player is detached
minetest.after(0.1, function()