mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-07-01 23:30:21 +02:00
Update init.lua
This commit is contained in:
@ -31,11 +31,9 @@ local function object_detector_scan(pos)
|
|||||||
if next(objs) == nil then return false end
|
if next(objs) == nil then return false end
|
||||||
|
|
||||||
local scanname = minetest.get_meta(pos):get_string("scanname")
|
local scanname = minetest.get_meta(pos):get_string("scanname")
|
||||||
local sep = "," -- Begin code to split scanname into array
|
local sep = ","
|
||||||
local scan_for = {}
|
local scan_for = string.split(scanname, sep)
|
||||||
for str in string.gmatch(scanname, "([^"..sep.."]+)") do
|
|
||||||
scan_for[str:gsub("%s+", "")] = true
|
|
||||||
end -- end split code
|
|
||||||
local every_player = scanname == ""
|
local every_player = scanname == ""
|
||||||
for _, obj in pairs(objs) do
|
for _, obj in pairs(objs) do
|
||||||
-- "" is returned if it is not a player; "" ~= nil; so only handle objects with foundname ~= ""
|
-- "" 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 meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
local distance = meta:get_int("distance")
|
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 < 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(
|
local frontname = minetest.get_node(
|
||||||
vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance+1))
|
vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance+1))
|
||||||
|
Reference in New Issue
Block a user