don’t crash when using hammer on non-nodes

This commit is contained in:
Dirk Sohler 2018-09-30 01:30:57 +02:00
parent 033cf1b331
commit f74c71b448
No known key found for this signature in database
GPG Key ID: B9751241BD7D4E1A

@ -14,7 +14,7 @@ local replacements = uniham.replacements
-- @see <https://dev.minetest.net/on_use#on_use>
-- @return itemstack|void
uniham.use_hammer = function (itemstack, player, pointed_thing)
if pointed_thing.type == 'nothing' then return end
if pointed_thing.type ~= 'node' then return end
local node_pos = minetest.get_pointed_thing_position(pointed_thing)
local node_name = minetest.get_node(node_pos).name
local node_sounds = minetest.registered_nodes[node_name].sounds