init.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. -- MESELAMPS
  2. -- A lamp is "is an electrical device used to create artificial light" (wikipedia)
  3. -- guess what?
  4. 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. legacy_wallmounted = true,
  16. sunlight_propagates = true,
  17. walkable = true,
  18. light_source = LIGHT_MAX,
  19. node_box = mesecon_lamp_box,
  20. selection_box = mesecon_lamp_box,
  21. groups = {dig_immediate=3,not_in_creative_inventory=1, mesecon_effector_on = 1},
  22. drop='"mesecons_lamp:lamp_off" 1',
  23. mesecons = {effector = {
  24. action_off = function (pos, node)
  25. mesecon:swap_node(pos, "mesecons_lamp:lamp_off")
  26. end
  27. }}
  28. })
  29. minetest.register_node("mesecons_lamp:lamp_off", {
  30. drawtype = "nodebox",
  31. tiles = {"jeija_meselamp_off.png"},
  32. inventory_image = "jeija_meselamp.png",
  33. wield_image = "jeija_meselamp.png",
  34. paramtype = "light",
  35. paramtype2 = "wallmounted",
  36. sunlight_propagates = true,
  37. walkable = true,
  38. node_box = mesecon_lamp_box,
  39. selection_box = mesecon_lamp_box,
  40. groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1},
  41. description="Meselamp",
  42. mesecons = {effector = {
  43. action_on = function (pos, node)
  44. mesecon:swap_node(pos, "mesecons_lamp:lamp_on")
  45. end
  46. }}
  47. })
  48. minetest.register_craft({
  49. output = '"mesecons_lamp:lamp_off" 1',
  50. recipe = {
  51. {'', '"default:glass"', ''},
  52. {'"group:mesecon_conductor_craftable"', '"default:steel_ingot"', '"group:mesecon_conductor_craftable"'},
  53. {'', '"default:glass"', ''},
  54. }
  55. })