init.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. -- mesecons_switch
  2. mesecon.register_node("mesecons_switch:mesecon_switch", {
  3. paramtype2="facedir",
  4. description="Switch",
  5. sounds = default.node_sound_stone_defaults(),
  6. on_rightclick = function (pos, node)
  7. if(mesecon.flipstate(pos, node) == "on") then
  8. mesecon.receptor_on(pos)
  9. else
  10. mesecon.receptor_off(pos)
  11. end
  12. minetest.sound_play("mesecons_switch", {pos=pos})
  13. end
  14. },{
  15. groups = {dig_immediate=2},
  16. tiles = { "mesecons_switch_side.png", "mesecons_switch_side.png",
  17. "mesecons_switch_side.png", "mesecons_switch_side.png",
  18. "mesecons_switch_side.png", "mesecons_switch_off.png"},
  19. mesecons = {receptor = { state = mesecon.state.off }}
  20. },{
  21. groups = {dig_immediate=2, not_in_creative_inventory=1},
  22. tiles = { "mesecons_switch_side.png", "mesecons_switch_side.png",
  23. "mesecons_switch_side.png", "mesecons_switch_side.png",
  24. "mesecons_switch_side.png", "mesecons_switch_on.png"},
  25. mesecons = {receptor = { state = mesecon.state.on }}
  26. })
  27. minetest.register_craft({
  28. output = "mesecons_switch:mesecon_switch_off 2",
  29. recipe = {
  30. {"default:steel_ingot", "default:cobble", "default:steel_ingot"},
  31. {"group:mesecon_conductor_craftable","", "group:mesecon_conductor_craftable"},
  32. }
  33. })