summaryrefslogtreecommitdiff
path: root/infrastructure
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2016-01-14 13:22:40 -0600
committercheapie <no-email-for-you@example.com>2016-01-14 13:22:40 -0600
commit9b368661909d3f7c85ba136e70447b298a9e6a70 (patch)
tree1139b24ffcb2bbe23551c48efe0a24b0d604664e /infrastructure
parent37fa30cb0f3b3afd701b0ce63500164a5c5dc998 (diff)
downloadroads-9b368661909d3f7c85ba136e70447b298a9e6a70.tar
roads-9b368661909d3f7c85ba136e70447b298a9e6a70.tar.gz
roads-9b368661909d3f7c85ba136e70447b298a9e6a70.tar.bz2
roads-9b368661909d3f7c85ba136e70447b298a9e6a70.tar.xz
roads-9b368661909d3f7c85ba136e70447b298a9e6a70.zip
Convert crosswalk warning sign to animated textures
Diffstat (limited to 'infrastructure')
-rw-r--r--infrastructure/advanced_crosswalk_warning_light.lua303
-rw-r--r--infrastructure/textures/infrastructure_crosswalk_warning_light_front_anim.pngbin0 -> 1343 bytes
2 files changed, 117 insertions, 186 deletions
diff --git a/infrastructure/advanced_crosswalk_warning_light.lua b/infrastructure/advanced_crosswalk_warning_light.lua
index d8497e1..213223a 100644
--- a/infrastructure/advanced_crosswalk_warning_light.lua
+++ b/infrastructure/advanced_crosswalk_warning_light.lua
@@ -1,193 +1,124 @@
-- Crosswalk warning light
- minetest.register_abm( {
- nodenames = {"infrastructure:crosswalk_warning_light_bright", "infrastructure:crosswalk_warning_light_dark"},
- interval = 1,
- chance = 1,
- action = function(pos, node)
- local node = minetest.env:get_node(pos)
- if node.name == "infrastructure:crosswalk_warning_light_bright" then
- minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_dark", param2 = node.param2})
- elseif node.name == "infrastructure:crosswalk_warning_light_dark" then
- minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_bright", param2 = node.param2})
- end
- end
- })
-
- function on_off_light(pos, node)
- local node = minetest.env:get_node(pos)
- if node.name == "infrastructure:crosswalk_warning_light_off" then
- minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_bright", param2 = node.param2})
- elseif (node.name == "infrastructure:crosswalk_warning_light_dark" or node.name == "infrastructure:crosswalk_warning_light_bright") then
- minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_off", param2 = node.param2})
- end
+function on_off_light(pos, node)
+ if node.name == "infrastructure:crosswalk_warning_light_off" then
+ minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_on", param2 = node.param2})
+ elseif (node.name == "infrastructure:crosswalk_warning_light_on") then
+ minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_off", param2 = node.param2})
end
-
- minetest.register_node("infrastructure:crosswalk_warning_light_off", {
- description = "Crosswalk warning light",
- inventory_image = "infrastructure_crosswalk_warning_light_front_bright.png",
- wield_image = "infrastructure_crosswalk_warning_light_front_bright.png",
- tiles = {
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_crosswalk_warning_light_back.png",
- "infrastructure_crosswalk_warning_light_front_dark.png"
- },
- drawtype = "nodebox",
- paramtype = "light",
- paramtype2 = "facedir",
- groups = {cracky = 3, not_in_creative_inventory = 0},
- node_box = {
- type = "fixed",
- fixed = {
- {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
- {-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
-
- {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
- {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
- {1/4, 0, -1/4, 5/16, 1/4, -1/8},
-
- {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
- {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
- {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
-
- {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
- {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
- {1/4, 0, -1/4, 5/16, 1/4, -1/8},
-
- {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
- {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
- {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
- }
- },
-
- on_punch = function(pos, node)
- on_off_light(pos, node)
- end,
-
- mesecons = {effector = {
- action_on = function(pos, node)
- on_off_light(pos, node)
- end,
- }}
- })
-
- minetest.register_node("infrastructure:crosswalk_warning_light_dark", {
- tiles = {
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_crosswalk_warning_light_back.png",
- "infrastructure_crosswalk_warning_light_front_dark.png"
- },
- drawtype = "nodebox",
- paramtype = "light",
- paramtype2 = "facedir",
- groups = {cracky = 3, not_in_creative_inventory = 1},
- drop = "infrastructure:crosswalk_warning_light_off",
- node_box = {
- type = "fixed",
- fixed = {
- {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
- {-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
-
- {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
- {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
- {1/4, 0, -1/4, 5/16, 1/4, -1/8},
-
- {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
- {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
- {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
-
- {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
- {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
- {1/4, 0, -1/4, 5/16, 1/4, -1/8},
-
- {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
- {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
- {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
- }
- },
-
- on_punch = function(pos, node)
+end
+
+minetest.register_node("infrastructure:crosswalk_warning_light_off", {
+ description = "Crosswalk warning light",
+ inventory_image = "infrastructure_crosswalk_warning_light_front_bright.png",
+ wield_image = "infrastructure_crosswalk_warning_light_front_bright.png",
+ tiles = {
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_crosswalk_warning_light_back.png",
+ "infrastructure_crosswalk_warning_light_front_dark.png"
+ },
+ drawtype = "nodebox",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = {cracky = 3, not_in_creative_inventory = 0},
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
+ {-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
+
+ {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
+ {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
+ {1/4, 0, -1/4, 5/16, 1/4, -1/8},
+
+ {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
+ {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
+ {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
+ }
+ },
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
+
+ {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
+ {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
+ {1/4, 0, -1/4, 5/16, 1/4, -1/8},
+
+ {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
+ {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
+ {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
+ }
+ },
+
+ on_punch = function(pos, node)
+ on_off_light(pos, node)
+ end,
+
+ mesecons = {effector = {
+ action_on = function(pos, node)
on_off_light(pos, node)
end,
-
- mesecons = {effector = {
- action_on = function(pos, node)
- on_off_light(pos, node)
- end,
- }}
- })
-
- minetest.register_node("infrastructure:crosswalk_warning_light_bright", {
- tiles = {
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_traffic_lights_side.png",
- "infrastructure_crosswalk_warning_light_back.png",
- "infrastructure_crosswalk_warning_light_front_bright.png"
- },
- drawtype = "nodebox",
- paramtype = "light",
- paramtype2 = "facedir",
- groups = {cracky = 3, not_in_creative_inventory = 1},
- light_source = TRAFFIC_LIGHTS_LIGHT_RANGE,
- drop = "infrastructure:crosswalk_warning_light_off",
- node_box = {
- type = "fixed",
- fixed = {
- {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
- {-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
-
- {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
- {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
- {1/4, 0, -1/4, 5/16, 1/4, -1/8},
-
- {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
- {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
- {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
-
- {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
- {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
- {1/4, 0, -1/4, 5/16, 1/4, -1/8},
-
- {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
- {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
- {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
- }
- },
-
- on_punch = function(pos, node)
+ }}
+})
+
+minetest.register_node("infrastructure:crosswalk_warning_light_on", {
+ tiles = {
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_traffic_lights_side.png",
+ "infrastructure_crosswalk_warning_light_back.png",
+ {name="infrastructure_crosswalk_warning_light_front_anim.png",animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=1.5}}
+ },
+ drawtype = "nodebox",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = {cracky = 3, not_in_creative_inventory = 1},
+ drop = "infrastructure:crosswalk_warning_light_off",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
+ {-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
+
+ {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
+ {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
+ {1/4, 0, -1/4, 5/16, 1/4, -1/8},
+
+ {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
+ {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
+ {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
+ }
+ },
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
+
+ {-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
+ {-5/16, 0, -1/4, -1/4, 1/4, -1/8},
+ {1/4, 0, -1/4, 5/16, 1/4, -1/8},
+
+ {-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
+ {-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
+ {-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
+ }
+ },
+
+ on_punch = function(pos, node)
+ on_off_light(pos, node)
+ end,
+
+ mesecons = {effector = {
+ action_on = function(pos, node)
on_off_light(pos, node)
end,
+ }}
+})
- mesecons = {effector = {
- action_on = function(pos, node)
- on_off_light(pos, node)
- end,
- }}
- })
-
- minetest.register_alias("infrastructure:crosswalk_warning_light", "infrastructure:crosswalk_warning_light_off")
+minetest.register_alias("infrastructure:crosswalk_warning_light", "infrastructure:crosswalk_warning_light_off")
+minetest.register_alias("infrastructure:crosswalk_warning_bright", "infrastructure:crosswalk_warning_light_on")
+minetest.register_alias("infrastructure:crosswalk_warning_dark", "infrastructure:crosswalk_warning_light_on")
diff --git a/infrastructure/textures/infrastructure_crosswalk_warning_light_front_anim.png b/infrastructure/textures/infrastructure_crosswalk_warning_light_front_anim.png
new file mode 100644
index 0000000..a21529f
--- /dev/null
+++ b/infrastructure/textures/infrastructure_crosswalk_warning_light_front_anim.png
Binary files differ