init.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. -- MESECON_SWITCH
  2. minetest.register_node("mesecons_switch:mesecon_switch_off", {
  3. tiles = {"jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_off.png"},
  4. paramtype2="facedir",
  5. groups = {dig_immediate=2},
  6. description="Switch",
  7. sounds = default.node_sound_stone_defaults(),
  8. mesecons = {receptor = {
  9. state = mesecon.state.off
  10. }},
  11. on_punch = function(pos, node)
  12. mesecon:swap_node(pos, "mesecons_switch:mesecon_switch_on")
  13. mesecon:receptor_on(pos)
  14. minetest.sound_play("mesecons_switch", {pos=pos})
  15. end
  16. })
  17. minetest.register_node("mesecons_switch:mesecon_switch_on", {
  18. tiles = {"jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_side.png", "jeija_mesecon_switch_on.png"},
  19. paramtype2="facedir",
  20. groups = {dig_immediate=2,not_in_creative_inventory=1},
  21. drop="mesecons_switch:mesecon_switch_off 1",
  22. sounds = default.node_sound_stone_defaults(),
  23. mesecons = {receptor = {
  24. state = mesecon.state.on
  25. }},
  26. on_punch = function(pos, node)
  27. mesecon:swap_node(pos, "mesecons_switch:mesecon_switch_off")
  28. mesecon:receptor_off(pos)
  29. minetest.sound_play("mesecons_switch", {pos=pos})
  30. end
  31. })
  32. minetest.register_craft({
  33. output = "mesecons_switch:mesecon_switch_off 2",
  34. recipe = {
  35. {"default:steel_ingot", "default:cobble", "default:steel_ingot"},
  36. {"group:mesecon_conductor_craftable","", "group:mesecon_conductor_craftable"},
  37. }
  38. })