|
46 | 46 | -- Node will be called stairs:stair_<subname>
|
47 | 47 |
|
48 | 48 | function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
| 49 | + -- Set backface culling and world-aligned textures |
49 | 50 | local stair_images = {}
|
50 | 51 | for i, image in ipairs(images) do
|
51 | 52 | if type(image) == "string" then
|
52 | 53 | stair_images[i] = {
|
53 | 54 | name = image,
|
54 | 55 | backface_culling = true,
|
| 56 | + align_style = "world", |
55 | 57 | }
|
56 |
| - elseif image.backface_culling == nil then -- override using any other value |
| 58 | + else |
57 | 59 | stair_images[i] = table.copy(image)
|
58 |
| - stair_images[i].backface_culling = true |
| 60 | + if stair_images[i].backface_culling == nil then |
| 61 | + stair_images[i].backface_culling = true |
| 62 | + end |
| 63 | + if stair_images[i].align_style == nil then |
| 64 | + stair_images[i].align_style = "world" |
| 65 | + end |
59 | 66 | end
|
60 | 67 | end
|
61 | 68 | groups.stair = 1
|
62 | 69 | minetest.register_node(":stairs:stair_" .. subname, {
|
63 | 70 | description = description,
|
64 |
| - drawtype = "mesh", |
65 |
| - mesh = "stairs_stair.obj", |
| 71 | + drawtype = "nodebox", |
66 | 72 | tiles = stair_images,
|
67 | 73 | paramtype = "light",
|
68 | 74 | paramtype2 = "facedir",
|
69 | 75 | is_ground_content = false,
|
70 | 76 | groups = groups,
|
71 | 77 | sounds = sounds,
|
72 |
| - selection_box = { |
73 |
| - type = "fixed", |
74 |
| - fixed = { |
75 |
| - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, |
76 |
| - {-0.5, 0, 0, 0.5, 0.5, 0.5}, |
77 |
| - }, |
78 |
| - }, |
79 |
| - collision_box = { |
| 78 | + node_box = { |
80 | 79 | type = "fixed",
|
81 | 80 | fixed = {
|
82 |
| - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, |
83 |
| - {-0.5, 0, 0, 0.5, 0.5, 0.5}, |
| 81 | + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, |
| 82 | + {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5}, |
84 | 83 | },
|
85 | 84 | },
|
86 | 85 | on_place = function(itemstack, placer, pointed_thing)
|
@@ -144,11 +143,26 @@ local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
|
144 | 143 | -- Node will be called stairs:slab_<subname>
|
145 | 144 |
|
146 | 145 | function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
|
| 146 | + -- Set world-aligned textures |
| 147 | + local slab_images = {} |
| 148 | + for i, image in ipairs(images) do |
| 149 | + if type(image) == "string" then |
| 150 | + slab_images[i] = { |
| 151 | + name = image, |
| 152 | + align_style = "world", |
| 153 | + } |
| 154 | + else |
| 155 | + slab_images[i] = table.copy(image) |
| 156 | + if image.align_style == nil then |
| 157 | + slab_images[i].align_style = "world" |
| 158 | + end |
| 159 | + end |
| 160 | + end |
147 | 161 | groups.slab = 1
|
148 | 162 | minetest.register_node(":stairs:slab_" .. subname, {
|
149 | 163 | description = description,
|
150 | 164 | drawtype = "nodebox",
|
151 |
| - tiles = images, |
| 165 | + tiles = slab_images, |
152 | 166 | paramtype = "light",
|
153 | 167 | paramtype2 = "facedir",
|
154 | 168 | is_ground_content = false,
|
@@ -280,43 +294,41 @@ end
|
280 | 294 | -- Node will be called stairs:stair_inner_<subname>
|
281 | 295 |
|
282 | 296 | function stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds)
|
| 297 | + -- Set backface culling and world-aligned textures |
283 | 298 | local stair_images = {}
|
284 | 299 | for i, image in ipairs(images) do
|
285 | 300 | if type(image) == "string" then
|
286 | 301 | stair_images[i] = {
|
287 | 302 | name = image,
|
288 | 303 | backface_culling = true,
|
| 304 | + align_style = "world", |
289 | 305 | }
|
290 |
| - elseif image.backface_culling == nil then -- override using any other value |
| 306 | + else |
291 | 307 | stair_images[i] = table.copy(image)
|
292 |
| - stair_images[i].backface_culling = true |
| 308 | + if stair_images[i].backface_culling == nil then |
| 309 | + stair_images[i].backface_culling = true |
| 310 | + end |
| 311 | + if stair_images[i].align_style == nil then |
| 312 | + stair_images[i].align_style = "world" |
| 313 | + end |
293 | 314 | end
|
294 | 315 | end
|
295 | 316 | groups.stair = 1
|
296 | 317 | minetest.register_node(":stairs:stair_inner_" .. subname, {
|
297 | 318 | description = description .. " Inner",
|
298 |
| - drawtype = "mesh", |
299 |
| - mesh = "stairs_stair_inner.obj", |
| 319 | + drawtype = "nodebox", |
300 | 320 | tiles = stair_images,
|
301 | 321 | paramtype = "light",
|
302 | 322 | paramtype2 = "facedir",
|
303 | 323 | is_ground_content = false,
|
304 | 324 | groups = groups,
|
305 | 325 | sounds = sounds,
|
306 |
| - selection_box = { |
307 |
| - type = "fixed", |
308 |
| - fixed = { |
309 |
| - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, |
310 |
| - {-0.5, 0, 0, 0.5, 0.5, 0.5}, |
311 |
| - {-0.5, 0, -0.5, 0, 0.5, 0}, |
312 |
| - }, |
313 |
| - }, |
314 |
| - collision_box = { |
| 326 | + node_box = { |
315 | 327 | type = "fixed",
|
316 | 328 | fixed = {
|
317 |
| - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, |
318 |
| - {-0.5, 0, 0, 0.5, 0.5, 0.5}, |
319 |
| - {-0.5, 0, -0.5, 0, 0.5, 0}, |
| 329 | + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, |
| 330 | + {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5}, |
| 331 | + {-0.5, 0.0, -0.5, 0.0, 0.5, 0.0}, |
320 | 332 | },
|
321 | 333 | },
|
322 | 334 | on_place = function(itemstack, placer, pointed_thing)
|
@@ -358,41 +370,40 @@ end
|
358 | 370 | -- Node will be called stairs:stair_outer_<subname>
|
359 | 371 |
|
360 | 372 | function stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds)
|
| 373 | + -- Set backface culling and world-aligned textures |
361 | 374 | local stair_images = {}
|
362 | 375 | for i, image in ipairs(images) do
|
363 | 376 | if type(image) == "string" then
|
364 | 377 | stair_images[i] = {
|
365 | 378 | name = image,
|
366 | 379 | backface_culling = true,
|
| 380 | + align_style = "world", |
367 | 381 | }
|
368 |
| - elseif image.backface_culling == nil then -- override using any other value |
| 382 | + else |
369 | 383 | stair_images[i] = table.copy(image)
|
370 |
| - stair_images[i].backface_culling = true |
| 384 | + if stair_images[i].backface_culling == nil then |
| 385 | + stair_images[i].backface_culling = true |
| 386 | + end |
| 387 | + if stair_images[i].align_style == nil then |
| 388 | + stair_images[i].align_style = "world" |
| 389 | + end |
371 | 390 | end
|
372 | 391 | end
|
373 | 392 | groups.stair = 1
|
374 | 393 | minetest.register_node(":stairs:stair_outer_" .. subname, {
|
375 | 394 | description = description .. " Outer",
|
376 |
| - drawtype = "mesh", |
377 |
| - mesh = "stairs_stair_outer.obj", |
| 395 | + drawtype = "nodebox", |
378 | 396 | tiles = stair_images,
|
379 | 397 | paramtype = "light",
|
380 | 398 | paramtype2 = "facedir",
|
381 | 399 | is_ground_content = false,
|
382 | 400 | groups = groups,
|
383 | 401 | sounds = sounds,
|
384 |
| - selection_box = { |
385 |
| - type = "fixed", |
386 |
| - fixed = { |
387 |
| - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, |
388 |
| - {-0.5, 0, 0, 0, 0.5, 0.5}, |
389 |
| - }, |
390 |
| - }, |
391 |
| - collision_box = { |
| 402 | + node_box = { |
392 | 403 | type = "fixed",
|
393 | 404 | fixed = {
|
394 |
| - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, |
395 |
| - {-0.5, 0, 0, 0, 0.5, 0.5}, |
| 405 | + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, |
| 406 | + {-0.5, 0.0, 0.0, 0.0, 0.5, 0.5}, |
396 | 407 | },
|
397 | 408 | },
|
398 | 409 | on_place = function(itemstack, placer, pointed_thing)
|
|
0 commit comments