forked from Ezhh/abriglass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodes.lua
302 lines (266 loc) · 9.89 KB
/
nodes.lua
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
-- undecorated coloured glass, all using plain glass texture
local glass_list = {
{"black", "Darkened", "292421",}, {"blue", "Blue", "0000FF",},
{"cyan", "Cyan", "00FFFF",}, {"green", "Green", "00FF00",},
{"magenta", "Magenta", "FF00FF",}, {"orange", "Orange", "FF6103",},
{"purple", "Purple", "800080",}, {"red", "Red", "FF0000",},
{"yellow", "Yellow", "FFFF00",}, {"frosted", "Frosted", "FFFFFF",}
}
for i in ipairs(glass_list) do
local name = glass_list[i][1]
local description = glass_list[i][2]
local colour = glass_list[i][3]
minetest.register_node("abriglass:stained_glass_"..name, {
description = description.." Glass",
tiles = {"abriglass_plainglass.png^[colorize:#"..colour..":122"},
groups = {cracky = 3},
use_texture_alpha = true,
sunlight_propagates = true,
light_source = 4,
drawtype = "glasslike",
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
})
end
-- boring glass because why not?
minetest.register_node("abriglass:clear_glass", {
description = "Clear Glass",
tiles = {"abriglass_clearglass.png"},
groups = {cracky = 3},
use_texture_alpha = true,
sunlight_propagates = true,
paramtype = "light",
drawtype = "glasslike",
sounds = default.node_sound_glass_defaults(),
})
-- glass lights
local light_list = {
{"glass_light_green", "Green", "lightgreen",},
{"glass_light_blue", "Blue", "lightblue",},
{"glass_light_red", "Red", "lightred",},
{"glass_light_yellow", "Yellow", "lightyellow",},
}
for i in ipairs(light_list) do
local name = light_list[i][1]
local description = light_list[i][2]
local image = light_list[i][3]
minetest.register_node("abriglass:" ..name, {
description = description.. "Glass Light",
tiles = {"abriglass_" ..image.. ".png"},
groups = {cracky = 3},
use_texture_alpha = true,
sunlight_propagates = true,
light_source = 14,
drawtype = "glasslike",
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
})
end
-- patterned glass
local pattern_list = { --{name, description, image}
{"stainedglass_tiles_dark", "Stained Glass", "stainedglass_tiles1",},
{"stainedglass_tiles_pale", "Stained Glass", "stainedglass_tiles2",},
{"stainedglass_pattern01", "Stained Glass", "stainedglass_pattern01",},
{"stainedglass_pattern02", "Cage Glass", "stainedglass_pattern02",},
{"stainedglass_pattern03", "Stained Glass", "stainedglass_pattern03",},
{"stainedglass_pattern04", "Stained Glass Cross", "stainedglass_pattern04",},
{"stainedglass_pattern05", "Stained Glass", "stainedglass_pattern05",},
}
for i in ipairs(pattern_list) do
local name = pattern_list[i][1]
local description = pattern_list[i][2]
local image = pattern_list[i][3]
minetest.register_node("abriglass:"..name, {
description = description,
tiles = {"abriglass_"..image..".png"},
groups = {cracky = 3},
use_texture_alpha = true,
sunlight_propagates = true,
light_source = 5,
drawtype = "glasslike",
paramtype = "light",
paramtype2 = "facedir",
sounds = default.node_sound_glass_defaults(),
})
end
-- portholes
local port_list = {
{"wood",}, {"junglewood",},
}
for i in ipairs(port_list) do
local name = port_list[i][1]
minetest.register_node("abriglass:porthole_"..name, {
description = "Porthole",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
groups = {choppy = 2, flammable = 2, wood = 1},
tiles = {"default_"..name.. ".png", -- up
"default_"..name.. ".png", -- down
"default_"..name.. ".png", -- right
"default_"..name.. ".png", -- left
"abriglass_porthole_"..name..".png", -- back
"abriglass_porthole_"..name..".png", -- front
},
is_ground_content = false,
sunlight_propagates = true,
})
end
-- one-way one side glass
local oneway_list = {
{"dark", "Dark", "oneway_face.png", "abriglass_oneway_wall.png", "abriglass_oneway_wall.png",},
{"pale", "White", "oneway_face.png^[colorize:#F8F8FF:200", "abriglass_oneway_wall.png^[colorize:#E6E6FA:200", "abriglass_oneway_wall.png^[colorize:#E6E6FA:200",},
{"desert_brick", "Desert Brick", "oneway_face.png^[colorize:#814F3C:200", "default_desert_stone_brick.png", "default_desert_stone_brick.png",},
{"stone_brick", "Stone Brick", "oneway_face.png^[colorize:#615E5D:200", "default_stone_brick.png", "default_stone_brick.png",},
{"sandstone_brick", "Sandstone Brick", "oneway_face.png^[colorize:#FFF9C5:200", "default_sandstone_brick.png", "default_sandstone_brick.png",},
{"desertstone", "Desert Stone", "oneway_face.png^[colorize:#814F3C:200", "default_desert_stone.png", "default_desert_stone.png",},
{"stone", "Stone", "oneway_face.png^[colorize:#615E5D:200", "default_stone.png", "default_stone.png",},
{"sandstone", "Sandstone", "oneway_face.png^[colorize:#FFF9C5:200", "default_sandstone.png","default_sandstone.png", },
{"snow", "Snow", "oneway_face.png^[colorize:#B6B7C1:200", "default_snow.png","default_snow.png", },
{"dirt", "Dirt", "oneway_face.png^[colorize:#4C341F:200", "default_dirt.png","default_dirt.png", },
{"dirt_grass", "Dirt with Grass", "oneway_face.png^[colorize:#30470E:200", "default_grass.png","default_dirt.png^default_grass_side.png", },
{"dirt_snow", "Dirt with Snow", "oneway_face.png^[colorize:#B6B7C1:200", "default_snow.png","default_dirt.png^default_snow_side.png", },
{"desert_sandstone_brick", "Desert Sandstone Brick", "oneway_face.png^[colorize:#C5C18F:200", "default_desert_sandstone_brick.png","default_desert_sandstone_brick.png", },
{"silver_sandstone_brick", "Silver Sandstone Brick", "oneway_face.png^[colorize:#C3C0B5:200", "default_silver_sandstone_brick.png","default_silver_sandstone_brick.png", },
{"obsidian_brick", "Obsidian Brick", "oneway_face.png^[colorize:#131518:200", "default_obsidian_brick.png","default_obsidian_brick.png", },
}
if minetest.get_modpath("ethereal") then
table.insert(oneway_list, {"snowbrick", "Snow Brick", "oneway_face.png^[colorize:#EEEFFF:200", "ethereal_brick_snow.png", "ethereal_brick_snow.png", })
table.insert(oneway_list, {"icebrick", "Ice Brick", "oneway_face.png^[colorize:#A9BED9:200", "ethereal_brick_ice.png", "ethereal_brick_ice.png", })
end
for i in ipairs(oneway_list) do
local name = oneway_list[i][1]
local description = oneway_list[i][2]
local image1 = oneway_list[i][3]
local image2 = oneway_list[i][4]
local image3 = oneway_list[i][5]
minetest.register_node("abriglass:oneway_glass_one_"..name, {
description = description.." One-Way Glass One Side",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
groups = {cracky = 3},
tiles = {"abriglass_oneway_plain_glass.png", -- up
"abriglass_oneway_plain_glass.png", -- down
"abriglass_oneway_plain_glass.png", -- right
"abriglass_oneway_plain_glass.png", -- left
"abriglass_"..image1, -- back
image2, -- front
},
is_ground_content = false,
sunlight_propagates = true,
inventory_image = minetest.inventorycube("abriglass_"..image1)
})
end
-- one-way two sides glass
for i in ipairs(oneway_list) do
local name = oneway_list[i][1]
local description = oneway_list[i][2]
local image1 = oneway_list[i][3]
local image2 = oneway_list[i][4]
local image3 = oneway_list[i][5]
minetest.register_node("abriglass:oneway_glass_two_"..name, {
description = description.." One-Way Glass Two Sides",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
groups = {cracky = 3},
tiles = {image2, -- up
"abriglass_"..image1, -- down
"abriglass_oneway_plain_glass.png", -- right
"abriglass_oneway_plain_glass.png", -- left
"abriglass_"..image1, -- back
image3, -- front
},
is_ground_content = false,
sunlight_propagates = true,
inventory_image = minetest.inventorycube("abriglass_"..image1)
})
end
-- one-way three sides glass
for i in ipairs(oneway_list) do
local name = oneway_list[i][1]
local description = oneway_list[i][2]
local image1 = oneway_list[i][3]
local image2 = oneway_list[i][4]
local image3 = oneway_list[i][5]
minetest.register_node("abriglass:oneway_glass_three_"..name, {
description = description.." One-Way Glass Three Sides",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
groups = {cracky = 3},
tiles = {image2, -- up
"abriglass_"..image1, -- down
image3, -- right
"abriglass_"..image1, -- left
"abriglass_"..image1, -- back
image3, -- front
},
is_ground_content = false,
sunlight_propagates = true,
inventory_image = minetest.inventorycube("abriglass_"..image1)
})
end
-- normal nodes to match one-way glass
minetest.register_node("abriglass:oneway_wall_dark", {
description = "Dark Block",
tiles = {"abriglass_oneway_wall.png"},
groups = {cracky = 3},
paramtype2 = "facedir",
})
minetest.register_node("abriglass:oneway_wall_pale", {
description = "Pale Block",
tiles = {"abriglass_oneway_wall.png^[colorize:#E6E6FA:200"},
groups = {cracky = 3},
paramtype2 = "facedir",
})
-- crystal, for later use in crafting recipes
minetest.register_node("abriglass:ghost_crystal", {
description = "Ghost Crystal",
tiles = {"abriglass_ghost_crystal.png"},
wield_image = "abriglass_ghost_crystal_wield.png",
groups = {cracky = 3},
use_texture_alpha = true,
sunlight_propagates = true,
light_source = 14,
drawtype = "glasslike",
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
})
-- hidden light node
minetest.register_node("abriglass:hidden_light", {
description = "Hidden Light",
tiles = {"abriglass_oneway_plain_glass.png"},
groups = {cracky = 3, not_in_creative_inventory=1},
use_texture_alpha = true,
sunlight_propagates = true,
walkable = false,
light_source = 7,
drawtype = "glasslike",
paramtype = "light",
})