diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 20:02:19 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-04-01 21:09:33 -0400 |
commit | da66780a569712c23ae4f2996cfb4608a9f9d69d (patch) | |
tree | 217556029a78bc23ad4564720afc86de97228a04 /streets/infrastructure/advanced_lane_control_lights.lua | |
parent | 615b22df4d423aded3613db7716943a2f389b047 (diff) | |
download | dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.gz dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.bz2 dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.tar.xz dreambuilder_modpack-da66780a569712c23ae4f2996cfb4608a9f9d69d.zip |
copy all standard Dreambuilder mods in from the old subgame
(exactly as last supplied there, updates to these mods will follow later)
Diffstat (limited to 'streets/infrastructure/advanced_lane_control_lights.lua')
-rw-r--r-- | streets/infrastructure/advanced_lane_control_lights.lua | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/streets/infrastructure/advanced_lane_control_lights.lua b/streets/infrastructure/advanced_lane_control_lights.lua new file mode 100644 index 0000000..195f809 --- /dev/null +++ b/streets/infrastructure/advanced_lane_control_lights.lua @@ -0,0 +1,91 @@ +-- Lane control lights + +for i = 1, 6 do + local groups = {} + if i == 1 then + groups = {cracky = 3} + else + groups = {cracky = 3, not_in_creative_inventory = 1} + end + + minetest.register_node("infrastructure:lane_control_lights_"..tostring(i), { + description = "Lane control lights", + tiles = { + "infrastructure_traffic_lights_side.png", + "infrastructure_traffic_lights_side.png", + "infrastructure_traffic_lights_side.png", + "infrastructure_traffic_lights_side.png", + "infrastructure_traffic_lights_side.png", + "infrastructure_lane_control_lights_"..tostring(i)..".png" + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + groups = {cracky = 3, not_in_creative_inventory = (i == 1 and 0 or 1)}, + light_source = TRAFFIC_LIGHTS_LIGHT_RANGE, + drop = "infrastructure:lane_control_lights_1", + node_box = { + type = "fixed", + fixed = { + {-7/16, -7/16, -1/8, 7/16, 7/16, 1/8}, + {-7/16, 0, -1/4, -3/8, 7/16, -1/8}, + {3/8, 0, -1/4, 7/16, 7/16, -1/8}, + {-7/16, 3/8, -5/16, 7/16, 7/16, -1/8}, + {-1/16, -1/4, 0, 1/16, 1/4, 1/2 - 0.001}, + {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}, + {-1/4, -1/16, 0, 1/4, 1/16, 1/2 - 0.001} + } + }, + selection_box = { + type = "fixed", + fixed = { + {-7/16, -7/16, -1/8, 7/16, 7/16, 1/8}, + {-7/16, 0, -1/4, -3/8, 7/16, -1/8}, + {3/8, 0, -1/4, 7/16, 7/16, -1/8}, + {-7/16, 3/8, -5/16, 7/16, 7/16, -1/8}, + {-1/16, -1/4, 0, 1/16, 1/4, 1/2 - 0.001}, + {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}, + {-1/4, -1/16, 0, 1/4, 1/16, 1/2 - 0.001} + } + + }, + on_receive_fields = function(pos, formname, fields) + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + end + end, + digiline = { + receptor = {}, + effector = { + action = function(pos, node, channel, msg) + local setchan = minetest.get_meta(pos):get_string("channel") + if setchan ~= channel then + return + end + msg = msg:lower() + if (msg=="off") then + node.name = "infrastructure:lane_control_lights_1" + elseif (msg=="green") then + node.name = "infrastructure:lane_control_lights_3" + elseif (msg=="red") then + node.name = "infrastructure:lane_control_lights_2" + elseif (msg=="yellowleft") then + node.name = "infrastructure:lane_control_lights_5" + elseif (msg=="yellowright") then + node.name = "infrastructure:lane_control_lights_4" + elseif (msg=="yellow") then + node.name = "infrastructure:lane_control_lights_6" + end + minetest.set_node(pos,node) + minetest.get_meta(pos):set_string("channel",setchan) + end + } + } + }) +end + +minetest.register_alias("infrastructure:lane_control_lights", "infrastructure:lane_control_lights_1") |