init.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. function insulated_wire_get_rules(node)
  2. local rules = {{x = 1, y = 0, z = 0},
  3. {x =-1, y = 0, z = 0}}
  4. if node.param2 == 1 or node.param2 == 3 then
  5. return mesecon.rotate_rules_right(rules)
  6. end
  7. return rules
  8. end
  9. minetest.register_node("mesecons_insulated:insulated_on", {
  10. drawtype = "nodebox",
  11. description = "Insulated Mesecon",
  12. tiles = {
  13. "jeija_insulated_wire_sides_on.png",
  14. "jeija_insulated_wire_sides_on.png",
  15. "jeija_insulated_wire_ends_on.png",
  16. "jeija_insulated_wire_ends_on.png",
  17. "jeija_insulated_wire_sides_on.png",
  18. "jeija_insulated_wire_sides_on.png"
  19. },
  20. paramtype = "light",
  21. paramtype2 = "facedir",
  22. walkable = false,
  23. sunlight_propagates = true,
  24. selection_box = {
  25. type = "fixed",
  26. fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 }
  27. },
  28. node_box = {
  29. type = "fixed",
  30. fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
  31. },
  32. groups = {dig_immediate = 3, not_in_creative_inventory = 1},
  33. drop = "mesecons_insulated:insulated_off",
  34. mesecons = {conductor = {
  35. state = mesecon.state.on,
  36. offstate = "mesecons_insulated:insulated_off",
  37. rules = insulated_wire_get_rules
  38. }}
  39. })
  40. minetest.register_node("mesecons_insulated:insulated_off", {
  41. drawtype = "nodebox",
  42. description = "Insulated Mesecon",
  43. tiles = {
  44. "jeija_insulated_wire_sides_off.png",
  45. "jeija_insulated_wire_sides_off.png",
  46. "jeija_insulated_wire_ends_off.png",
  47. "jeija_insulated_wire_ends_off.png",
  48. "jeija_insulated_wire_sides_off.png",
  49. "jeija_insulated_wire_sides_off.png"
  50. },
  51. paramtype = "light",
  52. paramtype2 = "facedir",
  53. walkable = false,
  54. sunlight_propagates = true,
  55. selection_box = {
  56. type = "fixed",
  57. fixed = { -16/32-0.001, -18/32, -7/32, 16/32+0.001, -12/32, 7/32 }
  58. },
  59. node_box = {
  60. type = "fixed",
  61. fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 }
  62. },
  63. groups = {dig_immediate = 3},
  64. mesecons = {conductor = {
  65. state = mesecon.state.off,
  66. onstate = "mesecons_insulated:insulated_on",
  67. rules = insulated_wire_get_rules
  68. }}
  69. })
  70. minetest.register_craft({
  71. output = "mesecons_insulated:insulated_off 3",
  72. recipe = {
  73. {"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"},
  74. {"mesecons:wire_00000000_off", "mesecons:wire_00000000_off", "mesecons:wire_00000000_off"},
  75. {"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"},
  76. }
  77. })