|
309 | 309 | local fence_collision_extra = minetest.settings:get_bool("enable_fence_tall") and 3/8 or 0
|
310 | 310 |
|
311 | 311 | function default.register_fence(name, def)
|
312 |
| - minetest.register_craft({ |
313 |
| - output = name .. " 4", |
314 |
| - recipe = { |
315 |
| - { def.material, 'group:stick', def.material }, |
316 |
| - { def.material, 'group:stick', def.material }, |
317 |
| - } |
318 |
| - }) |
319 |
| - |
320 | 312 | local fence_texture = "default_fence_overlay.png^" .. def.texture ..
|
321 | 313 | "^default_fence_overlay.png^[makealpha:255,126,126"
|
322 | 314 | -- Allow almost everything to be overridden
|
@@ -364,10 +356,24 @@ function default.register_fence(name, def)
|
364 | 356 | -- Always add to the fence group, even if no group provided
|
365 | 357 | def.groups.fence = 1
|
366 | 358 |
|
| 359 | + local material = def.material |
367 | 360 | def.texture = nil
|
368 | 361 | def.material = nil
|
369 | 362 |
|
370 | 363 | minetest.register_node(name, def)
|
| 364 | + |
| 365 | + -- Register crafting recipe, trim away starting colon if any |
| 366 | + if not material then return end |
| 367 | + if string.sub(name, 1,1) == ":" then |
| 368 | + name = string.sub(name, 2) |
| 369 | + end |
| 370 | + minetest.register_craft({ |
| 371 | + output = name .. " 4", |
| 372 | + recipe = { |
| 373 | + { material, 'group:stick', material }, |
| 374 | + { material, 'group:stick', material }, |
| 375 | + } |
| 376 | + }) |
371 | 377 | end
|
372 | 378 |
|
373 | 379 |
|
|
376 | 382 | --
|
377 | 383 |
|
378 | 384 | function default.register_fence_rail(name, def)
|
379 |
| - minetest.register_craft({ |
380 |
| - output = name .. " 16", |
381 |
| - recipe = { |
382 |
| - { def.material, def.material }, |
383 |
| - { "", ""}, |
384 |
| - { def.material, def.material }, |
385 |
| - } |
386 |
| - }) |
387 |
| - |
388 | 385 | local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture ..
|
389 | 386 | "^default_fence_rail_overlay.png^[makealpha:255,126,126"
|
390 | 387 | -- Allow almost everything to be overridden
|
@@ -433,26 +430,32 @@ function default.register_fence_rail(name, def)
|
433 | 430 | -- Always add to the fence group, even if no group provided
|
434 | 431 | def.groups.fence = 1
|
435 | 432 |
|
| 433 | + local material = def.material |
436 | 434 | def.texture = nil
|
437 | 435 | def.material = nil
|
438 | 436 |
|
439 | 437 | minetest.register_node(name, def)
|
| 438 | + |
| 439 | + -- Register crafting recipe, trim away starting colon if any |
| 440 | + if not material then return end |
| 441 | + if string.sub(name, 1,1) == ":" then |
| 442 | + name = string.sub(name, 2) |
| 443 | + end |
| 444 | + minetest.register_craft({ |
| 445 | + output = name .. " 16", |
| 446 | + recipe = { |
| 447 | + { material, material }, |
| 448 | + { "", ""}, |
| 449 | + { material, material }, |
| 450 | + } |
| 451 | + }) |
440 | 452 | end
|
441 | 453 |
|
442 | 454 | --
|
443 | 455 | -- Mese post registration helper
|
444 | 456 | --
|
445 | 457 |
|
446 | 458 | function default.register_mesepost(name, def)
|
447 |
| - minetest.register_craft({ |
448 |
| - output = name .. " 4", |
449 |
| - recipe = { |
450 |
| - {'', 'default:glass', ''}, |
451 |
| - {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, |
452 |
| - {'', def.material, ''}, |
453 |
| - } |
454 |
| - }) |
455 |
| - |
456 | 459 | local post_texture = def.texture .. "^default_mese_post_light_side.png^[makealpha:0,0,0"
|
457 | 460 | local post_texture_dark = def.texture .. "^default_mese_post_light_side_dark.png^[makealpha:0,0,0"
|
458 | 461 | -- Allow almost everything to be overridden
|
@@ -480,10 +483,25 @@ function default.register_mesepost(name, def)
|
480 | 483 | end
|
481 | 484 | end
|
482 | 485 |
|
| 486 | + local material = def.material |
483 | 487 | def.texture = nil
|
484 | 488 | def.material = nil
|
485 | 489 |
|
486 | 490 | minetest.register_node(name, def)
|
| 491 | + |
| 492 | + -- Register crafting recipe, trim away starting colon if any |
| 493 | + if not material then return end |
| 494 | + if string.sub(name, 1,1) == ":" then |
| 495 | + name = string.sub(name, 2) |
| 496 | + end |
| 497 | + minetest.register_craft({ |
| 498 | + output = name .. " 4", |
| 499 | + recipe = { |
| 500 | + {'', 'default:glass', ''}, |
| 501 | + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, |
| 502 | + {'', def.material, ''}, |
| 503 | + } |
| 504 | + }) |
487 | 505 | end
|
488 | 506 |
|
489 | 507 | --
|
|
0 commit comments