From d77d77e451f28228a8da86e0b967e88237910703 Mon Sep 17 00:00:00 2001 From: paly2 Date: Wed, 9 Sep 2015 12:41:14 +0200 Subject: [PATCH] Add a functionnality to the entity detector to detect builtin items --- moremesecons_entity_detector/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moremesecons_entity_detector/init.lua b/moremesecons_entity_detector/init.lua index 92aade3..e19b45e 100644 --- a/moremesecons_entity_detector/init.lua +++ b/moremesecons_entity_detector/init.lua @@ -40,9 +40,10 @@ local object_detector_scan = function (pos) end for _,obj in pairs(minetest.get_objects_inside_radius(pos, radius)) do if not obj:is_player() then - local isname = (obj:get_luaentity()).name + local luaentity = obj:get_luaentity() + local isname = luaentity.name if isname - and (scan_all or isname == scanname) then -- entity with scanname found or not scanname specified + and (scan_all or isname == scanname or (isname == "__builtin:item" and luaentity.itemstring == scanname)) then -- entity with scanname found or not scanname specified return true end end