init.lua 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. -- WALL LEVER
  2. -- Basically a switch that can be attached to a wall
  3. -- Powers the block 2 nodes behind (using a receiver)
  4. minetest.register_node("mesecons_walllever:wall_lever_off", {
  5. drawtype = "nodebox",
  6. tiles = {
  7. "jeija_wall_lever_tb.png",
  8. "jeija_wall_lever_bottom.png",
  9. "jeija_wall_lever_sides.png",
  10. "jeija_wall_lever_sides.png",
  11. "jeija_wall_lever_back.png",
  12. "jeija_wall_lever_off.png",
  13. },
  14. inventory_image = "jeija_wall_lever_off.png",
  15. wield_image = "jeija_wall_lever_off.png",
  16. paramtype = "light",
  17. paramtype2 = "facedir",
  18. sunlight_propagates = true,
  19. walkable = false,
  20. selection_box = {
  21. type = "fixed",
  22. fixed = { -8/16, -8/16, 3/16, 8/16, 8/16, 8/16 },
  23. },
  24. node_box = {
  25. type = "fixed",
  26. fixed = {{ -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the base "slab"
  27. { -5/16, -3/16, 5/16, 5/16, 3/16, 6/16 }, -- the lighted ring area
  28. { -4/16, -2/16, 4/16, 4/16, 2/16, 5/16 }, -- the raised bit that the lever "sits" on
  29. { -2/16, -1/16, 3/16, 2/16, 1/16, 4/16 }, -- the lever "hinge"
  30. { -1/16, -8/16, 4/16, 1/16, 0, 6/16 }} -- the lever itself.
  31. },
  32. groups = {dig_immediate=2, mesecon_needs_receiver = 1},
  33. description="Lever",
  34. on_punch = function (pos, node)
  35. mesecon:swap_node(pos, "mesecons_walllever:wall_lever_on")
  36. mesecon:receptor_on(pos, mesecon.rules.buttonlike_get(node))
  37. end,
  38. mesecons = {receptor = {
  39. rules = mesecon.rules.buttonlike_get,
  40. state = mesecon.state.off
  41. }}
  42. })
  43. minetest.register_node("mesecons_walllever:wall_lever_on", {
  44. drawtype = "nodebox",
  45. tiles = {
  46. "jeija_wall_lever_top.png",
  47. "jeija_wall_lever_tb.png",
  48. "jeija_wall_lever_sides.png",
  49. "jeija_wall_lever_sides.png",
  50. "jeija_wall_lever_back.png",
  51. "jeija_wall_lever_on.png",
  52. },
  53. inventory_image = "jeija_wall_lever_on.png",
  54. paramtype = "light",
  55. paramtype2 = "facedir",
  56. sunlight_propagates = true,
  57. walkable = false,
  58. light_source = LIGHT_MAX-7,
  59. selection_box = {
  60. type = "fixed",
  61. fixed = { -8/16, -8/16, 3/16, 8/16, 8/16, 8/16 },
  62. },
  63. node_box = {
  64. type = "fixed",
  65. fixed = {{ -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the base "slab"
  66. { -5/16, -3/16, 5/16, 5/16, 3/16, 6/16 }, -- the lighted ring area
  67. { -4/16, -2/16, 4/16, 4/16, 2/16, 5/16 }, -- the raised bit that the lever "sits" on
  68. { -2/16, -1/16, 3/16, 2/16, 1/16, 4/16 }, -- the lever "hinge"
  69. { -1/16, 0, 4/16, 1/16, 8/16, 6/16 }} -- the lever itself.
  70. },
  71. groups = {dig_immediate = 2, not_in_creative_inventory = 1, mesecon_needs_receiver = 1},
  72. drop = '"mesecons_walllever:wall_lever_off" 1',
  73. description="Lever",
  74. on_punch = function (pos, node)
  75. mesecon:swap_node(pos, "mesecons_walllever:wall_lever_off")
  76. mesecon:receptor_off(pos, mesecon.rules.buttonlike_get(node))
  77. end,
  78. mesecons = {receptor = {
  79. rules = mesecon.rules.buttonlike_get,
  80. state = mesecon.state.on
  81. }}
  82. })
  83. minetest.register_craft({
  84. output = '"mesecons_walllever:wall_lever_off" 2',
  85. recipe = {
  86. {'"group:mesecon_conductor_craftable"'},
  87. {'"default:stone"'},
  88. {'"default:stick"'},
  89. }
  90. })