Pipeworks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.9KB

  1. local S = minetest.get_translator("pipeworks")
  2. local straight = function(pos, node, velocity, stack) return {velocity} end
  3. minetest.register_node("pipeworks:steel_block_embedded_tube", {
  4. description = S("Airtight steelblock embedded tube"),
  5. tiles = {
  6. "default_steel_block.png", "default_steel_block.png",
  7. "default_steel_block.png", "default_steel_block.png",
  8. "default_steel_block.png^pipeworks_tube_connection_metallic.png",
  9. "default_steel_block.png^pipeworks_tube_connection_metallic.png",
  10. },
  11. paramtype = "light",
  12. paramtype2 = "facedir",
  13. groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1},
  14. legacy_facedir_simple = true,
  15. sounds = default.node_sound_stone_defaults(),
  16. tube = {
  17. connect_sides = {front = 1, back = 1,},
  18. priority = 50,
  19. can_go = straight,
  20. can_insert = function(pos, node, stack, direction)
  21. local dir = minetest.facedir_to_dir(node.param2)
  22. return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
  23. end,
  24. },
  25. after_place_node = pipeworks.after_place,
  26. after_dig_node = pipeworks.after_dig,
  27. on_rotate = pipeworks.on_rotate,
  28. })
  29. minetest.register_craft( {
  30. output = "pipeworks:steel_block_embedded_tube 1",
  31. recipe = {
  32. { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
  33. { "default:steel_ingot", "pipeworks:tube_1", "default:steel_ingot" },
  34. { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }
  35. },
  36. })
  37. local pane_box = {
  38. type = "fixed",
  39. fixed = {
  40. { -9/64, -9/64, -8/16, 9/64, 9/64, 8/16 }, -- tube
  41. { -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 } -- pane
  42. }
  43. }
  44. minetest.register_node("pipeworks:steel_pane_embedded_tube", {
  45. drawtype = "nodebox",
  46. description = S("Airtight panel embedded tube"),
  47. tiles = {
  48. "pipeworks_pane_embedded_tube_sides.png^[transformR90",
  49. "pipeworks_pane_embedded_tube_sides.png^[transformR90",
  50. "pipeworks_pane_embedded_tube_sides.png",
  51. "pipeworks_pane_embedded_tube_sides.png",
  52. "pipeworks_pane_embedded_tube_ends.png", "pipeworks_pane_embedded_tube_ends.png",
  53. },
  54. node_box = pane_box,
  55. selection_box = pane_box,
  56. collision_box = pane_box,
  57. paramtype = "light",
  58. paramtype2 = "facedir",
  59. groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1},
  60. legacy_facedir_simple = true,
  61. sounds = default.node_sound_stone_defaults(),
  62. tube = {
  63. connect_sides = {front = 1, back = 1,},
  64. priority = 50,
  65. can_go = straight,
  66. can_insert = function(pos, node, stack, direction)
  67. local dir = minetest.facedir_to_dir(node.param2)
  68. return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
  69. end,
  70. },
  71. after_place_node = pipeworks.after_place,
  72. after_dig_node = pipeworks.after_dig,
  73. on_rotate = pipeworks.on_rotate,
  74. })
  75. minetest.register_craft( {
  76. output = "pipeworks:steel_pane_embedded_tube 1",
  77. recipe = {
  78. { "", "default:steel_ingot", "" },
  79. { "", "pipeworks:tube_1", "" },
  80. { "", "default:steel_ingot", "" }
  81. },
  82. })