-
Notifications
You must be signed in to change notification settings - Fork 6
/
init.lua
174 lines (156 loc) · 5.08 KB
/
init.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
-- Minetest 0.4.17 mod: framedglass
framedglass = {}
minetest.register_craft({
output = 'framedglass:wooden_framed_glass 4',
recipe = {
{'default:glass', 'default:glass', 'default:stick'},
{'default:glass', 'default:glass', 'default:stick'},
{'default:stick', 'default:stick', ''},
}
})
minetest.register_craft({
output = 'framedglass:steel_framed_glass 4',
recipe = {
{'default:glass', 'default:glass', 'default:steel_ingot'},
{'default:glass', 'default:glass', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', ''},
}
})
minetest.register_craft({
output = 'framedglass:wooden_framed_obsidian_glass 4',
recipe = {
{'default:obsidian_glass', 'default:obsidian_glass', 'default:stick'},
{'default:obsidian_glass', 'default:obsidian_glass', 'default:stick'},
{'default:stick', 'default:stick', ''},
}
})
minetest.register_craft({
output = 'framedglass:steel_framed_obsidian_glass 4',
recipe = {
{'default:obsidian_glass', 'default:obsidian_glass', 'default:steel_ingot'},
{'default:obsidian_glass', 'default:obsidian_glass', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', ''},
}
})
local sounds = minetest.get_modpath("default") and default.node_sound_glass_defaults()
local on_dig = minetest.get_modpath("unifieddyes") and unifieddyes.on_dig
minetest.register_node("framedglass:wooden_framed_glass", {
description = "Wooden-framed Glass",
drawtype = "glasslike_framed",
tiles = {"framedglass_wooden_frame.png","framedglass_glass_face_streaks.png"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = sounds,
})
minetest.register_node("framedglass:steel_framed_glass", {
description = "Steel-framed Glass",
drawtype = "glasslike_framed",
tiles = {"framedglass_steel_frame.png","framedglass_glass_face_streaks.png"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = sounds,
})
minetest.register_node("framedglass:wooden_framed_obsidian_glass", {
description = "Wooden-framed Obsidian Glass",
drawtype = "glasslike_framed",
tiles = {"framedglass_wooden_frame.png","framedglass_glass_face_clean.png"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky=3},
sounds = sounds,
})
minetest.register_node("framedglass:steel_framed_obsidian_glass", {
description = "Steel-framed Obsidian Glass",
drawtype = "glasslike_framed",
tiles = {"framedglass_steel_frame.png", "framedglass_glass_face_clean.png"},
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
palette = "unifieddyes_palette_extended.png",
airbrush_replacement_node = "framedglass:steel_framed_obsidian_glass_tinted",
groups = {cracky=3, ud_param2_colorable = 1},
sounds = sounds,
on_dig = on_dig,
})
minetest.register_node("framedglass:steel_framed_obsidian_glass_tinted", {
description = "Steel-framed Obsidian Glass",
drawtype = "glasslike_framed",
tiles = {
{ name = "framedglass_steel_frame.png", color = "white" },
"framedglass_whiteglass.png",
},
palette = "unifieddyes_palette_extended.png",
inventory_image = minetest.inventorycube("framedglass_glass_face_inv_static.png"),
paramtype = "light",
paramtype2 = "color",
sunlight_propagates = true,
is_ground_content = false,
use_texture_alpha = "blend",
groups = {cracky=3, oddly_breakable_by_hand=3, ud_param2_colorable = 1, not_in_creative_inventory = 1},
sounds = sounds,
on_dig = on_dig,
})
-- crafts!
if minetest.get_modpath("unifieddyes") then
unifieddyes.register_color_craft({
output = "framedglass:steel_framed_obsidian_glass_tinted",
type = "shapeless",
palette = "extended",
neutral_node = "framedglass:steel_framed_obsidian_glass",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
-- Convert old nodes
local static_colors = {
red = 4*24 ,
orange = 4*24 + 2,
yellow = 4*24 + 4,
green = 4*24 + 8,
cyan = 4*24 + 12,
blue = 4*24 + 16,
violet = 4*24 + 18,
magenta = 4*24 + 20,
darkgreen = 8*24 + 8,
pink = 23,
brown = 8*24 + 2,
white = 10*24 ,
grey = 10*24 + 7,
darkgrey = 10*24 + 11,
black = 10*24 + 15
}
local old_nodes = {}
for k in pairs(static_colors) do
table.insert(old_nodes, "framedglass:steel_framed_obsidian_glass" .. k)
end
minetest.register_lbm({
label = "Convert old framedglass static-colored nodes",
name = "framedglass:convert_static",
run_at_every_load = false,
nodenames = old_nodes,
action = function(pos, node)
local oldcolor = string.sub(node.name, 40)
if oldcolor then
minetest.swap_node(pos, {
name = "framedglass:steel_framed_obsidian_glass_tinted",
param2 = static_colors[oldcolor]
})
else
minetest.swap_node(pos, {
name = "framedglass:steel_framed_obsidian_glass",
param2 = 0
})
end
end
})
end
if minetest.get_modpath("mtt") and mtt.enabled then
-- validate nodenames
mtt.validate_nodenames(minetest.get_modpath("framedglass") .. "/nodenames.txt")
end