init.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. mesecon.register_node("mesecons_walllever:wall_lever", {
  5. description="Lever",
  6. drawtype = "mesh",
  7. inventory_image = "jeija_wall_lever_inv.png",
  8. wield_image = "jeija_wall_lever_inv.png",
  9. paramtype = "light",
  10. paramtype2 = "facedir",
  11. sunlight_propagates = true,
  12. walkable = false,
  13. selection_box = {
  14. type = "fixed",
  15. fixed = { -8/16, -8/16, 3/16, 8/16, 8/16, 8/16 },
  16. },
  17. sounds = default.node_sound_wood_defaults(),
  18. on_punch = function (pos, node)
  19. if(mesecon.flipstate(pos, node) == "on") then
  20. mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
  21. else
  22. mesecon.receptor_off(pos, mesecon.rules.buttonlike_get(node))
  23. end
  24. minetest.sound_play("mesecons_lever", {pos=pos})
  25. end
  26. },{
  27. tiles = { "jeija_wall_lever_off.png" },
  28. mesh="jeija_wall_lever_off.obj",
  29. mesecons = {receptor = {
  30. rules = mesecon.rules.buttonlike_get,
  31. state = mesecon.state.off
  32. }},
  33. groups = {dig_immediate = 2, mesecon_needs_receiver = 1}
  34. },{
  35. tiles = { "jeija_wall_lever_on.png" },
  36. mesh="jeija_wall_lever_on.obj",
  37. mesecons = {receptor = {
  38. rules = mesecon.rules.buttonlike_get,
  39. state = mesecon.state.on
  40. }},
  41. groups = {dig_immediate = 2, mesecon_needs_receiver = 1, not_in_creative_inventory = 1}
  42. })
  43. minetest.register_craft({
  44. output = "mesecons_walllever:wall_lever_off 2",
  45. recipe = {
  46. {"group:mesecon_conductor_craftable"},
  47. {"default:stone"},
  48. {"default:stick"},
  49. }
  50. })