summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2016-01-14 13:25:47 -0600
committercheapie <no-email-for-you@example.com>2016-01-14 13:25:47 -0600
commitbd608bcb020d224f51eb06c0965e583502a4f790 (patch)
treed2bd65f5ceefdfb6bdbacd8bf5769f91750ad95d
parent9b368661909d3f7c85ba136e70447b298a9e6a70 (diff)
downloadroads-bd608bcb020d224f51eb06c0965e583502a4f790.tar
roads-bd608bcb020d224f51eb06c0965e583502a4f790.tar.gz
roads-bd608bcb020d224f51eb06c0965e583502a4f790.tar.bz2
roads-bd608bcb020d224f51eb06c0965e583502a4f790.tar.xz
roads-bd608bcb020d224f51eb06c0965e583502a4f790.zip
Add lane control lights to creative inventory
-rw-r--r--infrastructure/advanced_lane_control_lights.lua140
1 files changed, 70 insertions, 70 deletions
diff --git a/infrastructure/advanced_lane_control_lights.lua b/infrastructure/advanced_lane_control_lights.lua
index f8a2c9f..ff9d0f5 100644
--- a/infrastructure/advanced_lane_control_lights.lua
+++ b/infrastructure/advanced_lane_control_lights.lua
@@ -1,79 +1,79 @@
-- Lane control lights
- function lane_control_change(pos, node)
- local node = minetest.env:get_node(pos)
- if node.name == "infrastructure:lane_control_lights_1" then
- minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_2", param2 = node.param2})
- elseif node.name == "infrastructure:lane_control_lights_2" then
- minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_3", param2 = node.param2})
- elseif node.name == "infrastructure:lane_control_lights_3" then
- minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_4", param2 = node.param2})
- elseif node.name == "infrastructure:lane_control_lights_4" then
- minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_5", param2 = node.param2})
- elseif node.name == "infrastructure:lane_control_lights_5" then
- minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_1", param2 = node.param2})
- end
+function lane_control_change(pos, node)
+ local node = minetest.env:get_node(pos)
+ if node.name == "infrastructure:lane_control_lights_1" then
+ minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_2", param2 = node.param2})
+ elseif node.name == "infrastructure:lane_control_lights_2" then
+ minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_3", param2 = node.param2})
+ elseif node.name == "infrastructure:lane_control_lights_3" then
+ minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_4", param2 = node.param2})
+ elseif node.name == "infrastructure:lane_control_lights_4" then
+ minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_5", param2 = node.param2})
+ elseif node.name == "infrastructure:lane_control_lights_5" then
+ minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_1", param2 = node.param2})
end
+end
- for i = 1, 5 do
- local groups = {}
- if i == 1 then
- groups = {cracky = 3}
- else
- groups = {cracky = 3, not_in_creative_inventory = 1}
- end
+for i = 1, 5 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",
+ 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}
+ }
- 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",
- groups = {cracky = 3, not_in_creative_inventory = 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_punch = function(pos, node)
+ lane_control_change(pos, node)
+ end,
- on_punch = function(pos, node)
+ mesecons = {effector = {
+ action_on = function (pos, node)
lane_control_change(pos, node)
end,
+ }}
+ })
+end
- mesecons = {effector = {
- action_on = function (pos, node)
- lane_control_change(pos, node)
- end,
- }}
- })
- end
-
- minetest.register_alias("infrastructure:lane_control_lights", "infrastructure:lane_control_lights_1")
+minetest.register_alias("infrastructure:lane_control_lights", "infrastructure:lane_control_lights_1")