summaryrefslogtreecommitdiff
path: root/streetlamps/init.lua
blob: c7097f9f65a68f0e75aa636df77c6bb675bafd13 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
--[[
	StreetsMod: Streetlamps
]]
--[[minetest.register_node(":streets:streetlamp_basic_controller",{
	description = streets.S("Trafficlight"),
	tiles = {"streets_lampcontroller_top.png","streets_lampcontroller_bottom.png","streets_lampcontroller_sides.png"},
	groups = {cracky = 1, not_in_creative_inventory = 1},
	drawtype = "nodebox",
	paramtype = "light",
	node_box = {
		type = "fixed",
		fixed = {
			{-0.5,-0.5,-0.5,0.5,0.5,0.5},
			{-0.05,0.5,-0.05,0.05,1.6,0.05}
		}
	},
	selection_box = 	{
		type = "fixed",
		fixed = {
			{-0.5,-0.5,-0.5,0.5,0.5,0.5},
			{-0.3,1.5,-0.3,0.3,4.5,0.3}
		}
	},
	mesecons = {
		effector = {
			action_on = function(pos,node)
				minetest.set_node({x = pos.x, y = pos.y + 4, z = pos.z},{name = "streets:streetlamp_basic_top_on"})
			end,
			action_off = function(pos,node)
				minetest.set_node({x = pos.x, y = pos.y + 4, z = pos.z},{name = "streets:streetlamp_basic_top_off"})
			end
		}
	},
	after_dig_node = function(pos)
		minetest.remove_node({x = pos.x, y = pos.y + 2, z = pos.z})
		minetest.remove_node({x = pos.x, y = pos.y + 3, z = pos.z})
		minetest.remove_node({x = pos.x, y = pos.y + 4, z = pos.z})
		minetest.chat_send_all("!!!")
	end
})]]

minetest.register_node(":streets:streetlamp_basic_bottom",{
	drop = "",
	description = streets.S("Street lamp"),
	tiles = {"streets_lamps_basic_bottom.png"},
	inventory_image = "streets_lamps_basi_inv.png",
	groups = {cracky = 1},
	paramtype = "light",
	drawtype = "nodebox",
	node_box = {
		type = "fixed",
		fixed = {
			{-0.15,-0.5,-0.15,0.15,0.4,0.15},
			{-0.1,0.4,-0.1,0.1,0.5,0.1}
		}
	},
	pointable = false,
	after_place_node = function(pos,placer,itemstack)
		minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "streets:streetlamp_basic_middle"})
		minetest.set_node({x = pos.x, y = pos.y + 2, z = pos.z},{name = "streets:streetlamp_basic_top_on"})
		-- minetest.set_node({x = pos.x, y = pos.y - 2, z = pos.z},{name = "streets:streetlamp_basic_controller"})
	end
})
minetest.register_node(":streets:streetlamp_basic_middle",{
	drop = "",
	description = streets.S("U cheater U"),
	groups = {cracky = 1, not_in_creative_inventory = 1},
	tiles = {"streets_lamps_basic_middle.png"},
	paramtype = "light",
	drawtype = "nodebox",
	pointable = false,
	node_box = {
		type = "fixed",
		fixed = {
			{-0.1,-0.5,-0.1,0.1,0.5,0.1}
		}
	}
})
--[[minetest.register_node(":streets:streetlamp_basic_top_off",{
	drop = "",
	description = streets.S("U cheater U"),
	groups = {cracky = 1, not_in_creative_inventory = 1},
	paramtype = "light",
	drawtype = "nodebox",
	pointable = false,
	node_box = {
		type = "fixed",
		fixed = {
			{-0.1,-0.5,-0.1,0.1,-0.4,0.1},
			{-0.3,-0.4,-0.3,0.3,0.5,0.3}
		}
	}
})]]
minetest.register_node(":streets:streetlamp_basic_top_on",{
	drop = "streets:streetlamp_basic_bottom",
	description = streets.S("U cheater U"),
	groups = {cracky = 1, not_in_creative_inventory = 1},
	tiles = {"streets_lamps_basic_top_top.png","streets_lamps_basic_top_top.png","streets_lamps_basic_top.png","streets_lamps_basic_top.png","streets_lamps_basic_top.png","streets_lamps_basic_top.png"},
	paramtype = "light",
	drawtype = "nodebox",
	light_source = 10,
	node_box = {
		type = "fixed",
		fixed = {
			{-0.1,-0.5,-0.1,0.1,-0.4,0.1},
			{-0.3,-0.4,-0.3,0.3,0.5,0.3}
		}
	},
	selection_box = 	{
		type = "fixed",
		fixed = {
			{-0.3,0.5,-0.3,0.3,-2.5,0.3},
		}
	},
	after_dig_node = function(pos)
		minetest.remove_node({x = pos.x, y = pos.y - 1, z = pos.z})
		minetest.remove_node({x = pos.x, y = pos.y - 2, z = pos.z})
	end
})

minetest.register_craft({
	output = "streets:streetlamp_basic_bottom",
	recipe = {
		{"","default:torch",""},
		{"","default:stick",""},
		{"","default:stick",""}
	}
})