init.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. minetest.sound_play("mesecons_lever", {pos=pos})
  38. end,
  39. sounds = default.node_sound_wood_defaults(),
  40. mesecons = {receptor = {
  41. rules = mesecon.rules.buttonlike_get,
  42. state = mesecon.state.off
  43. }}
  44. })
  45. minetest.register_node("mesecons_walllever:wall_lever_on", {
  46. drawtype = "nodebox",
  47. tiles = {
  48. "jeija_wall_lever_top.png",
  49. "jeija_wall_lever_tb.png",
  50. "jeija_wall_lever_sides.png",
  51. "jeija_wall_lever_sides.png",
  52. "jeija_wall_lever_back.png",
  53. "jeija_wall_lever_on.png",
  54. },
  55. inventory_image = "jeija_wall_lever_on.png",
  56. paramtype = "light",
  57. paramtype2 = "facedir",
  58. sunlight_propagates = true,
  59. walkable = false,
  60. light_source = LIGHT_MAX-7,
  61. selection_box = {
  62. type = "fixed",
  63. fixed = { -8/16, -8/16, 3/16, 8/16, 8/16, 8/16 },
  64. },
  65. node_box = {
  66. type = "fixed",
  67. fixed = {{ -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the base "slab"
  68. { -5/16, -3/16, 5/16, 5/16, 3/16, 6/16 }, -- the lighted ring area
  69. { -4/16, -2/16, 4/16, 4/16, 2/16, 5/16 }, -- the raised bit that the lever "sits" on
  70. { -2/16, -1/16, 3/16, 2/16, 1/16, 4/16 }, -- the lever "hinge"
  71. { -1/16, 0, 4/16, 1/16, 8/16, 6/16 }} -- the lever itself.
  72. },
  73. groups = {dig_immediate = 2, not_in_creative_inventory = 1, mesecon_needs_receiver = 1},
  74. drop = "mesecons_walllever:wall_lever_off 1",
  75. description="Lever",
  76. on_punch = function (pos, node)
  77. mesecon:swap_node(pos, "mesecons_walllever:wall_lever_off")
  78. mesecon:receptor_off(pos, mesecon.rules.buttonlike_get(node))
  79. minetest.sound_play("mesecons_lever", {pos=pos})
  80. end,
  81. sounds = default.node_sound_wood_defaults(),
  82. mesecons = {receptor = {
  83. rules = mesecon.rules.buttonlike_get,
  84. state = mesecon.state.on
  85. }}
  86. })
  87. minetest.register_craft({
  88. output = "mesecons_walllever:wall_lever_off 2",
  89. recipe = {
  90. {"group:mesecon_conductor_craftable"},
  91. {"default:stone"},
  92. {"default:stick"},
  93. }
  94. })