Skip to content

Commit 32e1cc6

Browse files
committed
Add node detector blacklist api
1 parent cffbc33 commit 32e1cc6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

mesecons_detector/init.lua

+18-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ minetest.register_abm({
157157
-- Node detector
158158
-- Detects the node in front of it
159159

160+
local blacklist = {
161+
air = true,
162+
ignore = true,
163+
}
164+
165+
function mesecon.node_detector_blacklist_add(node)
166+
blacklist[node] = true
167+
end
168+
169+
function mesecon.node_detector_blacklist_remove(node)
170+
blacklist[node] = nil
171+
end
172+
173+
function mesecon.node_detector_on_blacklist(node)
174+
return blacklist[node] == true
175+
end
176+
160177
local function node_detector_make_formspec(pos)
161178
local meta = minetest.get_meta(pos)
162179
if meta:get_string("distance") == "" then meta:set_string("distance", "0") end
@@ -198,7 +215,7 @@ local function node_detector_scan(pos)
198215
local scan_for = comma_list_to_table(scanname)
199216

200217
return (scan_for[frontname]) or
201-
(frontname ~= "air" and frontname ~= "ignore" and scanname == "")
218+
(blacklist[frontname] ~= true and scanname == "")
202219
end
203220

204221
local function node_detector_send_node_name(pos, node, channel, meta)

0 commit comments

Comments
 (0)