init.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. mesecons = {receptor = {
  8. state = mesecon.state.off
  9. }},
  10. on_punch = function(pos, node)
  11. mesecon:swap_node(pos, "mesecons_switch:mesecon_switch_on")
  12. mesecon:receptor_on(pos)
  13. end
  14. })
  15. minetest.register_node("mesecons_switch:mesecon_switch_on", {
  16. 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"},
  17. paramtype2="facedir",
  18. groups = {dig_immediate=2,not_in_creative_inventory=1},
  19. drop='"mesecons_switch:mesecon_switch_off" 1',
  20. mesecons = {receptor = {
  21. state = mesecon.state.on
  22. }},
  23. on_punch = function(pos, node)
  24. mesecon:swap_node(pos, "mesecons_switch:mesecon_switch_off")
  25. mesecon:receptor_off(pos)
  26. end
  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. })