diff options
author | Christian Danscheid <Christian_D_97@gmx.de> | 2013-08-13 20:26:19 +0200 |
---|---|---|
committer | Christian Danscheid <Christian_D_97@gmx.de> | 2013-08-13 20:26:19 +0200 |
commit | 83c2b3b0e35ddf25e0b36e1bebb9e4128511d597 (patch) | |
tree | 18ac0159f4cbb27fa92db26f48e1b45f27d51cb6 /trafficlight | |
parent | 1d6282707e336cbdddff95e4e19b9da237a762e1 (diff) | |
download | roads-83c2b3b0e35ddf25e0b36e1bebb9e4128511d597.tar roads-83c2b3b0e35ddf25e0b36e1bebb9e4128511d597.tar.gz roads-83c2b3b0e35ddf25e0b36e1bebb9e4128511d597.tar.bz2 roads-83c2b3b0e35ddf25e0b36e1bebb9e4128511d597.tar.xz roads-83c2b3b0e35ddf25e0b36e1bebb9e4128511d597.zip |
Only switch state if it is different from the new one
Diffstat (limited to 'trafficlight')
-rw-r--r-- | trafficlight/init.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/trafficlight/init.lua b/trafficlight/init.lua index a915b0e..c085dd9 100644 --- a/trafficlight/init.lua +++ b/trafficlight/init.lua @@ -63,25 +63,25 @@ minetest.register_node(":streets:trafficlight_bottom",{ -- Modify <pos> to the top node of the trafficlight pos.y = pos.y + 2 -- - if msg == "red" then + if msg == "red" and state ~= "red" then minetest.set_node(pos,{name = "streets:trafficlight_top_yellow",param2=facedir}) minetest.after(3,function(param) minetest.set_node(pos,{name = "streets:trafficlight_top_red",param2=facedir}) end) end -- - if msg == "green" then + if msg == "green" and state ~= "green" then minetest.set_node(pos,{name = "streets:trafficlight_top_redyellow",param2=facedir}) minetest.after(3,function(param) minetest.set_node(pos,{name = "streets:trafficlight_top_green",param2=facedir}) end) end -- - if msg == "off" then + if msg == "off" and state ~= "off" then minetest.set_node(pos,{name = "streets:trafficlight_top_off",param2=facedir}) end -- - if msg == "warn" then + if msg == "warn" and state ~= "warn" then minetest.set_node(pos,{name = "streets:trafficlight_top_warn",param2=facedir}) end end |