disable item dropping

This commit is contained in:
Elkien3 2018-07-09 18:49:29 -05:00
parent 4e547fa301
commit c07d09d24e

View File

@ -0,0 +1,21 @@
local exceptions = {"throwing:bow_wood_loaded", "throwing:longbow_loaded", "throwing:bow_composite_loaded", "throwing:crossbow_loaded"}
local function disable_drop()
for itemstring, def in pairs(minetest.registered_items) do
local doit = true
for id, item in pairs(exceptions) do
if itemstring == item then
doit = false
end
end
if doit then
minetest.override_item(itemstring, {
on_drop = function(itemstack, dropper, pos)
return nil
end
})
end
end
end
-- This is a minor hack to make sure our loop runs after all nodes have been registered
minetest.after(0, disable_drop)