init.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. sounds = default.node_sound_glass_defaults(),
  24. mesecons = {effector = {
  25. action_off = function (pos, node)
  26. mesecon:swap_node(pos, "mesecons_lamp:lamp_off")
  27. end
  28. }}
  29. })
  30. minetest.register_node("mesecons_lamp:lamp_off", {
  31. drawtype = "nodebox",
  32. tiles = {"jeija_meselamp_off.png"},
  33. inventory_image = "jeija_meselamp.png",
  34. wield_image = "jeija_meselamp.png",
  35. paramtype = "light",
  36. paramtype2 = "wallmounted",
  37. sunlight_propagates = true,
  38. walkable = true,
  39. node_box = mesecon_lamp_box,
  40. selection_box = mesecon_lamp_box,
  41. groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1},
  42. description="Meselamp",
  43. sounds = default.node_sound_glass_defaults(),
  44. mesecons = {effector = {
  45. action_on = function (pos, node)
  46. mesecon:swap_node(pos, "mesecons_lamp:lamp_on")
  47. end
  48. }}
  49. })
  50. minetest.register_craft({
  51. output = '"mesecons_lamp:lamp_off" 1',
  52. recipe = {
  53. {'', '"default:glass"', ''},
  54. {'"group:mesecon_conductor_craftable"', '"default:steel_ingot"', '"group:mesecon_conductor_craftable"'},
  55. {'', '"default:glass"', ''},
  56. }
  57. })