From babc61df54ce98a5c87f182dab271586d6ad75ab Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Tue, 27 May 2014 13:44:08 +0200 Subject: add GET command --- trafficlight/init.lua | 7 +++++++ 1 file changed, 7 insertions(+) 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, }) -- cgit v1.2.3