From aff4b59d3ccae20a4415ebfc3a5a72fe6ad6587e Mon Sep 17 00:00:00 2001 From: Josh Mars Date: Sat, 18 Mar 2017 09:13:41 -0400 Subject: [PATCH] Update init.lua --- mesecons_detector/init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua index fe006d8..c1f3b55 100644 --- a/mesecons_detector/init.lua +++ b/mesecons_detector/init.lua @@ -31,11 +31,9 @@ local function object_detector_scan(pos) if next(objs) == nil then return false end local scanname = minetest.get_meta(pos):get_string("scanname") - local sep = "," -- Begin code to split scanname into array - local scan_for = {} - for str in string.gmatch(scanname, "([^"..sep.."]+)") do - scan_for[str:gsub("%s+", "")] = true - end -- end split code + local sep = "," + local scan_for = string.split(scanname, sep) + local every_player = scanname == "" for _, obj in pairs(objs) do -- "" is returned if it is not a player; "" ~= nil; so only handle objects with foundname ~= "" @@ -162,8 +160,9 @@ local function node_detector_scan(pos) local meta = minetest.get_meta(pos) local distance = meta:get_int("distance") + local distance_max = mesecon.setting("node_detector_distance_max", 10) if distance < 0 then distance = 0 end - if distance > 10 then distance = 10 end + if distance > distance_max then distance = distance_max end local frontname = minetest.get_node( vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance+1))