summaryrefslogtreecommitdiff
path: root/infrastructure/advanced_crosswalk_lighting.lua
blob: 4e669c13d9e404ce3e55b828d9060387b2a2f6ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
-- Crosswalk lighting
	minetest.register_node("infrastructure:crosswalk_lighting_dark", {
		description = "Crosswalk lighting",
		tiles = {
			"infrastructure_traffic_lights_side.png",
			"infrastructure_crosswalk_lighting_bottom.png",
			"infrastructure_traffic_lights_side.png",
			"infrastructure_traffic_lights_side.png",
			"infrastructure_crosswalk_lighting_back.png",
			"infrastructure_crosswalk_lighting_front.png"
		},
		drawtype = "nodebox",
		paramtype = "light",
		paramtype2 = "facedir",
		groups = {cracky = 3},
		node_box = {
			type = "fixed",
				fixed = {
					{-3/8, -1/2, -1/4, 3/8, 1/2, -3/16},
					{-3/8, -1/2, 3/16, 3/8, 1/2, 1/4},
					{-1/4, 1/4, -3/16, -1/8, 3/8, 3/16},
					{1/8, 1/4, -3/16, 1/4, 3/8, 3/16},
					{-1/8, -1/2, -3/16, 1/8, -1/4, 3/16},
					{-1/2, -1/2, -1/8, 1/2, -3/8, 1/8},
				}
		},
		selection_box = {
			type = "fixed",
				fixed = {-3/8, -1/2, -1/4, 3/8, 1/2, 1/4}
		},

		on_punch = function(pos, node)
			minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_bright", param2 = node.param2})
		end,

		mesecons = {effector = {
			action_on = function (pos, node)
				minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_bright", param2 = node.param2})
			end,
		}}
	})

	minetest.register_node("infrastructure:crosswalk_lighting_bright", {
		tiles = {
			"infrastructure_traffic_lights_side.png",
			"infrastructure_crosswalk_lighting_bottom.png",
			"infrastructure_traffic_lights_side.png",
			"infrastructure_traffic_lights_side.png",
			"infrastructure_crosswalk_lighting_back.png",
			"infrastructure_crosswalk_lighting_front.png"
		},
		drawtype = "nodebox",
		paramtype = "light",
		paramtype2 = "facedir",
		groups = {cracky = 3, not_in_creative_inventory = 1},
		light_source = CROSSWALK_LIGHTING_LIGHT_RANGE,
		drop = "infrastructure:crosswalk_lighting_dark",
		node_box = {
			type = "fixed",
				fixed = {
					{-3/8, -1/2, -1/4, 3/8, 1/2, -3/16},
					{-3/8, -1/2, 3/16, 3/8, 1/2, 1/4},
					{-1/4, 1/4, -3/16, -1/8, 3/8, 3/16},
					{1/8, 1/4, -3/16, 1/4, 3/8, 3/16},
					{-1/8, -1/2, -3/16, 1/8, -1/4, 3/16},
					{-1/2, -1/2, -1/8, 1/2, -3/8, 1/8},
				}
		},
		selection_box = {
			type = "fixed",
				fixed = {-3/8, -1/2, -1/4, 3/8, 1/2, 1/4}
		},

		on_punch = function(pos, node)
			minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_dark", param2 = node.param2})
		end,

		mesecons = {effector = {
			action_off = function (pos, node)
				minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_dark", param2 = node.param2})
			end,
		}}
	})

	minetest.register_alias("infrastructure:crosswalk_lighting", "infrastructure:crosswalk_lighting_dark")