-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.lua
254 lines (192 loc) · 5.84 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
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
-- translation support
local S = minetest.get_translator("bakedclay")
-- list of clay colours
local clay = {
{"natural", S("Natural")},
{"white", S("White")},
{"grey", S("Grey")},
{"black", S("Black")},
{"red", S("Red")},
{"yellow", S("Yellow")},
{"green", S("Green")},
{"cyan", S("Cyan")},
{"blue", S("Blue")},
{"magenta", S("Magenta")},
{"orange", S("Orange")},
{"violet", S("Violet")},
{"brown", S("Brown")},
{"pink", S("Pink")},
{"dark_grey", S("Dark Grey")},
{"dark_green", S("Dark Green")}
}
-- check mod support
local techcnc_mod = minetest.get_modpath("technic_cnc")
local stairs_mod = minetest.get_modpath("stairs")
local stairsplus_mod = minetest.get_modpath("moreblocks")
and minetest.global_exists("stairsplus")
local stairsplus_compat = minetest.settings:get_bool("stairsplus_clay_compatibility") ~= false
-- scroll through colours
for _, clay in pairs(clay) do
-- register node
minetest.register_node("bakedclay:" .. clay[1], {
description = clay[2] .. " " .. S("Baked Clay"),
tiles = {"baked_clay_" .. clay[1] ..".png"},
groups = {cracky = 3, bakedclay = 1},
sounds = default.node_sound_stone_defaults(),
is_ground_content = false
})
-- register craft recipe
if clay[1] ~= "natural" then
minetest.register_craft({
output = "bakedclay:" .. clay[1] .. " 8",
recipe = {
{"group:bakedclay", "group:bakedclay", "group:bakedclay"},
{"group:bakedclay", "dye:" .. clay[1], "group:bakedclay"},
{"group:bakedclay", "group:bakedclay", "group:bakedclay"}
}
})
end
-- stairs plus
if stairsplus_mod then
stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1],
"bakedclay:" .. clay[1], {
description = clay[2] .. " " .. S("Baked Clay"),
tiles = {"baked_clay_" .. clay[1] .. ".png"},
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults()
})
if stairsplus_compat then
stairsplus:register_alias_all("bakedclay", clay[1],
"bakedclay", "baked_clay_" .. clay[1])
minetest.register_alias("stairs:slab_bakedclay_".. clay[1],
"bakedclay:slab_baked_clay_" .. clay[1])
minetest.register_alias("stairs:stair_bakedclay_".. clay[1],
"bakedclay:stair_baked_clay_" .. clay[1])
end
-- stairs redo
elseif stairs_mod and stairs.mod then
stairs.register_all("bakedclay_" .. clay[1], "bakedclay:" .. clay[1],
{cracky = 3},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " " .. S("Baked Clay"),
default.node_sound_stone_defaults())
-- default stairs
elseif stairs_mod then
stairs.register_stair_and_slab("bakedclay_".. clay[1], "bakedclay:".. clay[1],
{cracky = 3},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " " .. S("Baked Clay Stair"),
clay[2] .. " " .. S("Baked Clay Slab"),
default.node_sound_stone_defaults())
end
-- register bakedclay for use in technic_cnc mod after all mods loaded
if techcnc_mod then
minetest.register_on_mods_loaded(function()
technic_cnc.register_all("bakedclay:" .. clay[1],
{cracky = 3, not_in_creative_inventory = 1},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay")
end)
end
end
-- Terracotta blocks
for _, clay in pairs(clay) do
if clay[1] ~= "natural" then
local texture = "baked_clay_terracotta_" .. clay[1] ..".png"
minetest.register_node("bakedclay:terracotta_" .. clay[1], {
description = clay[2] .. " " .. S("Glazed Terracotta"),
tiles = {
texture .. "",
texture .. "",
texture .. "^[transformR180",
texture .. "",
texture .. "^[transformR270",
texture .. "^[transformR90",
},
paramtype2 = "facedir",
groups = {cracky = 3, terracotta = 1},
sounds = default.node_sound_stone_defaults(),
is_ground_content = false,
on_place = minetest.rotate_node
})
minetest.register_craft({
type = "cooking",
output = "bakedclay:terracotta_" .. clay[1],
recipe = "bakedclay:" .. clay[1]
})
end
end
minetest.register_alias("bakedclay:terracotta_light_blue", "bakedclay:terracotta_cyan")
-- cook clay block into natural baked clay
minetest.register_craft({
type = "cooking",
output = "bakedclay:natural",
recipe = "default:clay"
})
-- register a few extra dye colour options
minetest.register_craft({
output = "dye:green 4",
recipe = {{"default:cactus"}}
})
minetest.register_craft({
output = "dye:brown 4",
recipe = {{"default:dry_shrub"}}
})
-- only add light grey recipe if unifieddye mod isnt present (conflict)
if not minetest.get_modpath("unifieddyes") then
minetest.register_craft( {
output = "dye:dark_grey 3",
recipe = {{"dye:black", "dye:black", "dye:white"}}
})
minetest.register_craft( {
output = "dye:grey 3",
recipe = {{"dye:black", "dye:white", "dye:white"}}
})
end
-- 2x2 red baked clay makes 16x clay brick
minetest.register_craft( {
output = "default:clay_brick 16",
recipe = {
{"bakedclay:red", "bakedclay:red"},
{"bakedclay:red", "bakedclay:red"}
}
})
-- colored clay compatibility
if minetest.settings:get_bool("colored_clay_compatibility") == true then
local cc = {
{"black", "black"},
{"blue", "blue"},
{"bright", "natural"},
{"brown", "brown"},
{"cyan", "cyan"},
{"dark_green", "dark_green"},
{"dark_grey", "dark_grey"},
{"green", "green"},
{"grey", "grey"},
{"hardened", "natural"},
{"magenta", "magenta"},
{"orange", "orange"},
{"pink", "pink"},
{"red", "red"},
{"violet", "violet"},
{"white", "white"},
{"yellow", "yellow"}
}
for n = 1, #cc do
local nod1 = "colored_clay:" .. cc[n][1]
local nod2 = "bakedclay:" .. cc[n][2]
minetest.register_alias(nod1, nod2)
if stairsplus_mod then
stairsplus:register_alias_all("colored_clay", cc[n][1], "bakedclay", cc[n][2])
end
end
end
-- get mod path
local path = minetest.get_modpath("bakedclay")
-- add new flowers
dofile(path .. "/flowers.lua")
-- add lucky blocks if mod present
if minetest.get_modpath("lucky_block") then
dofile(path .. "/lucky_block.lua")
end
print ("[MOD] Baked Clay loaded")