diff options
author | webdesigner97 <Christian_D_97@gmx.de> | 2014-05-30 16:17:56 +0200 |
---|---|---|
committer | webdesigner97 <Christian_D_97@gmx.de> | 2014-05-30 16:17:56 +0200 |
commit | c604c10529c475db868ec53fbfe9dd56b35e5683 (patch) | |
tree | 6697525a701307f0f3aff847f5d74c2b3c0d0b8a /trafficlight | |
parent | 312cc216d670025e81af219134c128560e22b33a (diff) | |
download | roads-c604c10529c475db868ec53fbfe9dd56b35e5683.tar roads-c604c10529c475db868ec53fbfe9dd56b35e5683.tar.gz roads-c604c10529c475db868ec53fbfe9dd56b35e5683.tar.bz2 roads-c604c10529c475db868ec53fbfe9dd56b35e5683.tar.xz roads-c604c10529c475db868ec53fbfe9dd56b35e5683.zip |
Convert old trafficlights
Diffstat (limited to 'trafficlight')
-rw-r--r-- | trafficlight/old2new.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/trafficlight/old2new.lua b/trafficlight/old2new.lua new file mode 100644 index 0000000..665e4b9 --- /dev/null +++ b/trafficlight/old2new.lua @@ -0,0 +1,39 @@ +--[[ + StreetsMod: Convert old trafficlights +]] +minetest.register_abm({ + nodenames = {"streets:traficlight_bottom"}, + interval = 2, + chance = 1 + action = function(pos, node) + -- Replace controller with distributor + pos.y = pos.y - 1 + minetest.set_node(pos, {name = "streets:digiline_distributor"}) + -- Change bottom pole + pos.y = pos.y + 1 + minetest.set_node(pos, {name = "streets:bigpole", param2 = 2}) + -- Change middle pole + pos.y = pos.y + 1 + minetest.set_node(pos, {name = "streets:bigpole", param2 = 2}) + -- Change the top + pos.y = pos.y + 1 + local fd = minetest.get_node(pos).param2 + local nn = minetest.get_node(pos).name + local ch = minetest.get_meta(pos):get_string("channel") + minetest.set_node(pos, {name = "streets:bigpole", param2 = 2}) + -- Place new top + if fd == 1 then + minetest.set_node({x = pos.x, y = pos.y, z = pos.z + 1}, {name = nn, param2 = fd}) + minetest.get_meta(pos):set_string("channel", ch) + elseif fd == 2 then + minetest.set_node({x = pos.x, y = pos.y, z = pos.z - 1}, {name = nn, param2 = fd}) + minetest.get_meta(pos):set_string("channel", ch) + elseif fd == 3 then + minetest.set_node({x = pos.x + 1, y = pos.y, z = pos.z}, {name = nn, param2 = fd}) + minetest.get_meta(pos):set_string("channel", ch) + elseif fd == 4 then + minetest.set_node({x = pos.x - 1, y = pos.y, z = pos.z}, {name = nn, param2 = fd}) + minetest.get_meta(pos):set_string("channel", ch) + end + end +})
\ No newline at end of file |