Merge branch 'master' of github.com:Novatux/minetest-mod-mesecons

master
Vanessa Ezekowitz 2014-06-08 13:06:45 -04:00
commit e88e213183
1 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,5 @@
local GET_COMMAND = "GET"
-- Object detector -- Object detector
-- Detects players in a certain radius -- Detects players in a certain radius
-- The radius can be specified in mesecons/settings.lua -- The radius can be specified in mesecons/settings.lua
@ -33,7 +35,7 @@ local object_detector_scan = function (pos)
end end
-- set player name when receiving a digiline signal on a specific channel -- set player name when receiving a digiline signal on a specific channel
object_detector_digiline = { local object_detector_digiline = {
effector = { effector = {
action = function (pos, node, channel, msg) action = function (pos, node, channel, msg)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -140,17 +142,24 @@ local node_detector_scan = function (pos)
end end
-- set player name when receiving a digiline signal on a specific channel -- set player name when receiving a digiline signal on a specific channel
node_detector_digiline = { local node_detector_digiline = {
effector = { effector = {
action = function (pos, node, channel, msg) action = function (pos, node, channel, msg)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local active_channel = meta:get_string("digiline_channel") local active_channel = meta:get_string("digiline_channel")
if channel == active_channel then if channel == active_channel then
meta:set_string("scanname", msg) if msg == GET_COMMAND then
node_detector_make_formspec(pos) 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
end, end,
} },
receptor = {}
} }
minetest.register_node("mesecons_detector:node_detector_off", { minetest.register_node("mesecons_detector:node_detector_off", {