init.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. -- The BLINKY_PLANT
  2. minetest.register_node("mesecons_blinkyplant:blinky_plant_off", {
  3. drawtype = "plantlike",
  4. visual_scale = 1,
  5. tiles = {"jeija_blinky_plant_off.png"},
  6. inventory_image = "jeija_blinky_plant_off.png",
  7. paramtype = "light",
  8. walkable = false,
  9. groups = {dig_immediate=3, mesecon = 2},
  10. description="Blinky Plant",
  11. selection_box = {
  12. type = "fixed",
  13. fixed = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
  14. },
  15. mesecons = {receptor = {
  16. state = mesecon.state.off
  17. }}
  18. })
  19. minetest.register_node("mesecons_blinkyplant:blinky_plant_on", {
  20. drawtype = "plantlike",
  21. visual_scale = 1,
  22. tiles = {"jeija_blinky_plant_on.png"},
  23. inventory_image = "jeija_blinky_plant_off.png",
  24. paramtype = "light",
  25. walkable = false,
  26. groups = {dig_immediate=3, not_in_creative_inventory=1, mesecon = 2},
  27. drop='"mesecons_blinkyplant:blinky_plant_off" 1',
  28. light_source = LIGHT_MAX-7,
  29. description = "Blinky Plant",
  30. selection_box = {
  31. type = "fixed",
  32. fixed = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
  33. },
  34. mesecons = {receptor = {
  35. state = mesecon.state.on
  36. }}
  37. })
  38. minetest.register_craft({
  39. output = '"mesecons_blinkyplant:blinky_plant_off" 1',
  40. recipe = {
  41. {'','"group:mesecon_conductor_craftable"',''},
  42. {'','"group:mesecon_conductor_craftable"',''},
  43. {'"default:sapling"','"default:sapling"','"default:sapling"'},
  44. }
  45. })
  46. minetest.register_abm(
  47. {nodenames = {"mesecons_blinkyplant:blinky_plant_off"},
  48. interval = BLINKY_PLANT_INTERVAL,
  49. chance = 1,
  50. action = function(pos, node, active_object_count, active_object_count_wider)
  51. --minetest.env:remove_node(pos)
  52. minetest.env:add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
  53. nodeupdate(pos)
  54. mesecon:receptor_on(pos)
  55. end,
  56. })
  57. minetest.register_abm({
  58. nodenames = {"mesecons_blinkyplant:blinky_plant_on"},
  59. interval = BLINKY_PLANT_INTERVAL,
  60. chance = 1,
  61. action = function(pos, node, active_object_count, active_object_count_wider)
  62. --minetest.env:remove_node(pos)
  63. minetest.env:add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
  64. nodeupdate(pos)
  65. mesecon:receptor_off(pos)
  66. end,
  67. })