init.lua 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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, desc)
  17. if not desc then
  18. desc = name .. " Lightstone"
  19. end
  20. minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_off", {
  21. tiles = {texture_off},
  22. is_ground_content = false,
  23. groups = {cracky = 2, mesecon_effector_off = 1, mesecon = 2},
  24. description = desc,
  25. sounds = default.node_sound_stone_defaults(),
  26. mesecons = {effector = {
  27. rules = lightstone_rules,
  28. action_on = function (pos, node)
  29. minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_on", param2 = node.param2})
  30. end,
  31. }},
  32. on_blast = mesecon.on_blastnode,
  33. })
  34. minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_on", {
  35. tiles = {texture_on},
  36. is_ground_content = false,
  37. groups = {cracky = 2, not_in_creative_inventory = 1, mesecon = 2},
  38. drop = "mesecons_lightstone:lightstone_" .. name .. "_off",
  39. light_source = minetest.LIGHT_MAX - 2,
  40. sounds = default.node_sound_stone_defaults(),
  41. mesecons = {effector = {
  42. rules = lightstone_rules,
  43. action_off = function (pos, node)
  44. minetest.swap_node(pos, {name = "mesecons_lightstone:lightstone_" .. name .. "_off", param2 = node.param2})
  45. end,
  46. }},
  47. on_blast = mesecon.on_blastnode,
  48. })
  49. minetest.register_craft({
  50. output = "mesecons_lightstone:lightstone_" .. name .. "_off",
  51. recipe = {
  52. {"",base_item,""},
  53. {base_item,"default:torch",base_item},
  54. {"","group:mesecon_conductor_craftable",""}
  55. }
  56. })
  57. end
  58. mesecon.lightstone_add("red", "dye:red", "jeija_lightstone_red_off.png", "jeija_lightstone_red_on.png", "Red Lightstone")
  59. mesecon.lightstone_add("green", "dye:green", "jeija_lightstone_green_off.png", "jeija_lightstone_green_on.png", "Green Lightstone")
  60. mesecon.lightstone_add("blue", "dye:blue", "jeija_lightstone_blue_off.png", "jeija_lightstone_blue_on.png", "Blue Lightstone")
  61. mesecon.lightstone_add("gray", "dye:grey", "jeija_lightstone_gray_off.png", "jeija_lightstone_gray_on.png", "Grey Lightstone")
  62. mesecon.lightstone_add("darkgray", "dye:dark_grey", "jeija_lightstone_darkgray_off.png", "jeija_lightstone_darkgray_on.png", "Dark Grey Lightstone")
  63. mesecon.lightstone_add("yellow", "dye:yellow", "jeija_lightstone_yellow_off.png", "jeija_lightstone_yellow_on.png", "Yellow Lightstone")
  64. mesecon.lightstone_add("orange", "dye:orange", "jeija_lightstone_orange_off.png", "jeija_lightstone_orange_on.png", "Orange Lightstone")
  65. mesecon.lightstone_add("white", "dye:white", "jeija_lightstone_white_off.png", "jeija_lightstone_white_on.png", "White Lightstone")
  66. mesecon.lightstone_add("pink", "dye:pink", "jeija_lightstone_pink_off.png", "jeija_lightstone_pink_on.png", "Pink Lightstone")
  67. mesecon.lightstone_add("magenta", "dye:magenta", "jeija_lightstone_magenta_off.png", "jeija_lightstone_magenta_on.png", "Magenta Lightstone")
  68. mesecon.lightstone_add("cyan", "dye:cyan", "jeija_lightstone_cyan_off.png", "jeija_lightstone_cyan_on.png", "Cyan Lightstone")
  69. mesecon.lightstone_add("violet", "dye:violet", "jeija_lightstone_violet_off.png", "jeija_lightstone_violet_on.png", "Violet Lightstone")