Closed berengma closed 2 weeks ago
Reproduced by spawning new bones (do not place manually).
minetest.register_chatcommand("p", {
func = function(name, param)
local pos = minetest.get_player_by_name(name):get_pos()
local node_name = #param > 0 and param or "bones:bones"
local np = minetest.find_node_near(pos, 4, node_name, true)
if not np then
return false, "No node found"
end
minetest.punch_node(np)
return true, "OK!"
end
})
Even though the Lua API states that puncher
may be nil
, but the C++ side creates an empty ObjectRef, which in turn does not have an inventory.
What is the expected result? Would you like to remove the node and destroy all of its contents, drop the contents as item entities, or disallow any interaction?
Difficult to say what the expected result is. Depends on the mod which uses the method. Disallowing any interaction is probably not what I wanted to have, when I wrote a bone harvester mod. Removing the node and destroy everything is something the involving mod could handle by itself. I think dropping the contents and removing the bones node would be the best option. Thinking in terms of what other mods could do with the results.
see PR #3146
Version:
Error message from log:
reproduction:
possible solution: