init.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. -- The BLINKY_PLANT
  2. local toggle_timer = function (pos)
  3. local timer = minetest.get_node_timer(pos)
  4. if timer:is_started() then
  5. timer:stop()
  6. else
  7. timer:start(mesecon.setting("blinky_plant_interval", 3))
  8. end
  9. end
  10. local on_timer = function (pos)
  11. local node = minetest.get_node(pos)
  12. if(mesecon.flipstate(pos, node) == "on") then
  13. mesecon.receptor_on(pos)
  14. else
  15. mesecon.receptor_off(pos)
  16. end
  17. toggle_timer(pos)
  18. end
  19. mesecon.register_node("mesecons_blinkyplant:blinky_plant", {
  20. description="Blinky Plant",
  21. drawtype = "plantlike",
  22. inventory_image = "jeija_blinky_plant_off.png",
  23. paramtype = "light",
  24. is_ground_content = false,
  25. walkable = false,
  26. sounds = default.node_sound_leaves_defaults(),
  27. selection_box = {
  28. type = "fixed",
  29. fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3},
  30. },
  31. on_timer = on_timer,
  32. on_rightclick = toggle_timer,
  33. on_construct = toggle_timer
  34. },{
  35. tiles = {"jeija_blinky_plant_off.png"},
  36. groups = {dig_immediate=3},
  37. mesecons = {receptor = { state = mesecon.state.off }}
  38. },{
  39. tiles = {"jeija_blinky_plant_on.png"},
  40. groups = {dig_immediate=3, not_in_creative_inventory=1},
  41. mesecons = {receptor = { state = mesecon.state.on }}
  42. })
  43. minetest.register_craft({
  44. output = "mesecons_blinkyplant:blinky_plant_off 1",
  45. recipe = { {"","group:mesecon_conductor_craftable",""},
  46. {"","group:mesecon_conductor_craftable",""},
  47. {"group:sapling","group:sapling","group:sapling"}}
  48. })