summaryrefslogtreecommitdiff
path: root/trafficlight
diff options
context:
space:
mode:
authorwebdesigner97 <Christian_D_97@gmx.de>2014-05-27 13:44:08 +0200
committerwebdesigner97 <Christian_D_97@gmx.de>2014-05-27 13:44:08 +0200
commitbabc61df54ce98a5c87f182dab271586d6ad75ab (patch)
tree622d1866c3ff5ce87cc6c73cb92d8a84648ed1ac /trafficlight
parent9215b159a26ea24037597ca28fab0bbeb7a319d4 (diff)
downloadroads-babc61df54ce98a5c87f182dab271586d6ad75ab.tar
roads-babc61df54ce98a5c87f182dab271586d6ad75ab.tar.gz
roads-babc61df54ce98a5c87f182dab271586d6ad75ab.tar.bz2
roads-babc61df54ce98a5c87f182dab271586d6ad75ab.tar.xz
roads-babc61df54ce98a5c87f182dab271586d6ad75ab.zip
add GET command
Diffstat (limited to 'trafficlight')
-rw-r--r--trafficlight/init.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/trafficlight/init.lua b/trafficlight/init.lua
index 86d3878..a1a0e53 100644
--- a/trafficlight/init.lua
+++ b/trafficlight/init.lua
@@ -80,6 +80,12 @@ streets.on_digiline_receive = function(pos, node, channel, msg)
pos = pos,
to = "toWarn"
})
+ elseif msg == "GET" then
+ local state = minetest.get_meta(pos):get_string("state")
+ if not state or state == "" then
+ state = "UNDEFINED"
+ end
+ digiline:receptor_send(pos, digiline.rules.default, channel, state)
end
end
@@ -125,6 +131,7 @@ minetest.register_node(":streets:trafficlight_top_off",{
on_receive_fields = function(pos, formname, fields, sender)
if (fields.channel) then
minetest.get_meta(pos):set_string("channel", fields.channel)
+ minetest.get_meta(pos):set_string("state", "Off")
end
end,
})