Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node detector blacklist api #672

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion mesecons_detector/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,23 @@ minetest.register_abm({
-- Node detector
-- Detects the node in front of it

local blacklist = {
air = true,
ignore = true,
}

function mesecon.node_detector_blacklist_add(node)
blacklist[node] = true
end

function mesecon.node_detector_blacklist_remove(node)
blacklist[node] = nil
end

function mesecon.node_detector_on_blacklist(node)
return blacklist[node] == true
end

local function node_detector_make_formspec(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("distance") == "" then meta:set_string("distance", "0") end
Expand Down Expand Up @@ -198,7 +215,7 @@ local function node_detector_scan(pos)
local scan_for = comma_list_to_table(scanname)

return (scan_for[frontname]) or
(frontname ~= "air" and frontname ~= "ignore" and scanname == "")
(blacklist[frontname] ~= true and scanname == "")
end

local function node_detector_send_node_name(pos, node, channel, meta)
Expand Down