init.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. local lightstone_rules = {
  2. {x=0, y=0, z=-1},
  3. {x=1, y=0, z=0},
  4. {x=-1, y=0, z=0},
  5. {x=0, y=0, z=1},
  6. {x=1, y=1, z=0},
  7. {x=1, y=-1, z=0},
  8. {x=-1, y=1, z=0},
  9. {x=-1, y=-1, z=0},
  10. {x=0, y=1, z=1},
  11. {x=0, y=-1, z=1},
  12. {x=0, y=1, z=-1},
  13. {x=0, y=-1, z=-1},
  14. {x=0, y=-1, z=0},
  15. }
  16. function mesecon.lightstone_add(name, base_item, texture_off, texture_on)
  17. minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_off", {
  18. tiles = {texture_off},
  19. groups = {cracky=2, mesecon_effector_off = 1, mesecon = 2},
  20. description=name.." Lightstone",
  21. sounds = default.node_sound_stone_defaults(),
  22. mesecons = {effector = {
  23. rules = lightstone_rules,
  24. action_on = function (pos, node)
  25. minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_on", param2 = node.param2})
  26. end,
  27. }}
  28. })
  29. minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_on", {
  30. tiles = {texture_on},
  31. groups = {cracky=2,not_in_creative_inventory=1, mesecon = 2},
  32. drop = "mesecons_lightstone:lightstone_" .. name .. "_off",
  33. light_source = LIGHT_MAX-2,
  34. sounds = default.node_sound_stone_defaults(),
  35. mesecons = {effector = {
  36. rules = lightstone_rules,
  37. action_off = function (pos, node)
  38. minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_off", param2 = node.param2})
  39. end,
  40. }}
  41. })
  42. minetest.register_craft({
  43. output = "mesecons_lightstone:lightstone_" .. name .. "_off",
  44. recipe = {
  45. {"",base_item,""},
  46. {base_item,"default:torch",base_item},
  47. {"","group:mesecon_conductor_craftable",""}
  48. }
  49. })
  50. end
  51. mesecon.lightstone_add("red", "dye:red", "jeija_lightstone_red_off.png", "jeija_lightstone_red_on.png")
  52. mesecon.lightstone_add("green", "dye:green", "jeija_lightstone_green_off.png", "jeija_lightstone_green_on.png")
  53. mesecon.lightstone_add("blue", "dye:blue", "jeija_lightstone_blue_off.png", "jeija_lightstone_blue_on.png")
  54. mesecon.lightstone_add("gray", "dye:grey", "jeija_lightstone_gray_off.png", "jeija_lightstone_gray_on.png")
  55. mesecon.lightstone_add("darkgray", "dye:dark_grey", "jeija_lightstone_darkgray_off.png", "jeija_lightstone_darkgray_on.png")
  56. mesecon.lightstone_add("yellow", "dye:yellow", "jeija_lightstone_yellow_off.png", "jeija_lightstone_yellow_on.png")