corner.lua 2.1 KB

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