diff --git a/.luacheckrc b/.luacheckrc index aa5d02e..7433251 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,6 +1,6 @@ read_globals = { -- Defined by Minetest - "minetest", "vector", "PseudoRandom", "VoxelArea", "table", + "minetest", "vector", "PseudoRandom", "VoxelArea", "table", "ItemStack", -- Mods "digiline", "default", "creative", diff --git a/moremesecons_entity_detector/init.lua b/moremesecons_entity_detector/init.lua index 57783f9..a21ed6b 100644 --- a/moremesecons_entity_detector/init.lua +++ b/moremesecons_entity_detector/init.lua @@ -46,9 +46,14 @@ local object_detector_scan = function (pos) return true end local isname = luaentity.name + -- If the item is present as dropped item entity: + local bitemname = (isname == "__builtin:item" and ItemStack(luaentity.itemstring):get_name()) for _, name in ipairs(scan_names) do - if isname == name or (isname == "__builtin:item" and luaentity.itemstring == name) then - return true + if name == isname then + return true -- object name matches + end + if name == bitemname then + return true -- item of the item entity matches end end end