From b1cee5fb22bb1c3de86a9fd3999263b558e99f82 Mon Sep 17 00:00:00 2001 From: Panquesito7 Date: Thu, 4 Jun 2020 12:19:53 -0500 Subject: [PATCH] Improve item dropping --- init.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 0b7775d..30b01ec 100644 --- a/init.lua +++ b/init.lua @@ -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()