-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
309 lines (278 loc) · 9.03 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
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
303
304
305
306
307
308
309
-- train_gravels/init.lua
-- Gravel-related blocks for advtrains
--[[
Copyright © 2011-2024 Hugo Locurcio and contributors.
Licensed under the zlib license. See LICENSE.md for more information.
]]
local S = core.get_translator("train_gravels")
local sound_gravel = core.global_exists("xcompat") and xcompat.sounds.node_sound_gravel_defaults() or nil
-- Gravel Stonebrick
for name, def in pairs({
gravel_stonebrick = {
description = S("Gravel on Stone Brick"),
texture = "default_stone_brick.png",
recipe_item = "default:stonebrick",
},
gravel_desert_stonebrick = {
description = S("Gravel on Desert Stone Brick"),
texture = "default_desert_stone_brick.png",
recipe_item = "default:desert_stonebrick",
},
gravel_sandstonebrick = {
description = S("Gravel on Sandstone Brick"),
texture = "default_sandstone_brick.png",
recipe_item = "default:sandstonebrick",
},
gravel_silver_sandstone_brick = {
description = S("Gravel on Silver Sandstone Brick"),
texture = "default_silver_sandstone_brick.png",
recipe_item = "default:silver_sandstone_brick",
},
gravel_iron_stone_bricks = {
description = S("Gravel on Iron Stone Bricks"),
texture = "moreblocks_iron_stone_bricks.png",
recipe_item = "moreblocks:iron_stone_bricks",
},
gravel_coal_stone_bricks = {
description = S("Gravel on Coal Stone Bricks"),
texture = "moreblocks_coal_stone_bricks.png",
recipe_item = "moreblocks:coal_stone_bricks",
},
gravel_granite_bricks = {
description = S("Gravel on Granite Bricks"),
texture = "technic_granite_bricks.png",
recipe_item = "technic:granite_bricks",
},
gravel_marble_bricks = {
description = S("Gravel on Marble Bricks"),
texture = "technic_marble_bricks.png",
recipe_item = "technic:marble_bricks",
},
gravel_stone_tile = {
description = S("Gravel on Stone Tile"),
texture = "moreblocks_split_stone_tile.png",
bottom_texture = "moreblocks_stone_tile.png",
recipe_item = "moreblocks:stone_tile",
},
gravel_split_stone_tile = {
description = S("Gravel on Split Stone Tile"),
texture = "moreblocks_split_stone_tile.png",
recipe_item = "moreblocks:split_stone_tile",
},
}) do
if core.registered_items[def.recipe_item] then
local side_texture = "default_gravel.png^[lowpart:50:" .. def.texture
core.register_node("train_gravels:" .. name, {
description = def.description,
tiles = {
"default_gravel.png",
def.bottom_texture or def.texture,
side_texture,
side_texture,
side_texture,
side_texture
},
groups = { cracky = 3 },
sounds = sound_gravel,
})
core.register_craft({
output = "train_gravels:" .. name .. " 2",
recipe = {
{ "default:gravel" },
{ def.recipe_item },
}
})
end
end
core.register_alias("moreblocks:gravel_stonebrick", "train_gravels:gravel_stonebrick")
-- Gravel Slopes
local slopes = {
["2a"] = "half",
["2b"] = "half_raised",
["3a"] = "third",
["3b"] = "third_raised",
["3c"] = "third_top"
}
local box = {
["2a"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.375, 0.5 },
{ -0.5, -0.375, -0.25, 0.5, -0.25, 0.5 },
{ -0.5, -0.25, 0, 0.5, -0.125, 0.5 },
{ -0.5, -0.125, 0.25, 0.5, 0, 0.5 },
}
},
["2b"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.125, 0.5 },
{ -0.5, 0.125, -0.25, 0.5, 0.25, 0.5 },
{ -0.5, 0.25, 0, 0.5, 0.375, 0.5 },
{ -0.5, 0.375, 0.25, 0.5, 0.5, 0.5 },
}
},
["3a"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.417, 0.5 },
{ -0.5, -0.417, -0.25, 0.5, -0.333, 0.5 },
{ -0.5, -0.333, 0, 0.5, -0.250, 0.5 },
{ -0.5, -0.250, 0.25, 0.5, -0.167, 0.5 },
}
},
["3b"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.083, 0.5 },
{ -0.5, -0.083, -0.25, 0.5, 0, 0.5 },
{ -0.5, 0, 0, 0.5, 0.083, 0.5 },
{ -0.5, 0.083, 0.25, 0.5, 0.167, 0.5 },
}
},
["3c"] = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.250, 0.5 },
{ -0.5, 0.250, -0.25, 0.5, 0.333, 0.5 },
{ -0.5, 0.333, 0, 0.5, 0.417, 0.5 },
{ -0.5, 0.417, 0.25, 0.5, 0.5, 0.5 },
}
}
}
for id, mod in pairs(slopes) do
core.register_node("train_gravels:gravel_slope_" .. id, {
description = S("Gravel Slope @1", id),
tiles = { "default_gravel.png" },
groups = { crumbly = 2, falling_node = 1, not_blocking_trains = 1 },
sounds = sound_gravel,
drawtype = "mesh",
mesh = "train_gravels_slope_" .. mod .. ".obj",
selection_box = box[id],
collision_box = box[id],
sunlight_propagates = false,
light_source = 0,
paramtype = "light",
paramtype2 = "facedir",
on_rotate = screwdriver and screwdriver.rotate_simple,
is_ground_content = false,
})
core.register_alias("moreblocks:gravel_slope_" .. id, "train_gravels:gravel_slope_" .. id)
end
-- 1:1 slope
local box_slope = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
{ -0.5, -0.25, -0.25, 0.5, 0, 0.5 },
{ -0.5, 0, 0, 0.5, 0.25, 0.5 },
{ -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 }
}
}
core.register_node("train_gravels:gravel_slope", {
description = S("Gravel Slope @1", "1"),
tiles = { "default_gravel.png" },
groups = { crumbly = 2, falling_node = 1, not_blocking_trains = 1 },
sounds = sound_gravel,
drawtype = "mesh",
mesh = "train_gravels_slope.obj",
selection_box = box_slope,
collision_box = box_slope,
sunlight_propagates = false,
light_source = 0,
paramtype = "light",
paramtype2 = "facedir",
on_rotate = screwdriver and screwdriver.rotate_simple,
is_ground_content = false,
})
core.register_alias("moreblocks:gravel_slope", "train_gravels:gravel_slope")
-- Advtrains Track Slope (Straight) hitbox fix
if core.get_modpath("advtrains_train_track") then
local vst_map = {
vst1 = "2a",
vst2 = "2b",
vst31 = "3a",
vst32 = "3b",
vst33 = "3c"
}
for orig, id in pairs(vst_map) do
core.override_item("advtrains:dtrack_" .. orig, {
walkable = true,
selection_box = box[id],
collision_box = box[id],
})
end
end
-- Recipies
core.register_craft({
output = "moreblocks:gravel_slope 6",
recipe = {
{ "", "", "" },
{ "", "", "default:gravel", },
{ "", "default:gravel", "default:gravel" },
}
})
core.register_craft({
output = "moreblocks:gravel_slope_2a 8",
recipe = {
{ "", "", "" },
{ "", "", "", },
{ "", "default:gravel", "default:gravel" },
}
})
core.register_craft({
output = "moreblocks:gravel_slope_2b 4",
recipe = {
{ "", "", "default:gravel", },
{ "", "", "" },
{ "", "default:gravel", "default:gravel" },
}
})
core.register_craft({
output = "moreblocks:gravel_slope_3a 18",
recipe = {
{ "", "", "" },
{ "", "", "", },
{ "default:gravel", "default:gravel", "default:gravel" },
}
})
core.register_craft({
output = "moreblocks:gravel_slope_3b 8",
recipe = {
{ "", "", "" },
{ "", "", "default:gravel", },
{ "default:gravel", "default:gravel", "default:gravel" },
}
})
core.register_craft({
output = "moreblocks:gravel_slope_3c 6",
recipe = {
{ "", "", "default:gravel", },
{ "", "default:gravel", "" },
{ "default:gravel", "default:gravel", "default:gravel" },
}
})
core.register_craft({
output = "default:gravel",
recipe = {
{ "moreblocks:gravel_slope_2a", "", "" },
{ "moreblocks:gravel_slope_2b", "", "" },
{ "", "", "" },
}
})
core.register_craft({
output = "default:gravel",
recipe = {
{ "moreblocks:gravel_slope_3b", "", "" },
{ "moreblocks:gravel_slope_3b", "", "" },
{ "", "", "" },
}
})
core.register_craft({
output = "default:gravel",
recipe = {
{ "moreblocks:gravel_slope_3a", "", "" },
{ "moreblocks:gravel_slope_3c", "", "" },
{ "", "", "" },
}
})