summaryrefslogtreecommitdiff
path: root/mesecons_detector
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-06-08 13:06:45 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-06-08 13:06:45 -0400
commite88e2131838caeb5fe66f22a57552936bd873916 (patch)
tree46fd703d488729b5d8e489035e79df3ae227a24d /mesecons_detector
parent13432ac87c341b391d7411241b1e1911e1fc6a5a (diff)
parent63998fd7e720f836463a7f6202a504435cd934cd (diff)
downloadmesecons-e88e2131838caeb5fe66f22a57552936bd873916.tar
mesecons-e88e2131838caeb5fe66f22a57552936bd873916.tar.gz
mesecons-e88e2131838caeb5fe66f22a57552936bd873916.tar.bz2
mesecons-e88e2131838caeb5fe66f22a57552936bd873916.tar.xz
mesecons-e88e2131838caeb5fe66f22a57552936bd873916.zip
Merge branch 'master' of github.com:Novatux/minetest-mod-mesecons
Diffstat (limited to 'mesecons_detector')
-rw-r--r--mesecons_detector/init.lua19
1 files changed, 14 insertions, 5 deletions
diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua
index b4ea3f1..8d2f53c 100644
--- a/mesecons_detector/init.lua
+++ b/mesecons_detector/init.lua
@@ -1,3 +1,5 @@
+local GET_COMMAND = "GET"
+
-- Object detector
-- Detects players in a certain radius
-- The radius can be specified in mesecons/settings.lua
@@ -33,7 +35,7 @@ local object_detector_scan = function (pos)
end
-- set player name when receiving a digiline signal on a specific channel
-object_detector_digiline = {
+local object_detector_digiline = {
effector = {
action = function (pos, node, channel, msg)
local meta = minetest.get_meta(pos)
@@ -140,17 +142,24 @@ local node_detector_scan = function (pos)
end
-- set player name when receiving a digiline signal on a specific channel
-node_detector_digiline = {
+local node_detector_digiline = {
effector = {
action = function (pos, node, channel, msg)
local meta = minetest.get_meta(pos)
local active_channel = meta:get_string("digiline_channel")
if channel == active_channel then
- meta:set_string("scanname", msg)
- node_detector_make_formspec(pos)
+ if msg == GET_COMMAND then
+ local frontpos = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
+ local name = minetest.get_node(frontpos).name
+ digiline:receptor_send(pos, digiline.rules.default, channel, name)
+ else
+ meta:set_string("scanname", msg)
+ node_detector_make_formspec(pos)
+ end
end
end,
- }
+ },
+ receptor = {}
}
minetest.register_node("mesecons_detector:node_detector_off", {