aboutsummaryrefslogtreecommitdiff
path: root/ontime_clocks/nodes.lua
blob: 4a184e82425b49f285e64031c5bcc0f140fdc587 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
-- Green digital clock
minetest.register_node("ontime_clocks:green_digital", {
	description = "Green digital clock",
	inventory_image = "ontime_clocks_green_digital_inventory.png",
	wield_image = "ontime_clocks_green_digital_inventory.png",
	paramtype = "light",
	paramtype2 = "wallmounted",
	drawtype = "nodebox",
	node_box = {
		type = "wallmounted",
		wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
		wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },    
		wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } 
	},
	tiles = {"ontime_clocks_digital.png"},
	groups = {oddly_breakable_by_hand=1},
	display_entities = {
		["ontime_clocks:display"] = {
			depth = -13/32 + 0.01, 
			on_display_update = function(pos, objref)
				objref:set_properties(
					ontime_clocks.get_digital_properties(
						"#040", "#0F0", ontime_clocks.get_h24(), ontime_clocks.get_m12()))
			end },
	},
	on_place = display_lib.on_place,
	on_construct = display_lib.on_construct,
	on_destruct = display_lib.on_destruct,
	on_rotate = display_lib.on_rotate,
})

minetest.register_abm({
	nodenames = {"ontime_clocks:green_digital"},
	interval = 5,
	chance = 1,
	action = display_lib.update_entities,
})

-- Red digital clock
minetest.register_node("ontime_clocks:red_digital", {
	description = "Red digital clock",
	inventory_image = "ontime_clocks_red_digital_inventory.png",
	wield_image = "ontime_clocks_red_digital_inventory.png",
	paramtype = "light",
	paramtype2 = "wallmounted",
	drawtype = "nodebox",
	node_box = {
		type = "wallmounted",
		wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
		wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },    
		wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } 
	},
	tiles = {"ontime_clocks_digital.png"},
	groups = {oddly_breakable_by_hand=1},
	display_entities = {
		["ontime_clocks:display"] = {
			depth = -13/32 + 0.01, 
			on_display_update = function(pos, objref)
				objref:set_properties(
					ontime_clocks.get_digital_properties(
						"#400", "#F00", ontime_clocks.get_h24(), ontime_clocks.get_m12()))
			end },
	},
	on_place = display_lib.on_place,
	on_construct = display_lib.on_construct,
	on_destruct = display_lib.on_destruct,
	on_rotate = display_lib.on_rotate,
})

minetest.register_abm({
	nodenames = {"ontime_clocks:red_digital"},
	interval = 5,
	chance = 1,
	action = display_lib.update_entities,
})


minetest.register_node("ontime_clocks:white", {
	description = "White clock",
	inventory_image = "ontime_clocks_white_inventory.png",
	wield_image = "ontime_clocks_white_inventory.png",
	paramtype = "light",
	paramtype2 = "wallmounted",
	drawtype = "nodebox",
	node_box = {
		type = "wallmounted",
		wall_side = { -0.5, -7/16, -7/16, -6/16, 7/16, 7/16},
		wall_bottom = { -7/16, -0.5, -7/16, 7/16, -7/16, 7/16},    
		wall_top = { -7/16, 0.5, -7/16, 7/16, 7/16, 7/16},    
	},
	tiles = {"ontime_clocks_white.png"},
	groups = {choppy=1,oddly_breakable_by_hand=1},
	display_entities = { 
		["ontime_clocks:display"] = {
			depth = -6/16+0.01,
			on_display_update = function(pos, objref)
				objref:set_properties(
					ontime_clocks.get_needles_properties(
						"#000", 36, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
			end },
	},
	on_place = display_lib.on_place,
	on_construct = display_lib.on_construct,
	on_destruct = display_lib.on_destruct,
	on_rotate = display_lib.on_rotate,
})

minetest.register_abm({
	nodenames = {"ontime_clocks:white"},
	interval = 5,
	chance = 1,
	action = display_lib.update_entities,
})

minetest.register_node("ontime_clocks:frameless_black", {
	description = "Frameless clock",
	inventory_image = "ontime_clocks_frameless_inventory.png",
	wield_image = "ontime_clocks_frameless_inventory.png",
	paramtype = "light",
	paramtype2 = "wallmounted",
	drawtype = "nodebox",
	node_box = {
		type = "wallmounted",
		wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
		wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },    
		wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } 
	},
	tiles = {"ontime_clocks_frameless.png"},
	groups = {choppy=1,oddly_breakable_by_hand=1},
	display_entities = { 
		["ontime_clocks:display"] = {
			depth = -7/16,
			on_display_update = function(pos, objref)
				objref:set_properties(
					ontime_clocks.get_needles_properties(
						"#000", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
			end },
	},
	on_place = display_lib.on_place,
	on_construct = display_lib.on_construct,
	on_destruct = display_lib.on_destruct,
	on_rotate = display_lib.on_rotate,
})

minetest.register_abm({
	nodenames = {"ontime_clocks:frameless_black"},
	interval = 5,
	chance = 1,
	action = display_lib.update_entities,
})

minetest.register_node("ontime_clocks:frameless_gold", {
	description = "Frameless gold clock",
	inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0",
	wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0",
	paramtype = "light",
	paramtype2 = "wallmounted",
	drawtype = "nodebox",
	node_box = {
		type = "wallmounted",
		wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
		wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },    
		wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } 
	},
	tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
	groups = {choppy=1,oddly_breakable_by_hand=1},
	display_entities = { 
		["ontime_clocks:display"] = {
			depth = -7/16,
			on_display_update = function(pos, objref)
				objref:set_properties(
					ontime_clocks.get_needles_properties(
						"#FF0", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
			end },
	},
	on_place = display_lib.on_place,
	on_construct = display_lib.on_construct,
	on_destruct = display_lib.on_destruct,
	on_rotate = display_lib.on_rotate,
})

minetest.register_abm({
	nodenames = {"ontime_clocks:frameless_gold"},
	interval = 5,
	chance = 1,
	action = display_lib.update_entities,
})

minetest.register_node("ontime_clocks:frameless_white", {
	description = "Frameless white clock",
	inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF",
	wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF",
	paramtype = "light",
	paramtype2 = "wallmounted",
	drawtype = "nodebox",
	node_box = {
		type = "wallmounted",
		wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
		wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },    
		wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } 
	},
	tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
	groups = {choppy=1,oddly_breakable_by_hand=1},
	display_entities = { 
		["ontime_clocks:display"] = {
			depth = -7/16,
			on_display_update = function(pos, objref)
				objref:set_properties(
					ontime_clocks.get_needles_properties(
						"#FFF", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
			end },
	},
	on_place = display_lib.on_place,
	on_construct = display_lib.on_construct,
	on_destruct = display_lib.on_destruct,
	on_rotate = display_lib.on_rotate,
})

minetest.register_abm({
	nodenames = {"ontime_clocks:frameless_white"},
	interval = 5,
	chance = 1,
	action = display_lib.update_entities,
})