init.lua 1.2 KB

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