Skip to content

Commit

Permalink
prevent inventory ejector crash and fail silently
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 13, 2020
1 parent 9a2fcd5 commit dba8d44
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ local MP = minetest.get_modpath("digtron_customizations")
dofile(MP.."/memoize.lua")
dofile(MP.."/is_protected.lua")
dofile(MP.."/overrides.lua")
dofile(MP.."/item_ejector_drop_on_error.lua")
18 changes: 18 additions & 0 deletions item_ejector_drop_on_error.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

local node_def = minetest.registered_nodes["digtron:inventory_ejector"]
local old_on_punch = node_def.on_punch

assert(node_def)
assert(old_on_punch)

minetest.override_item("digtron:inventory_ejector", {
on_punch = function(pos, node, player)
local ok = pcall(function()
old_on_punch(pos, node, player)
end)

if not ok then
minetest.log("warning", "[digtron_customizations] inventory_ejector failed at " .. minetest.pos_to_string(pos))
end
end
})

0 comments on commit dba8d44

Please sign in to comment.