init.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. -- MESELAMPS
  2. -- A lamp is "is an electrical device used to create artificial light" (wikipedia)
  3. -- guess what?
  4. local mesecon_lamp_box = {
  5. type = "wallmounted",
  6. wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
  7. wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
  8. wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
  9. }
  10. minetest.register_node("mesecons_lamp:lamp_on", {
  11. drawtype = "nodebox",
  12. tiles = {"jeija_meselamp_on.png"},
  13. paramtype = "light",
  14. paramtype2 = "wallmounted",
  15. is_ground_content = false,
  16. legacy_wallmounted = true,
  17. sunlight_propagates = true,
  18. walkable = true,
  19. light_source = minetest.LIGHT_MAX,
  20. node_box = mesecon_lamp_box,
  21. selection_box = mesecon_lamp_box,
  22. groups = {dig_immediate = 3,not_in_creative_inventory = 1, mesecon_effector_on = 1},
  23. drop = "mesecons_lamp:lamp_off 1",
  24. sounds = default.node_sound_glass_defaults(),
  25. mesecons = {effector = {
  26. action_off = function (pos, node)
  27. minetest.swap_node(pos, {name = "mesecons_lamp:lamp_off", param2 = node.param2})
  28. end,
  29. rules = mesecon.rules.wallmounted_get,
  30. }},
  31. on_blast = mesecon.on_blastnode,
  32. })
  33. minetest.register_node("mesecons_lamp:lamp_off", {
  34. drawtype = "nodebox",
  35. tiles = {"jeija_meselamp_off.png"},
  36. inventory_image = "jeija_meselamp.png",
  37. wield_image = "jeija_meselamp.png",
  38. paramtype = "light",
  39. paramtype2 = "wallmounted",
  40. is_ground_content = false,
  41. sunlight_propagates = true,
  42. walkable = true,
  43. node_box = mesecon_lamp_box,
  44. selection_box = mesecon_lamp_box,
  45. groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1},
  46. description = "Mesecon Lamp",
  47. sounds = default.node_sound_glass_defaults(),
  48. mesecons = {effector = {
  49. action_on = function (pos, node)
  50. minetest.swap_node(pos, {name = "mesecons_lamp:lamp_on", param2 = node.param2})
  51. end,
  52. rules = mesecon.rules.wallmounted_get,
  53. }},
  54. on_blast = mesecon.on_blastnode,
  55. })
  56. minetest.register_craft({
  57. output = "mesecons_lamp:lamp_off 1",
  58. recipe = {
  59. {"", "default:glass", ""},
  60. {"group:mesecon_conductor_craftable", "default:steel_ingot", "group:mesecon_conductor_craftable"},
  61. {"", "default:glass", ""},
  62. }
  63. })