-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.lua
206 lines (163 loc) · 5.3 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
local stairs_mod = minetest.get_modpath("stairs")
local stairsplus_mod = minetest.global_exists("stairsplus")
local ethereal_mod = minetest.get_modpath("ethereal")
local colours = {
{"black", "Black", "#000000b0"},
{"blue", "Blue", "#015dbb70"},
{"brown", "Brown", "#a78c4570"},
{"cyan", "Cyan", "#01ffd870"},
{"dark_green", "Dark Green", "#005b0770"},
{"dark_grey", "Dark Grey", "#303030b0"},
{"green", "Green", "#61ff0170"},
{"grey", "Grey", "#5b5b5bb0"},
{"magenta", "Magenta", "#ff05bb70"},
{"orange", "Orange", "#ff840170"},
{"pink", "Pink", "#ff65b570"},
{"red", "Red", "#ff000070"},
{"violet", "Violet", "#2000c970"},
{"white", "White", "#abababc0"},
{"yellow", "Yellow", "#e3ff0070"}
}
local function cblocks_stairs(nodename, def)
minetest.register_node(nodename, def)
if stairs_mod or stairsplus_mod then
local mod, name = nodename:match("(.*):(.*)")
for groupname, value in pairs(def.groups) do
if groupname ~= "cracky"
and groupname ~= "choppy"
and groupname ~="flammable"
and groupname ~="crumbly"
and groupname ~="snappy" then
def.groups.groupname = nil
end
end
if stairsplus_mod then
stairsplus:register_all(mod, name, nodename, {
description = def.description,
tiles = def.tiles,
groups = def.groups,
sounds = def.sounds
})
elseif stairs_mod and stairs
and stairs.mod and stairs.mod == "redo" then
stairs.register_all(name, nodename,
def.groups,
def.tiles,
def.description,
def.sounds,
def.walign
)
elseif stairs_mod and not stairs.mod then
stairs.register_stair_and_slab(name, nodename,
def.groups,
def.tiles,
("%s Stair"):format(def.description),
("%s Slab"):format(def.description),
def.sounds,
def.walign
)
end
end
end
local function set_alias(col, name)
minetest.register_alias("stairs:stair_" .. col .. "_" .. name,
"stairs:stair_" .. name .. "_" .. col)
minetest.register_alias("stairs:slab_" .. col .. "_" .. name,
"stairs:slab_" .. name .. "_" .. col)
minetest.register_alias("stairs:stair_inner_" .. col .. "_" .. name,
"stairs:stair_inner_" .. name .. "_" .. col)
minetest.register_alias("stairs:stair_outer_" .. col .. "_" .. name,
"stairs:stair_outer_" .. name .. "_" .. col)
minetest.register_alias("stairs:slope_" .. col .. "_" .. name,
"stairs:slope_" .. name .. "_" .. col)
end
for i = 1, #colours do
-- stone brick
cblocks_stairs("cblocks:stonebrick_" .. colours[i][1], {
description = colours[i][2] .. " Stone Brick",
tiles = {"default_stone_brick.png^[colorize:" .. colours[i][3]},
paramtype = "light",
use_texture_alpha = "opaque",
is_ground_content = false,
groups = {cracky = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
paramtype2 = "facedir",
place_param2 = 0,
walign = true
})
minetest.register_craft({
output = "cblocks:stonebrick_" .. colours[i][1] .. " 2",
recipe = {
{"default:stonebrick","default:stonebrick", "dye:" .. colours[i][1]}
}
})
-- glass (no stairs unless stairs redo active because default stairs mod
-- does not support transparent stairs)
if stairs_mod and stairs and stairs.mod and stairs.mod == "redo" then
cblocks_stairs("cblocks:glass_" .. colours[i][1], {
description = colours[i][2] .. " Glass",
tiles = {"cblocks.png^[colorize:" .. colours[i][3]},
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = "blend",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults()
})
set_alias(colours[i][1], "glass")
else
minetest.register_node("cblocks:glass_" .. colours[i][1], {
description = colours[i][2] .. " Glass",
tiles = {"cblocks.png^[colorize:" .. colours[i][3]},
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = "blend",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults()
})
end
minetest.register_craft({
output = "cblocks:glass_".. colours[i][1] .. " 2",
recipe = {
{"default:glass","default:glass", "dye:" .. colours[i][1]},
}
})
-- wood
local col = colours[i][1]
-- ethereal already has yellow wood so rename to yellow2
if ethereal_mod and col == "yellow" then
col = "yellow2"
end
cblocks_stairs("cblocks:wood_" .. col, {
description = colours[i][2] .. " Wooden Planks",
tiles = {"default_wood.png^[colorize:" .. colours[i][3]},
paramtype = "light",
use_texture_alpha = "opaque",
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
place_param2 = 0,
walign = true
})
set_alias(colours[i][1], "wood")
minetest.register_craft({
output = "cblocks:wood_" .. col .. " 2",
recipe = {
{"group:wood","group:wood", "dye:" .. colours[i][1]}
}
})
end
-- add lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"dro", {"cblocks:wood_"}, 10, true},
{"dro", {"cblocks:stonebrick_"}, 10, true},
{"dro", {"cblocks:glass_"}, 10, true},
{"exp"}
})
end
print ("[MOD] Cblocks loaded")