mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-18 02:45:21 +02:00
Allow digging of unknown nodes
This allows the removal of nodes with unknown types. get_item_callback() (C++) would fail if a node has an unknown type. Now it will try using the callback from minetest.nodedef_default in this case. Also, minetest.node_dig() (Lua) was altered to always allow digging when the node definition is empty (i.e. unknown node).
This commit is contained in:
@@ -262,7 +262,8 @@ function minetest.node_dig(pos, node, digger)
|
||||
minetest.debug("node_dig")
|
||||
|
||||
local def = ItemStack({name=node.name}):get_definition()
|
||||
if not def.diggable or (def.can_dig and not def.can_dig(pos,digger)) then
|
||||
-- Check if def ~= 0 because we always want to be able to remove unknown nodes
|
||||
if #def ~= 0 and not def.diggable or (def.can_dig and not def.can_dig(pos,digger)) then
|
||||
minetest.debug("not diggable")
|
||||
minetest.log("info", digger:get_player_name() .. " tried to dig "
|
||||
.. node.name .. " which is not diggable "
|
||||
|
Reference in New Issue
Block a user